You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Julien Wajsberg (JIRA)" <ax...@ws.apache.org> on 2005/01/28 16:57:22 UTC

[jira] Created: (AXIS-1794) body in header when using unqualified "part" attribute in soap:header

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


[jira] Commented: (AXIS-1794) body in header when using unqualified "part" attribute in soap:header

Posted by "Jason W (JIRA)" <ax...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS-1794?page=comments#action_12418645 ] 

Jason W commented on AXIS-1794:
-------------------------------

I am having the same issue as this. I was just wondering if anyone knew a way to force the call object into the actual body? It puts all the passed in information into the header instead of the body. I tried both 1.2.1 and 1.4 and the issue happens in both. I am sending the packet to an ARS server and using TCPMon to read the packet which is placing the information in the header instead of the body. It'd be nice if there was a fix to it which didn't require me having to edit the pre-made client files since I am trying to get away from customizing anything in those but if I have to add in a customization I will make a note for anyone else who will develop them after I am done my co-op term. Thanks.

> body in header when using unqualified "part" attribute in soap:header
> ---------------------------------------------------------------------
>
>          Key: AXIS-1794
>          URL: http://issues.apache.org/jira/browse/AXIS-1794
>      Project: Apache 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
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org