简体   繁体   English

通过Android在Salesforce上创建联系人

[英]Create a contact on salesforce through Android

I am trying to use KSOAp on android to connect to salesforce. 我正在尝试在Android上使用KSOAp连接到Salesforce。 Right now I am able to connect and authenticate on the server. 现在,我可以在服务器上进行连接和身份验证。 I can also get the contacts from salesforce. 我也可以从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. 我现在正在尝试通过Android上的客户端应用程序创建联系人。但是不幸的是,我是Webservices和Ksoap的新手,我不知道该怎么做。 The salesforce API talks of creating a contacts Sobject. salesforce API讨论了创建联系人Sobject的问题。 But this i believe is when one uses the wsdl to generate the necessary objects on client side platform. 但是我相信这是当使用wsdl在客户端平台上生成必要的对象时。 Since KSoAP doesnt support wsdl. 由于KSoAP不支持wsdl。 How can i form these Contact objects and pass them on to the webservice? 如何形成这些Contact对象并将其传递给Web服务?

Here is the Api reference. 这是Api参考。 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 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);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM