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
SoleesSolees 

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">'+
         '<soapenv:Header/>'+
         '<soapenv:Body>'+
           '<car:CargaCatalogosHHRequest>'+
              '<car1:CargaCatalogosHHRequest>'+
                 '<CANAL>'+canal+'</CANAL>'+
                 '<FECHA>'+fecha+'</FECHA>'+
              '</car1:CargaCatalogosHHRequest>'+
           '</car:CargaCatalogosHHRequest>'+
        '</soapenv:Body>'+
     '</soapenv:Envelope>';
   HttpRequest req = new HttpRequest();
   req.setEndpoint('http://www.blabla.com/wbi_FuncionCargaCatalogosHH');
   req.setMethod('POST');
   req.setBody(s);
   req.setHeader('Content-Type', 'text/xml');
   req.setHeader('SOAPAction', '"http://www.blabla.com/CargaCatalogosWS"');
   req.setHeader('Accept-Encoding', 'gzip,deflate');
   req.setTimeout(120000);
   Http http = new Http();
   HTTPResponse res = http.send(req);
Best Answer chosen by Solees
SoleesSolees
And remember if the WebServices send you a lot of information, use the @future (callout=true)