You need to sign in to do that
Don't have an account?
Kenn K.
How do I create a webservice that sends record information as xml?
I want to regularly send all account information from salesforce to another external system that will accept it as xml. I have the end point url for the external system and the fields that needs to be sent.
How do I go about creating this? I assume I will have to schedule this to run daily at a particular time.
Please help.
Thanks.
Ken,
You can send outbound messages using Apex and using the Apex Scheduler to set it up to run daily.
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_scheduler.htm
Thanks for your response but I don't think an outbound message will work in my scenario. What I want to do is query all the accounts and send it out to the external system as an xml file. I won't be able to query all the accounts with a workflow.
Thanks Kalpana. Do you have a sample code I could look at. It'll be a good starting point and really helpful.
Also, since I am dealing with a lot of records on a nightly basis, I was thinking something inline with batch apex.
public String getXml() {
List<Account> accList = [select id, Name from account];
XmlStreamWriter w = new XmlStreamWriter();
w.writeStartDocument(null, '1.0');
for(Account acc : [select id, Name from account]){
w.writeStartElement('Id', acc.Id);
w.writeEndElement();
w.writeStartElement('Name', acc.Name);
w.writeEndElement();
}
w.writeEndDocument();
String xmlOutput = w.getXmlString();
w.close();
return xmlOutput;
}
This might help you to create your xml.