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

Savon doesn't import namespaces correctly #469

Closed
dnjstrom opened this issue Jun 20, 2013 · 5 comments
Closed

Savon doesn't import namespaces correctly #469

dnjstrom opened this issue Jun 20, 2013 · 5 comments

Comments

@dnjstrom
Copy link

Savon doesn't seem to import the namespaces:

 http://www.playtech.com/Services/PTPaymentMethod
 http://www.playtech.com/Services/PTPaymentMethod/Redirect

correctly for the following wsdl:

<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<wsdl:definitions
  xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:tns="http://www.playtech.com/Services/PTPaymentMethodService"
  xmlns="http://www.playtech.com/Services/PTPaymentMethodService"
  xmlns:PM="http://www.playtech.com/Services/PTPaymentMethod"
  xmlns:PMRD="http://www.playtech.com/Services/PTPaymentMethod/Redirect"
  targetNamespace="http://www.playtech.com/Services/PTPaymentMethodService"
  name="PTPaymentMethodService">

  <wsdl:types>
    <schema xmlns="http://www.w3.org/2001/XMLSchema">
      <import namespace="http://www.playtech.com/Services/PTPaymentMethod" schemaLocation="PmApi.xsd" />
      <import namespace="http://www.playtech.com/Services/PTPaymentMethod/Redirect" schemaLocation="PmApiRedirect.xsd" />
    </schema>
  </wsdl:types>

  <!-- Redirect deposit messages -->
  <wsdl:message name="RedirectDepositHeaders">
    <wsdl:part name="header" element="PMRD:DepositHeaders" />
  </wsdl:message>
  <wsdl:message name="RedirectDepositFinalizationRequest">
    <wsdl:part name="request" element="PMRD:DepositFinalizationRequest" />
  </wsdl:message>
  <wsdl:message name="RedirectDepositFinalizationResponse">
    <wsdl:part name="request" element="PMRD:DepositFinalizationResponse" />
  </wsdl:message>

  <wsdl:message name="AccountCheckRequest">
    <wsdl:part name="request" element="PMRD:AccountCheckRequest" />
  </wsdl:message>
  <wsdl:message name="AccountCheckResponse">
    <wsdl:part name="request" element="PMRD:AccountCheckResponse" />
  </wsdl:message>

  <wsdl:portType name="PmApiPlaytechPortType">
    <wsdl:documentation>
      Port type for Playtech PmApi service implementation
    </wsdl:documentation>

    <wsdl:operation name="FinalizeRedirectDeposit">
      <wsdl:input message="tns:RedirectDepositFinalizationRequest" />
      <wsdl:output message="tns:RedirectDepositFinalizationResponse" />
    </wsdl:operation>

    <wsdl:operation name="CheckAccount">
      <wsdl:input message="tns:AccountCheckRequest" />
      <wsdl:output message="tns:AccountCheckResponse" />
    </wsdl:operation>
  </wsdl:portType>

  <wsdl:binding name="PmApiPlaytechServiceSOAPBinding" type="tns:PmApiPlaytechPortType">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>

    <wsdl:operation name="FinalizeRedirectDeposit">
      <wsdl:documentation>
        Finalizes a redirect deposit. 3rd party sends deposit status with any external info to Playtech payment service.
      </wsdl:documentation>
      <soap:operation soapAction="http://www.playtech.com/Services/PTPaymentMethodService/FinalizeRedirectDeposit" style="document" />
      <wsdl:input>
        <soap:body use="literal" />
        <soap:header use="literal" message="tns:RedirectDepositHeaders" part="header" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal" />
        <soap:header use="literal" message="tns:RedirectDepositHeaders" part="header" />
      </wsdl:output>
    </wsdl:operation>

    <wsdl:operation name="CheckAccount">
      <wsdl:documentation>
        Performs player account check in Playtech system.
      </wsdl:documentation>
      <soap:operation soapAction="http://www.playtech.com/Services/PTPaymentMethodService/CheckAccount" style="document" />
      <wsdl:input>
        <soap:body use="literal" />
        <soap:header use="literal" message="tns:RedirectDepositHeaders" part="header" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal" />
        <soap:header use="literal" message="tns:RedirectDepositHeaders" part="header" />
      </wsdl:output>

    </wsdl:operation>

  </wsdl:binding>

  <wsdl:service name="PmApiPlaytechService">
    <wsdl:port binding="tns:PmApiPlaytechServiceSOAPBinding" name="PmApiProcessorService">
      <soap:address location="https://cashier1.ums.playtech.com/payments/services/PmApiService.php" />
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

Instead I get the namespace:

xmlns:PMRD="http://www.playtech.com/Services/PTPaymentMethodService"

which isn't really used in the request.

An example request that I'm trying to create would be the following:

<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"
    xmlns:ns1="http://www.playtech.com/Services/PTPaymentMethod"
    xmlns:ns2="http://www.playtech.com/Services/PTPaymentMethod/Redirect">
    <env:Header>
        <ns2:DepositHeaders>
            <ns1:ApiVersion>1.0</ns1:ApiVersion>
            <ns2:SessionToken>D82FE08E2B0EFC31F825F773EFC60885</ns2:SessionToken>
        </ns2:DepositHeaders>
    </env:Header>
    <env:Body>
        <ns2:DepositFinalizationRequest>
            <ns1:TransactionId>2-MP-1652701</ns1:TransactionId>
            <ns1:ProcessorTransactionId>09892</ns1:ProcessorTransactionId>
            <ns1:Amount
                <ns1:Amount>1</ns1:Amount>
                <ns1:Currency>USD</ns1:Currency>
            </ns1:Amount>
            <ns1:ChargedAmount>
                <ns1:Amount>10</ns1:Amount>
                <ns1:Currency>EEK</ns1:Currency>
            </ns1:ChargedAmount>
            <ns1:Status>APPROVED</ns1:Status>
            <ns1:ExtraTransactionInfo>
                <ns1:Info1>
                    <ns1:Name>Bank</ns1:Name>
                    <ns1:Value>National Bank</ns1:Value>
                </ns1:Info1>
                <ns1:SubMethod>test</ns1:SubMethod>
            </ns1:ExtraTransactionInfo>
            <ns2:AccountInfo>
                <ns1:Field1>
                    <ns1:Value>12345</ns1:Value>
                </ns1:Field1>
            </ns2:AccountInfo>
        </ns2:DepositFinalizationRequest>
    </env:Body>
</env:Envelope>
@dnjstrom
Copy link
Author

For reference, this is an example of a request that is produced by Savon:

<?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:PMRD="http://www.playtech.com/Services/PTPaymentMethodService" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
    <env:Header>
        <PMRD:DepositHeaders>
            <PM:ApiVersion>1.0 </PM:ApiVersion>
            <PMRD:SessionToken>session_token </PMRD:SessionToken>
        </PMRD:DepositHeaders>
    </env:Header>
    <env:Body>
        <PMRD:DepositFinalizationRequest>
            <DepositFinalizationRequest>
                <TransactionId>nu1eb8xmmtjv93kjfnykyuc79sbb3998 </TransactionId>
                <ProcessorTransactionId>chg1wk3uldaviwwputmm004kmqs8u5dx </ProcessorTransactionId>
                <Amount>
                    <Amount>9708.0 </Amount>
                    <Currency>SEK </Currency>
                </Amount>
                <ChargedAmount>
                    <Amount>9708.0 </Amount>
                    <Currency>SEK</Currency>
                </ChargedAmount>
                <Status>PENDING</Status>
            </DepositFinalizationRequest>
        </PMRD:DepositFinalizationRequest>
    </env:Body>
</env:Envelope>

@dnjstrom dnjstrom reopened this Jun 20, 2013
@dnjstrom
Copy link
Author

Accidentally closed the issue...

@rubiii
Copy link
Contributor

rubiii commented Jun 29, 2013

sorry for the late response!

your wsdl defines some xml schema imports which savon 2.x does not follow. so it doesn't know about the types and their namespaces. and even if it would, this problem is related to a larger issues with the currently very simple wsdl parser.

this will eventually be solved by version 3, but you should still be able to create a request by tweaking the defaults savon uses to create the request via options.

if you followed the documentation and this is still an issue, please let me know.

@dnjstrom
Copy link
Author

dnjstrom commented Jul 3, 2013

I was indeed able to get it working by setting a number of options. I look forward to version3!

@dnjstrom dnjstrom closed this as completed Jul 3, 2013
@mohitpm
Copy link

mohitpm commented Apr 2, 2016

@dnjstrom
I am facing same issue, can you please share how did you get it working by setting options.

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

3 participants