3

I've been experiencing some issues with the header presentation of a SOAP Request. I think I'm missing something.

My (partial) wsdl looks like this:

<wsdl:definitions   xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
                    xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
                    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
                    xmlns:aws="http://xml.xxx.com"
                    xmlns:security_authenticate_6_1="http://xml.xxx.com/VLSSLQ_06_1_1A" 
                    xmlns:security_authenticatereply_6_1="http://xml.xxx.com/VLSSLR_06_1_1A"
                    targetNamespace="http://xml.xxx.com">  
  <wsdl:types>
    <xsd:schema targetNamespace="http://xml.xxx.com">
      <xsd:import namespace="http://xml.xxx.com/ws/2009/01/WBS_Session-2.0.xsd" schemaLocation="WBS_Session-2.0.xsd"/>      
      <xsd:import namespace="http://xml.xxx.com/VLSSLQ_06_1_1A" schemaLocation="Security_Authenticate_06_1_1A.xsd"/>
      <xsd:import namespace="http://xml.xxx.com/VLSSLR_06_1_1A" schemaLocation="Security_AuthenticateReply_06_1_1A.xsd"/>
    </xsd:schema>
  </wsdl:types>
  <wsdl:message name="Session" xmlns:ns0="http://xml.xxx.com/ws/2009/01/WBS_Session-2.0.xsd">
    <wsdl:part name="Session" element="ns0:Session"/>
  </wsdl:message>  
  <wsdl:message name="Security_Authenticate_6_1">
    <wsdl:part name="Security_Authenticate_6_1" element="security_authenticate_6_1:Security_Authenticate"/>
  </wsdl:message>
  <wsdl:message name="Security_AuthenticateReply_6_1">
    <wsdl:part name="Security_AuthenticateReply_6_1" element="security_authenticatereply_6_1:Security_AuthenticateReply"/>
  </wsdl:message>
  <wsdl:portType name="XXXWebServicesPT">    
    <wsdl:operation name="Security_Authenticate">
      <wsdl:input message="aws:Security_Authenticate_6_1"/>
      <wsdl:output message="aws:Security_AuthenticateReply_6_1"/>
    </wsdl:operation>    
  </wsdl:portType>
  <wsdl:binding name="XXXWebServicesBinding" type="aws:XXXWebServicesPT">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>    
    <wsdl:operation name="Security_Authenticate">
      <soap:operation soapAction="http://webservices.xxx.com/1ASIWJTUTUA/VLSSLQ_06_1_1A"/>
      <wsdl:input>
        <soap:header message="aws:Session" part="Session" use="literal"/>
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <soap:header message="aws:Session" part="Session" use="literal"/>
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="XXXWebServices">
    <wsdl:port name="XXXWebServicesPort" binding="aws:XXXWebServicesBinding">
      <soap:address location="https://test.webservices.xxx.com"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

I want to access the Security_Authenticate action, in which case, the header must look something like:

<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'>
    <soapenv:Header>
      <wbs:Session xmlns:wbs='http://xml.xxx.com/ws/2009/01/WBS_Session-2.0.xsd'>
        <wbs:SessionId></wbs:SessionId>
        <wbs:SequenceNumber></wbs:SequenceNumber>
        <wbs:SecurityToken></wbs:SecurityToken>
      </wbs:Session>
    </soapenv:Header>
    <soapenv:Body>
      <vls:Security_Authenticate>
        <vls:tagX>
          <vls:tagY>yyy</vls:tagY>
          <vls:tagZ>Z</vls:tagZ>
        </vls:tagX>
      </vls:Security_Authenticate>
    </soapenv:Body>
</soapenv:Envelope>

How should I built my soapenvelope and my header namespaces?

Thanks.

3
  • Did you solve it? I think that I have the same error, with the same web service (The namespaces fits if you change xxx for the name of the company) Did you find any way to solve it? Mine one is done in VB.NET, and I'm using a webservice that the company itself created, so it shouldn'd have any error. I'm not creating manually my SOAP request, so I don't know...
    – user858060
    Jul 22, 2011 at 13:58
  • 1
    I solved using SOAP (ruby gem to build and handle soap messages) and specifying the actions as snake-case, for example, if the action name is: ActionNameTest, I had to call it like "action_name_test". It worked for me....
    – content01
    Jul 22, 2011 at 14:04
  • could you please explain your solution in some detail. I am facing the same problem.
    – wib
    Jul 22, 2015 at 5:08

1 Answer 1

1

You have to declare the namespace before you use the object in the xsd, so in your case, to use the Session object:

<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'>
  <soapenv:Header>
    <wbs:Session xmlns:wbs='http://xml.xxx.com/ws/2009/01/WBS_Session-2.0.xsd'>
      <wbs:SessionId></wbs:SessionId>
      <wbs:SequenceNumber></wbs:SequenceNumber>
      <wbs:SecurityToken></wbs:SecurityToken>
    </wbs:Session>
  </soapenv:Header>
  ...
2
  • 2
    I keep getting this message: (soap:Client) 12|Presentation|soap message header incorrect (in ruby on rails). However, if I copy-paste my XML request and run it on soapUI I get the right response with no errors!
    – content01
    Jun 28, 2011 at 20:07
  • I don't know much about what ROR might be doing. I take it that you're correctly declaring your soapenv namespace then. Perhaps post your full xml in your question?
    – dandrews
    Jun 28, 2011 at 20:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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