I've just started using Salesforc开发者_Go百科e and would like to use the Salesforce API in my iPhone app to submit data from the app to the instance.
I generated the WSDL and know the XML field names which I have to send in the SOAP payload.
But I haven't been able to figure out how exactly to send the request. I generated the SOAP payload, set the headers
- Content-Type: text/xml
- SOAPAction: blank string (according to the WSDL's XML)
- Content-Length: length of the SOAP payload
What I cannot understand - What will be the URL to which I send the request? Can't figure it out from the WSDL
Thanks for any help.
It should be at the bottom of your WSDL, similar to this:
<service name="SforceService">
<documentation>Sforce SOAP API</documentation>
<port binding="tns:SoapBinding" name="Soap">
<soap:address location="https://login.salesforce.com/services/Soap/c/19.0" />
</port>
</service>
Different environments (i.e. production vs. sandbox) and different WSDLs (enterprise vs. partner) might lead to slight changes in the address, but taking it from the WSDL is the way to go.
Also: while all's fine with building your own SOAP messages, you might want to check out the zkSforce Mac OS X library listed on the official API page.
精彩评论