+ Start a Discussion

WSDL Soap Callout Child Namespace

Hello friends,

i've been trying to make work a WSDL2Apex having child namespaces different from the parent.  The solution is forget the WSDL2Apex since it will not add this namespace and the server will send you an error.  Save your time please, I already loose 8 hours trying and finding stuff related and nothing worked.

Use the HttpRequest instead !!!  And make the test in Developer ORG since there you can see the Request XML, other orgs won't work.

If you do this you won't need a Flat WSDL nor the requirements that Salesforce needs to import the WSDL.

So follow this steps:

1) Download SOAPUI
2) Create Project and import WSDL.
3) Get a success request and response.
4) Go to salesforce and create a Class that will send this SOAP callout.
5) Copy your SOAPUI request and paste it as a String.
6) Make changes for input variables.

This is an example of the Apex Code.

String s='<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:car="http://www.blabla.com/CargaCatalogosWS" xmlns:car1="http://www.blabla.com/CargaCatalogosHHType">'+
   HttpRequest req = new HttpRequest();
   req.setHeader('Content-Type', 'text/xml');
   req.setHeader('SOAPAction', '"http://www.blabla.com/CargaCatalogosWS"');
   req.setHeader('Accept-Encoding', 'gzip,deflate');
   Http http = new Http();
   HTTPResponse res = http.send(req);
Best Answer chosen by Solees
And remember if the WebServices send you a lot of information, use the @future (callout=true)