Forum Discussion

fml2the's avatar
fml2the
New Contributor
10 years ago

Header part generated also in body in sample request

Hello.

I noticed the following behaviour. In my WSDL (v. 1.1), a have a message element with two parts, name them "headerPart" and "bodyPart":

[code=php:1t0gx157]   <message name="GetLastTradePriceInput">
       <part name="bodyPart" element="xsd1:TradePriceRequest"/>
       <part name="headerPart" element="xsd1:HeaderElement"/>
   </message> [/code:1t0gx157]

In the binding section, I have the following, i.e. the "headerPart" should go to the SOAP header, and the bodyPart should go to the SOAP body:

[code=php:1t0gx157]          <input>
              <soap:header message="tns:GetLastTradePriceInput" part="headerPart" use="literal"/>
              <soap:body message="tns:GetLastTradePriceInput" part="bodyPart" use="literal"/>
          </input> [/code:1t0gx157]

But in the sample request generated by SoapUI (I tried 4.6.1 and 5.0.0), the HeaderElement is generated both in the header and in the body of the SOAP request, i.e. I get this:

[code=php:1t0gx157]<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:stoc="http://example.com/stockquote.xsd">
   <soapenv:Header>
      <stoc:HeaderElement>
         <value>?</value>
      </stoc:HeaderElement>
   </soapenv:Header>
   <soapenv:Body>
      <stoc:TradePriceRequest>
         <tickerSymbol>?</tickerSymbol>
      </stoc:TradePriceRequest>
      <stoc:HeaderElement>
         <value>?</value>
      </stoc:HeaderElement>
   </soapenv:Body>
</
soapenv:Envelope> [/code:1t0gx157]

Is this correct? Shouldn't the HeaderElement be generated in the SOAP Header only?

I attach the whole sample WSDL file (copied from Wikipedia and adjusted to have a two part message)

2 Replies

  • fml2the's avatar
    fml2the
    New Contributor
    I downloaded the source code of SoapUI and tried to locate the code for sample request generation. It starts in the class [tt:bx96k04y]com.eviware.soapui.impl.wsdl.actions.operation.NewRequestAction[/tt:bx96k04y]. The generation further descends to the class [tt:bx96k04y]com.eviware.soapui.impl.wsdl.support.wsdl.WsdlUtils[/tt:bx96k04y], method [tt:bx96k04y]getInputParts(BindingOperation operation)[/tt:bx96k04y]. This method should return parts that should be generated in the body of the sample SOAP request.

    The method returns all parts specified for the message if neither SOAP 1.1 nor SOAP 1.2 part could be found. This seems to be the case in my example. But I can't understand why. I think, a SOAP 1.1 part is correctly specified in the binding.
  • fml2the's avatar
    fml2the
    New Contributor
    I've found the reason. Everything is Ok in the SoapUI code. It was my fault. In the operation binding input, I specified the attribute "part", whereas it should read as "parts" (plural).