function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
adreameradreamer 

Apex call to external web services without WSDL

Hi All,

The short story behind this post is that I would like to know whether there is a way to make calls from Apex to an external web service without using the external web service WSDL.

The longer story now. The support provided by Sales Force through Apex to call external web services is great. One can simply take the external web service WSDL, and Sales Force will generate from it the necessary Apex classes to consume that web service. However, here there is an intrinsic assumption that the external web service use SOAP RPC type of message. There are other type or styles of communicating via SOAP such as the "Document" or "Message" style that just exchange XML, and it is the responsability of the caller to that service to generate the proper XML - that would be the structure required by the service including the input parameters. There are a lot of services out there that work in this way but in order to use them from Apex one would need some sort of package/library in Apex that allow one to create and manipulate SOAP messages, very much along the lines of SAAJ in Java. Is there such a package/library in Apex ?.

One related issue is when the web service has a WSDL that cannot be parsed by Sales Force. Here again it would be useful to have such package/library to handle the raw SOAP messages.

I wonder if people have had any experience on this issue and what was the approach they have taken. I guess that one brutal force approach would be to generate the SOAP messages manually just  manipulating  string objects, but  I do not think this is such a good idea.

I would be most grateful for any comments/views on this, and to the developement team, whether there are any plans to support that, or what is the rationale no to do so.

Thank you very much in advance,
Fernando
SuperfellSuperfell
Yes, see the docs on the rest/http components, there are base xml reader/writer classes, along with a http client, that'll let you create the request you want.
DuTomDuTom
You may want to consider using the apex version of XMLDom to create your request.  found here:
 
 
Ideally it would be nice if apex supported xslt transformations,  vote for my lonely idea.
 
 
-Tom