Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I had to use :message_tag #520

Closed
eljojo opened this issue Nov 14, 2013 · 10 comments
Closed

I had to use :message_tag #520

eljojo opened this issue Nov 14, 2013 · 10 comments

Comments

@eljojo
Copy link

eljojo commented Nov 14, 2013

Hi,
I'm just sharing this in case it's useful.

I'm using savon 2.3.0 and I guess the gem had some problems identifying parameters automatically from my wsdl. I have no idea about SOAP and this is the first time I'm actually using it.

I'm dealing with TradeTracker's WSDL

With the following code I got it working:

client = Savon.client do
  wsdl "http://ws.tradetracker.com/soap/affiliate?wsdl"
  namespace_identifier :ns1
end

credentials = {
  customerID: 123123,
  passphrase: "123123123"
}

response = client.call(:authenticate, message_tag: :authenticate, message: credentials)

Without setting the message_tag I would get the following response: Procedure 'AuthenticateMessage' not present

D, [2013-11-14T11:07:04.550023 #44062] DEBUG -- : HTTPI GET request to ws.tradetracker.com (net_http)
I, [2013-11-14T11:07:04.661613 #44062]  INFO -- : SOAP request: https://ws.tradetracker.com/soap/affiliate
I, [2013-11-14T11:07:04.661687 #44062]  INFO -- : SOAPAction: "https://ws.tradetracker.com/soap/affiliate/authenticate", Content-Type: text/xml;charset=UTF-8, Content-Length: 458
D, [2013-11-14T11:07:04.661727 #44062] DEBUG -- : <?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="https://ws.tradetracker.com/soap/affiliate" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Body><tns:AuthenticateMessage><tns:customerID>12312312</tns:customerID><tns:passphrase>234234234</tns:passphrase></tns:AuthenticateMessage></env:Body></env:Envelope>
D, [2013-11-14T11:07:04.661834 #44062] DEBUG -- : HTTPI POST request to ws.tradetracker.com (net_http)
I, [2013-11-14T11:07:04.899945 #44062]  INFO -- : SOAP response (status 500)
D, [2013-11-14T11:07:04.900048 #44062] DEBUG -- : <?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Server</faultcode><faultstring>Procedure 'AuthenticateMessage' not present</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>

/Users/jojo/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/savon-2.3.0/lib/savon/response.rb:85:in `raise_soap_and_http_errors!': (SOAP-ENV:Server) Procedure 'AuthenticateMessage' not present (Savon::SOAPFault)

I'm just sharing this in case there is something that might be fixed. Thanks for rocking with your heavy metal.

@tjarratt
Copy link
Contributor

Thanks for using Savon @eljojo !

This seems like it might be a bug in Savon or maybe Nori, but it's hard to tell. Could you maybe explain how you came to find out that the message_tag option was required?

@paracycle
Copy link

Hi, I just upgraded from version 2.2.0 (which was working fine) to 2.3.0 and I ran into the same issue.

Unfortunately, the API is under an NDA so I can't post the full WSDL, but it seems something like:

   <portType name="Musteri_PORT">
      <operation name="MUSTERI_KAYDET">
         <documentation/>
         <input message="tns:MUSTERI_KAYDET_Request"/>
         <output message="tns:MUSTERI_KAYDET_Response"/>
      </operation>
   </portType>

in the WSDL makes Savon think it should send the message_tag as MUSTERI_KAYDET_Request. So the request that used to look like:

<env:Envelope xmlns:tns="http://localhost:8080/server/cms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
  <env:Header/>
  <env:Body>
    <tns:MUSTERI_KAYDET>
      .... Fields elided ...
    </tns:MUSTERI_KAYDET>
  </env:Body>
</env:Envelope>

now looks like this:

<env:Envelope xmlns:tns="http://localhost:8080/server/cms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
  <env:Header/>
  <env:Body>
    <tns:MUSTERI_KAYDET_Request>
      .... Fields elided ...
    </tns:MUSTERI_KAYDET_Request>
  </env:Body>
</env:Envelope>

If I have time, I'll try to do a git-bisect to see which commit has broken the functionality, and let you know.

@paracycle
Copy link

Just looked at the code and I believe it was savonrb/wasabi#15 that caused the issue. That patch adds output message parsing but also changes the returned tag name for input operations.

@lephyrius
Copy link

For me it looks like it appends a 4 in the end:

<env:Body><impl:showResultsWithMoreParametersRequest4>

And that's really weird.
So I get an error:

Savon::SOAPFault ((ns1:Client) No such operation 'showResultsWithMoreParametersRequest4'):

tjarratt added a commit that referenced this issue Dec 9, 2013
Fixes #520, #482, #529 and possibly some other issues.
tjarratt referenced this issue in savonrb/wasabi Dec 11, 2013
@paracycle was kind enough to track down these changes. I believe these changes
may be valid for Output, but almost certainly not for Input.

I had an opportunity to speak with @rubiii earlier about this and his thoughts
were that it wasn't very surprising that this change broke a lot of real code.
For one, it also changed specs. Secondly, there wasn't a real example of why this
would need to be like this in the PR. Lastly, the end result of the code is
overly complicated. I've just spent the last hour looking at the `input_output_for`
method in Wasabi::Parser just to find out that this was pulling in a completely
bogus request / response tag name in two thirds of the cases.

My hopes are that this fix will fix the regression in Savon 2.3.x and we can
stop worrying about this for Savon v3.
@jsaak
Copy link

jsaak commented Dec 16, 2013

there is something wrong with it:
using 2.3.2, i had to override :message_tag also, this time i was missing the Request at the end

@tjarratt
Copy link
Contributor

Hey @jsaak, I think what you're describing is fixed in savonrb/wasabi#39. Wasabi v2.3.3 was released today, and I think these issues are fixed now.

@eljojo could you confirm that this issue is fixed with Savon 2.3.2 and Wasabi 2.3.3?

sidenote: savon 2.3.2 has a dependency on wasabi >= 2.3.2, so updating Wasabi alone should resolve this.

@eljojo
Copy link
Author

eljojo commented Dec 17, 2013

The issue is fixed with Savon 2.3.2 and Wasabi 3.2.3 👌😉

@eljojo eljojo closed this as completed Dec 17, 2013
@davemitchell
Copy link

I'm experiencing this issue with Savon 2.4.0 / Wasabi 3.2.3.

Here's bit of the top level wsdl (it's broken down into many pieces):

 <wsdl:message name="writeCaseEformData">
      <wsdl:part element="flt:FLEformFields" name="WriteCaseEform"/>
 </wsdl:message>

  <wsdl:operation name="writeCaseEformData">
       <wsdl:input message="fls:writeCaseEformData"/>
   <wsdl:output message="fls:writeCaseEformDataResponse"/>
   <wsdl:fault message="fls:serviceException" name="serviceException"/>
   </wsdl:operation>

It should (and used to in earlier versions) produce output that looks like this:

<env:Body>
    <writeCaseEformData>
        <CaseEformInstance>
            <caseReference>101000741839</caseReference>
        <EformName>GEN01_GenericeFormforOtherServiceRequestTypes</EformName>
        </CaseEformInstance>
        <EformData>
            <EformFields>
                <fieldName>RequestDescription</fieldName>
                <fieldValue>Test</fieldValue>
            </EformFields>
        </EformData>
    </writeCaseEformData>
</env:Body>

But with the latest release (2.4) it now produces this, generating errors similar to those described above:

<env:Body>
    <flt:FLEformFields>
        <caseEformInstance>
            <caseReference>101000741839</caseReference>
        <eformName>GEN01_GenericeFormforOtherServiceRequestTypes</eformName>
        </caseEformInstance>
        <eformData>
            <eformFields>
                <fieldName>RequestDescription</fieldName>
                <fieldValue>Test</fieldValue>
            </eformFields>
        </eformData>
    </flt:FLEformFields>
</env:Body>

Note, as before, it's sending "flt:FLEformFields" as the tag instead of "writeCaseEformData".

@tjarratt
Copy link
Contributor

@davemitchell would you mind opening a new issue? If you can include your entire WSDL, or a small subset, or best -- a failing spec, I'd be more than happy to investigate and find a solution.

@kalemi19
Copy link

I'm having a similar issue parsing a WSDL with Savon 2.7.0 and Wasabi 3.3.1
I had to downgrade to the versions that used to work/still work Savon 2.2.0 and Wasabi 3.1.0.

Parsing the EchoSign's WSDL https://secure.echosign.com/redirect/latestApiWsdl returns different results between the two versions above, and I believe is the reason my Savon client call throws the error "(soap:Client) Invalid operation: {http://api.echosign}sendDocumentRequest". The WSDL is the change but the request that savon makes is different. Below is a part of the request:

Working, old version of Savon/Wasabi

<env:Envelope>
    <env:Body>
        <tns:sendDocument>
            <tns:documentCreationInfo>
                <ins0:fileInfos>
                    <ins0:fileInfo>
                        <ins0:fileName>file.pdf</ins0:fileName>
                    </ins0:fileInfo>
                </ins0:fileInfos>
            </tns:documentCreationInfo>
        </tns:sendDocument>
    </env:Body>
</env:Envelope>

Not working, latest version of Savon/Wasabi

<env:Envelope>
    <env:Body>
        <tns:sendDocumentRequest>
            <tns:documentCreationInfo>
                <tns:fileInfos>
                    <tns:fileInfo>
                        <tns:fileName>file.pdf</tns:fileName>
                    </tns:fileInfo>
                </tns:fileInfos>
            </tns:documentCreationInfo>
        </tns:sendDocumentRequest>
    </env:Body>
</env:Envelope>

As you can see there are tns instead of ins0 and the action in the NOT working request is sendDocumentRequest instead of sendDocument.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

7 participants