savonrb / wasabi

A simple WSDL parser
MIT License
90 stars 84 forks source link

Wasabi chooses a wrong message part to generate soap input when there are multiple parts #40

Closed MaxMao closed 10 years ago

MaxMao commented 10 years ago

Here is the message element:

<message name="GET_Input_Msg">
  <part name="header" element="tns:SOAHeader"/>
  <part name="body" element="tns1:InputParameters"/>
</message>

Here is the operation in binding

<binding name="FND_PROFILE_Binding" type="tns:FND_PROFILE_PortType">
  <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
  <operation name="GET">
    <soap:operation soapAction="http://www.example.com:80/webservices/SOAProvider/plsql/fnd_profile/"/>
    <input>
      <soap:header message="tns:GET_Input_Msg" part="header" use="literal"/>
      <soap:body parts="body" use="literal"/>
    </input>
    <output>
      <soap:body use="literal"/>
    </output>
  </operation>

When generating soap input, i.e. calling Document#soap_input, the "header" part is used to genereat soap body, insteand of "body" part. As a result, when we use Savon::client to generate message_tag, a "tns:SOAHeader" element is used instead of "tns1:InputParameters". Since this element is generated deep down by Wasabi, we couldn't find a way to fix it on Savon level or our application code.

tjarratt commented 10 years ago

Thanks for filing the issue @MaxMao. I'm not too familiar with this part of SOAP, but it sounds like a real bug in Wasabi. I'd be more than happy to merge a pull request if you think you'd be up to writing some tests for this behavior in Wasabi.

FWIW, you can overwrite the actual xml that Savon sends, which isn't the best solution, but it will allow you to fix this issue in your application.

http://savonrb.com/version2/locals.html

client.call(:authenticate, xml: "<envelope><body></body></envelope>")
jmao commented 10 years ago

Hi @tjarratt I just created a pull request, https://github.com/savonrb/wasabi/pull/41. Would you please review my change and merge it if it looks ok?

tjarratt commented 10 years ago

Hey @jmao -- I'll try to take a look at this PR tomorrow.

tjarratt commented 10 years ago

Closing as fixed from PR #40.