views:

31

answers:

1

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

A: 

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);
Als