+ Start a Discussion
Oldwen AdrianoOldwen Adriano 

Calling a 3rd Party Webservice

Hello,

I am trying to simply call a web service that one of my clients has.  This appears to be rocket science using Salesforce.  All paths have led to failure for this venture thus far.   I have seen all All Star in this community call the WSDL2Apex a crap shoot.  Has anyone in this community successfully called a 3rd party web service?  If so, please tell me how you accomplished this.  I prefer NOT to use the WSDL2Apex as the code that it generates is completely obfuscated and has complexity WITHOUT necessity. 

I understand that I must create a Remote Site setting for the webservice URL and also have the Salesforce IPs whitelisted on the webservice site.

How do I simply create some XML(SOAP envelope), send it over to the web service and get a response!!??????

Any help is deeply appreciated.

Thank you!!
Michael WelburnMichael Welburn
If you aren't comfortable with WSDL2Apex (or it doesn't generate correctly for you), you can manually build up the XML body in Apex and send that (and parse the response) using the HttpRequest / HttpResponse mechanisms. It does imply that you know what the XML structure is, but that would give you more control.

For an example of what that looks like, here is a StackExchange post. Take a look at the question to get a feel for what a sample could be built as:

http://salesforce.stackexchange.com/questions/60510/how-to-create-httprequest-body-as-plain-string-from-wsdl