---------- Forwarded message ----------
From: Greg Adams <[EMAIL PROTECTED]>
Date: Nov 10, 2005 4:00 PM
Subject: WSDL SOAP headers
To: axis-user@ws.apache.org

I'm attempting to create a Java web service with Apache Axis 1.3. One of the requirements of this web service is that it must maintain conversational state. Following the advice of an article here:

 

http://www.oracle.com/technology/pub/articles/davydov_soa.html

 

I implemented a JAX-RPC "Handler" to intercept incoming requests to my web service for an expected SOAP header. The end result of this is that the WSDL generated by Axis doesn't contain any mention of the SOAP header, but if client requests don't contain the expected headers, my service throws a SOAP fault...

 

Following directions in Axis documentation, I was able to create a server-side handler to inspect requests for the headers and use them appropriately, and to create a client-side handler to inject the headers into the requests before they're sent to the web service, but I don't seem to be able to implement the same semantics in a .Net client.

 

Here's the WSDL for the Axis service I'm trying to call:

*******************************************************************************************************

<wsdl:definitions targetNamespace="urn:WidgetPrice">

-

            <!--

WSDL created by Apache Axis version: 1.3

Built on Oct 05, 2005 (05:23:37 EDT)

-->

-

            <wsdl:message name="setWidgetPriceRequest">

<wsdl:part name="name" type="soapenc:string"/>

<wsdl:part name="price" type="xsd:float"/>

</wsdl:message>

-

            <wsdl:message name="getWidgetPriceResponse">

<wsdl:part name="getWidgetPriceReturn" type="xsd:float"/>

</wsdl:message>

<wsdl:message name="setWidgetPriceResponse">

 

   </wsdl:message>

-

            <wsdl:message name="getWidgetPriceRequest">

<wsdl:part name="name" type="soapenc:string"/>

</wsdl:message>

-

            <wsdl:portType name="WidgetPriceIF">

-

            <wsdl:operation name="setWidgetPrice" parameterOrder="name price">

<wsdl:input message="impl:setWidgetPriceRequest" name="setWidgetPriceRequest"/>

<wsdl:output message="impl:setWidgetPriceResponse" name="setWidgetPriceResponse"/>

</wsdl:operation>

-

            <wsdl:operation name="getWidgetPrice" parameterOrder="name">

<wsdl:input message="impl:getWidgetPriceRequest" name="getWidgetPriceRequest"/>

<wsdl:output message="impl:getWidgetPriceResponse" name="getWidgetPriceResponse"/>

</wsdl:operation>

</wsdl:portType>

-

            <wsdl:binding name="WidgetPriceSoapBinding" type="impl:WidgetPriceIF">

<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>

-

            <wsdl:operation name="setWidgetPrice">

<wsdlsoap:operation soapAction=""/>

-

            <wsdl:input name="setWidgetPriceRequest">

<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://service" use="encoded"/>

</wsdl:input>

-

            <wsdl:output name="setWidgetPriceResponse">

<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:WidgetPrice" use="encoded"/>

</wsdl:output>

</wsdl:operation>

-

            <wsdl:operation name="getWidgetPrice">

<wsdlsoap:operation soapAction=""/>

-

            <wsdl:input name="getWidgetPriceRequest">

<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://service" use="encoded"/>

</wsdl:input>

-

            <wsdl:output name="getWidgetPriceResponse">

<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:WidgetPrice" use="encoded"/>

</wsdl:output>

</wsdl:operation>

</wsdl:binding>

-

            <wsdl:service name="WidgetPriceIFService">

-

            <wsdl:port binding="impl:WidgetPriceSoapBinding" name="WidgetPrice">

<wsdlsoap:address location="http://localhost:8080/WidgetPrice/services/WidgetPrice"/ >

</wsdl:port>

</wsdl:service>

</wsdl:definitions>

 

*******************************************************************************************************

Here's the SOAP conversation of the Java client using the Axis service:

*******************************************************************************************************

<!--  Request #1 -->

 

<?xml version="1.0" encoding="UTF-8"?>

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

            <soapenv:Header>

                        <StateIdentifier soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0">

                                    <UserContextID xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">1234567890</UserContextID>

                        </StateIdentifier>

            </soapenv:Header>

            <soapenv:Body>

                        <ns1:setWidgetPrice soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="urn:WidgetPrice">

                                    <ns1:arg0 xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">WidgetX</ns1:arg0>

                                    <ns1:arg1 href="" />

                        </ns1:setWidgetPrice>

                        <multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/ " xsi:type="soapenc:float" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">9.99</multiRef>

            </soapenv:Body>

</soapenv:Envelope>

 

<!--  Response #1 -->

 

<?xml version="1.0" encoding="utf-8"?>

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

            <soapenv:Header>

                        <StateIdentifier soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0">

                                    <UserContextID xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">1234567890</UserContextID>

                                    <ConvID xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">1131660103468</ConvID>

                        </StateIdentifier>

            </soapenv:Header>

            <soapenv:Body>

                        <ns1:setWidgetPriceResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="urn:WidgetPrice" />

            </soapenv:Body>

</soapenv:Envelope>

 

<!--  Request #2 -->

 

<?xml version="1.0" encoding="UTF-8"?>

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

            <soapenv:Header>

                        <StateIdentifier soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0">

                                    <UserContextID xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">1234567890</UserContextID>

                                    <ConvID xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">1131660103468</ConvID>

                        </StateIdentifier>

            </soapenv:Header>

            <soapenv:Body>

                        <ns1:getWidgetPrice soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="urn:WidgetPrice">

                                    <ns1:arg0 xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">WidgetX</ns1:arg0>

                        </ns1:getWidgetPrice>

            </soapenv:Body>

</soapenv:Envelope>

 

<!--  Response #2 -->

 

<?xml version="1.0" encoding="utf-8"?>

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

            <soapenv:Header>

                        <StateIdentifier soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0">

                                    <UserContextID xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">1234567890</UserContextID>

                                    <ConvID xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">1131660103562</ConvID>

                        </StateIdentifier>

            </soapenv:Header>

            <soapenv:Body>

                        <ns1:getWidgetPriceResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="urn:WidgetPrice">

                                    <getWidgetPriceReturn href="" />

                        </ns1:getWidgetPriceResponse>

                        <multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="xsd:float" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" >9.99</multiRef>

            </soapenv:Body>

</soapenv:Envelope>

*******************************************************************************************************

 

 

.Net wants to generate a dynamic proxy to call the webservice from the WSDL, and registering a handler to add the required headers when they are not declared in the WSDL has been ... difficult. Is there a way to get Axis to include information about the required headers in the generated WSDL that doesn't involve hand-coding WSDL for the thousands of web services that are eventually going to use this mechanism?

 

Thanks in advance for any help.

 

Greg Adams

 

 

Reply via email to