You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Ao...@meridianp2p.com on 2004/07/20 16:18:34 UTC
Adding element to header
Hi,
I'm having difficulty trying to get a SOAP message conform to what is
expected by a web service.
The WSDL is fairly complex but after running WSDL2Java I end up with the
required port type class and a Java class representing the data I need to
represent. This latter is class is actually a representation of an XML
string which the client reads in and then deserializes to the required
object using the deserializeFromInputStream and deserializeFromSOAPReader
methods provided by Yves and Michael last week. I then call my port
object passing in the Java object to be sent.
I have a client side handler that is used to digitally sign the message
conforming to the WS-Security spec before sending the message.
The produced SOAP message is pretty close to what I need but not quite
there, and the difficulty I believe is as follows. There is only a single
address for all web services available from this provider. The web
service to be used is determined an "Operation" header element in the SOAP
message with this element being defined in the WSDL file.
For example, there is a provider offering a nubmer of web services all of
which are available at
http://some.web.services/service
To access the "File" operation of the Form11 web service there needs to be
an Operation header in the SOAP message with a value of Form11/File.
That is, the expected SOAP message is expected to look something like:
<soapEnvelope....../>
<soap:Header>
<wsse:Security ....>
....
<ds:Signature .....>
.....
<ds:reference URI="#MsgOperation">
<ds:Transforms ..../>
.....
</ds:reference>
<ds:reference URI="#MsgBody">
same as for MsgOperation
</ds:reference>
.....
</ds:Signature>
<Operation xmlns="http://some.web.services/service/" id
="MsgOperation">Form11/File</Operation>
</soap:Header>
<soap:Body id="MsgBody">
....
</soap:Body>
</soap:Envelope>
The Operation element is not getting added for me. I'm not sure whether
the stub should be entering it for me or not. The client Java code looks
like:
ServicePortType port = // retreive port
_Form11 msgData = <read in XML string and deserialize>
_Acknowledgement ack = port.form11V3(form);
I'm not sure how/where in the client code to specify the fact that I want
to call the File operation of the Form11 service. If that was possible
would the stubs add in the Operation element for me in the soap header?
If not, then how would I do it? I tried by creating a new
SOAPHeaderElement in the client handler but that is the wrong format in
that attempts to put a namespace before the Operation and adds in actor
and mustUnderstand attributes which I don't want. I'm also not sure how
to retrieve its id. I can't jsut assume it will be "MsgOperation" as the
jar I am using the sign the message applies random strings to the two
locations where URIs are defined rather than MsgOperation or MsgBody.
I have included some of the WSDL at the end of this mail. APologies for
the length of this mail but I've only minimal experience with
Axis/SOAP/WSDL (about a weeks worth) and not much time to achieve what I
need to get done.
Thanks,
Aoife
The WSDL defining the operations is
<wsdl:import namespace="http://some.web.services/schemas/form11/v3/" location="form11/v3/schema.xsd"/>
<wsdl:types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.ros.ie/schemas/service/">
<xsd:import namespace="http://some.web.services/schemas/servicetypes/" schemaLocation="servicetypes/schema.xsd"/>
<xsd:element name="Operation">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="Form11/Calculate"/>
<xsd:enumeration value="Form11/File"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="ServiceFaultDetail" type="xsd:string"/>
</xsd:schema>
</wsdl:types>
The WSDL to produce the method call on the port type is
<wsdl:binding name="ServiceSoapBinding" type="ROSPortType">
<soapbind:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="Form11v3">
<soapbind:operation/>
<wsdl:input>
<soapbind:header message="soapHeader" part="operation" use="literal"/>
<soapbind:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soapbind:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>