1

It seems that the webservice I am accessing is strictly after the namespace to be soapenv

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="....">
 <soapenv:Header>
  ....
 </soapenv:Header>
 <soapenv:Body>
  .....
 </soapenv:Body>
</soapenv:Envelope>

works but changing the soapenv to just env, it fails. The default that salesforce generates when using the webservice generated from the WSDL is env:Envelope

Is it at all possible to override this??

  • 1
    If your service does not accept any legal namespace, it is not SOAP-compliant... – sfdcfox Sep 21 '17 at 5:30
1

WebServiceCallout.invoke is going to keep generating the soap envelope with the same namespace it always does. There isn't any way to alter that.

As @sfdcfox mentioned, ideally the external service would accept any valid SOAP requests with a legal namespace.

If you can't get the external service to fall into line you will need to manually make the required HTTP callouts. I made an alternative version of WSDL2Apex that would generate the required Apex to call the SOAP service. You can see the details in Dreamforce 2014 Presentation - Improved Apex support for SOAP based web services

|improve this answer|||||
  • So the developer has come back with the namespace needs to match what is specified in the attribute - xmlns:soapenv or xmlns:env or xmlns:s.... – Tony White Sep 22 '17 at 4:39
0

Basically the issue I am encountering is not related to the namespace but some issue in the wss header

The reason I suspected the namespace is due to not realising that the namespace in controlled by the attribute xmlns, and I missed changing that when testing in SoapUI eg. From: xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/ To: xmlns:env="http://schemas.xmlsoap.org/soap/envelope/

|improve this answer|||||
0

We had a simular problem with namespace and an xml that was looking different than the one that was generated by our WSDL by using WSDL2apex. We created the xml ourself in our apex class and we used a http callout. When you create your own XML, you can change the needed to make it look like the request you need.

Info/links about HTTP callouts:

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.