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

Sets the namespace using information from the operation and wsdl namespa... #277

Conversation

hoverlover
Copy link
Contributor

...ces.

These changes allow you to pass in only a symbol to the request method and get an automatic namespace mapping. This is best shown with an example:

<?xml version='1.0' encoding='UTF-8'?>
<wsdl:definitions 
    name="AuthenticationWebServiceImplService"
    targetNamespace="http://v1_0.ws.auth.order.example.com/"
    xmlns:ns1="http://cxf.apache.org/bindings/xformat"
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:tns="http://v1_0.ws.auth.order.example.com/"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema">

    <wsdl:types>
        <xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://v1_0.ws.auth.order.example.com/" xmlns:tns="http://v1_0.ws.auth.order.example.com/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
            ...
        </xs:schema>
    </wsdl:types>
    <wsdl:message name="authenticate">
        <wsdl:part element="tns:authenticate" name="parameters" />
    </wsdl:message>
    <wsdl:message name="authenticateResponse">
        <wsdl:part element="tns:authenticateResponse" name="parameters" />
    </wsdl:message>
    <wsdl:portType name="AuthenticationWebService">
        <wsdl:operation name="authenticate">
            <wsdl:input message="tns:authenticate" name="authenticate" />
            <wsdl:output message="tns:authenticateResponse" name="authenticateResponse" />
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="AuthenticationWebServiceImplServiceSoapBinding" type="tns:AuthenticationWebService">
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
        <wsdl:operation name="authenticate">
            <soap:operation soapAction="" style="document" />
            <wsdl:input name="authenticate">
                <soap:body use="literal" />
            </wsdl:input>
            <wsdl:output name="authenticateResponse">
                <soap:body use="literal" />
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="AuthenticationWebServiceImplService">
        <wsdl:port binding="tns:AuthenticationWebServiceImplServiceSoapBinding" name="AuthenticationWebServiceImplPort">
            <soap:address location="http://example.com/validation/1.0/AuthenticationService" />
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>
client.request :authenticate

This will result in the following soap message. Note the automatic namespace identifier on the authenticate element, as well as the proper namespace inclusion in the document:

<env:Envelope 
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:tns="http://v1_0.ws.auth.order.example.com/" 
    xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">

    <tns:authenticate>
        <tns:user>username</tns:user>
        <tns:password>password</tns:password>
    </tns:authenticate>
</env:Envelope>

This works hand in hand with a wasabi PR that I will be making shortly.

@rubiii
Copy link
Contributor

rubiii commented Jun 6, 2012

nice pull request 👍 thank you very much 😃

@hoverlover
Copy link
Contributor Author

You're welcome! Thanks for the great Savon library!

@rubiii
Copy link
Contributor

rubiii commented Jun 6, 2012

released as v0.9.11.

@rubiii rubiii closed this Jun 6, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants