Hi,

I am currently evaluating different WS technologies to be used in a
client side Java environment.

The deal is, that we have a number of WSDL docs and they refer several
XSD schemas for describing service input/output and data types etc.

My problem is, that somehow I can't get AXIS2 to generate the correct
SOAP header block according to our WSDL and XSD definitions.

Example:

A WSDL document defines the binding:
        <wsdl:binding name="HelloWorldServiceSOAP"
type="tns:HelloWorldService">
                <soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
                <wsdl:operation name="FindHelloWorld">
                        <soap:operation soapAction=""/>
                        <wsdl:input>
                                <soap:body use="literal"/>
                                <soap:header
message="common:MetadataMessage" part="metadata" use="literal"/>
                        </wsdl:input>
                        <wsdl:output>
                                <soap:body use="literal"/>
                        </wsdl:output>
                        <wsdl:fault name="Error">
                                <soap:fault name="Error" use="literal"/>
                        </wsdl:fault>
                </wsdl:operation>
        </wsdl:binding>

The thing to note is the <soap:header message="common:MetadataMessage"
part="metadata" use="literal"/> part.

The Common.wsdl is imported in the above WSDL and is defined as:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
xmlns:tns="http://common.ntpsoa.nordea.com/common/wsdl/v1";
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:md="http://metadata.ntpsoa.nordea.com/object";
xmlns:err="http://error.ntpsoa.nordea.com/object/v1"; name="CommonWSDL"
targetNamespace="http://common.ntpsoa.nordea.com/common/wsdl/v1";>
        <wsdl:types>
                <xsd:schema>
                        <xsd:import
namespace="http://metadata.ntpsoa.nordea.com/object";
schemaLocation="../xsd/Metadata.xsd"/>
                        <xsd:import
namespace="http://error.ntpsoa.nordea.com/object/v1";
schemaLocation="../xsd/Error.xsd"/>
                </xsd:schema>
        </wsdl:types>
        <wsdl:message name="MetadataMessage">
                <wsdl:part name="metadata" element="md:metadata"/>
        </wsdl:message>
        <wsdl:message name="ErrorMessage">
                <wsdl:part name="error" element="err:error"/>
        </wsdl:message>
</wsdl:definitions>

In the Metadata.xsd the following part is defined:
<xs:attribute name="schemaVersion" type="xs:string"
use="required"></xs:attribute>


I have run the WSDL file through the wsdl2java to generate the client
stub.
I have tried with ADT and XMLBeans as binding mechanism, both give the
same result: In both cases I get an Java class representing the
Metadata. In both cases I am able to set the Java attributes for the
elements and attributes of the underlying XML document, including the
"schemaVersion".

Using XMLBeans I have tried to dump the headerblock generated by
XMLBeans. The result is:
<obj:metadata schemaVersion="1.0"
xmlns:obj="http://metadata.ntpsoa.nordea.com/object";>
  <obj:userId>N231820</obj:userId>
  <obj:requestDomain>SE</obj:requestDomain>
  <obj:sessionId>String</obj:sessionId>
  <obj:applicationId>String</obj:applicationId>
 
<obj:messageTimeStamp>2007-10-22T15:29:55.625+02:00</obj:messageTimeStam
p>
  <obj:authMethod>String</obj:authMethod>
  <obj:test>false</obj:test>
</obj:metadata>

Note, that "schemaVersion" is set correctly at this point.

But in both cases, the actual SOAP message looks like:

<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";>
        <soapenv:Header>
                <metadata
xmlns="http://metadata.ntpsoa.nordea.com/object";
soapenv:mustUnderstand="0">
                        <userId>N231820</userId>
                        <requestDomain>SE</requestDomain>
                        <sessionId>String</sessionId>
                        <applicationId>String</applicationId>
        
<messageTimeStamp>2007-10-22T15:29:55.625+02:00</messageTimeStamp>
                        <authMethod>String</authMethod>
                        <test>false</test>
                </metadata>
        </soapenv:Header>
        <soapenv:Body>
                <FindHelloWorldRequest
xmlns="http://helloworld.ntpref.nordea.com/object/v1";>
                        <HelloWorldType>
                                <Hello>Mjallo</Hello>
                        </HelloWorldType>
                </FindHelloWorldRequest>
        </soapenv:Body>
</soapenv:Envelope>

It seems like the stub overwrites the generated SOAP header block.
The elements of the XML document are correct, but the attribute
"schemaVersion" has been removed and instead the meteadata element
receives the mustUnderstand attribute.

What goes wrong here...?

Regards
Morten



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to