views:

39

answers:

1

Hi

I've just started using Salesforce 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

  1. Content-Type: text/xml
  2. SOAPAction: blank string (according to the WSDL's XML)
  3. 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.

+1  A: 

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.

eyescream
I did go through the zksforce project page. But couldn't figure out how to use it (as I said haven't used Salesforce API before) Couldn't find ant examples either.
lostInTransit
Do you have any examples for the usage of zksforce? Thanks for your help
lostInTransit
Sorry, I'm not a iPhone/Mac user :D But I'm fighting now with the API for other question (http://stackoverflow.com/questions/3067208/using-salesforces-web-service-to-create-and-set-the-type-of-a-task - looks like a lot has changed in the Apache Axis since my last adventure with it and making the project compile is a road through hell)... I should pull up some example in Java soon, maybe you'll be able to squeeze something out of it...
eyescream
Not sure if you already found it, but http://wiki.developerforce.com/index.php/Sample_SOAP_Messages_%2810.0_API%29 is a great reference if you want to craft SOAP by hand.
eyescream
Thank you for the suggestions eyescream.
lostInTransit