开发者

Create a contact on salesforce through Android

I am trying to use KSOAp on android to connect to salesforce. Right now I am able to connect 开发者_如何学编程and authenticate on the server. I can also get the contacts from salesforce. What I am trying now is to create a contact through my client application on Android.But unfortunately I am new to Webservices and Ksoap and I do not understand how to. The salesforce API talks of creating a contacts Sobject. But this i believe is when one uses the wsdl to generate the necessary objects on client side platform. Since KSoAP doesnt support wsdl. How can i form these Contact objects and pass them on to the webservice?

Here is the Api reference. http://www.salesforce.com/us/developer/docs/api/index_Left.htm#CSHID=sforce_api_calls_search.htm|StartTopic=Content%2Fsforce_api_calls_search.htm|SkinName=webhelp


I found the way to do it, and here it is just for anyone who faces the same problem:

SoapObject person = new SoapObject(NAMESPACE,"Contact");
person.addProperty("FirstName","ABC");
person.addProperty("LastName","XYZ");

SoapObject method = new SoapObject(NAMESPACE,"create");
method.addproperty("sObjects",person);

SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(method);

AndroidHttpTransport transport = new AndroidHttpTransport(URL);
envelope.headerout = //session header
transport.call(SOAP_ACTION,envelope);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜