body in header when using unqualified "part" attribute in soap:header
---------------------------------------------------------------------
Key: AXIS-1794
URL: http://issues.apache.org/jira/browse/AXIS-1794
Project: Axis
Type: Bug
Components: Serialization/Deserialization
Versions: 1.2RC2
Environment: Linux 2.6
Reporter: Julien Wajsberg
This bug seems to be slightly related to Bug AXIS-1793.
With the following WSDL (nearly the same as in Bug AXIS-1793, except the
myMethod element; so I guess this service is not a wrapped document service
anymore.), I get the following SOAP message. The expected message (see below)
can be found using 'part="wsdl_target:parameters"' instead of
'part="parameters"' in the "soap:header" line.
I think of Bug AXIS-1793 because the cause and the solution are the same... But
not the consequences :)
WSDL :
----
<?xml version="1.0"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdl_target="http://localhost/myMethod" name="myMethod"
targetNamespace="http://localhost/myMethod">
<wsdl:types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://localhost/myMethod">
<xsd:element name="myMethod" type="xsd:string"/>
<xsd:element name="MyHeader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Username" type="xsd:string" maxOccurs="1"
minOccurs="1"/>
<xsd:element name="Password" type="xsd:string" maxOccurs="1"
minOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<wsdl:message name="MyMessage">
<wsdl:part name="parameters" element="wsdl_target:myMethod"/>
</wsdl:message>
<wsdl:message name="MyHeaderMessage">
<wsdl:part name="parameters" element="wsdl_target:MyHeader"/>
</wsdl:message>
<wsdl:portType name="MyPortType">
<wsdl:operation name="myMethod">
<wsdl:input message="wsdl_target:MyMessage"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="MyBinding" type="wsdl_target:MyPortType">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="myMethod">
<soap:operation style="document" soapAction=""/>
<wsdl:input>
<soap:body use="literal"/>
<soap:header use="literal" part="parameters"
message="wsdl_target:MyHeaderMessage"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="MyService">
<wsdl:port name="Service" binding="wsdl_target:MyBinding">
<soap:address location="http://whatever/web/service"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
----
Java Client :
----
package axis;
import java.io.IOException;
import java.net.URL;
import javax.xml.rpc.ServiceException;
import javax.xml.soap.SOAPException;
import localhost.myMethod.MyHeader;
import localhost.myMethod.MyPortType;
import localhost.myMethod.MyService;
import localhost.myMethod.MyServiceLocator;
import org.apache.axis.client.Stub;
public class TestcaseClient {
public static void main(String[] args) throws IOException,
ServiceException, SOAPException {
MyService service = new MyServiceLocator();
// send to a netcat listener
MyPortType client = service.getService(new
URL("http://localhost:8101"));
/* header */
Stub s = (Stub) client;
s.setHeader("", "MyHeader", new MyHeader("GRA", "GRA"));
/* body */
client.myMethod("G");
}
}
----
SOAP Message :
----
<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>
<MyHeader soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next"
soapenv:mustUnderstand="0">
<Username>GRA</Username>
<Password>GRA</Password>
</MyHeader>
<ns1:myMethod xmlns:ns1="http://localhost/myMethod">G</ns1:myMethod>
</soapenv:Header>
<soapenv:Body>
<myMethod xmlns=""/>
</soapenv:Body>
</soapenv:Envelope>
----
Expected SOAP Message :
----
<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>
<MyHeader soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next"
soapenv:mustUnderstand="0">
<Username>GRA</Username>
<Password>GRA</Password>
</MyHeader>
</soapenv:Header>
<soapenv:Body>
<myMethod xmlns="http://localhost/myMethod">G</myMethod>
</soapenv:Body>
</soapenv:Envelope>
----
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira