Amila:

Thanks for the tip. Truly, that was incorrect, but it was not the full extent of the problem.

The real problem arises from bad error reporting when a subelement is *missing*, not when an extra one is found.

I have attached pared-down, static versions of my WSDL, response, and Main program, as well as a Wireshark dump.

The error that occurs is:

Caused by: org.apache.axis2.databinding.ADBException: Unexpected subelement node

But the actual error is that a node should occur under every node. I would expect the error to instead say:

Caused by: org.apache.axis2.databinding.ADBException: Expected subelement node, but it is missing

Also, I would put a vote in for printing the QName, instead of the local name. Having nodes with the same local name makes debugging very hard.

Thanks!

-Jake

Amila Suriarachchi wrote:
your problem is with the response content type.

The request content type is
Content-Type: application/soap+xml

this means a payload is a soap12 message

But the response content type is

Content-Type: application/xml

this means a payload is an xml message and at the client side ADB gets the hole message as
payload. So it encounters and unexpected element called Body.

try to set the content type correctly to response.

thanks,
Amila.


On Tue, Jul 8, 2008 at 7:18 PM, Jake Goulding <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:

    Amila:

    Thank you for your response. I have attached the output of the
    transaction from Wireshark, hopefully it has the equivalent data
    that tcp mon would have. I have also attached the raw wireshark data.

    To be clear, I have narrowed down this case from a more complicated
    schema / soap interaction. I have reproduced it by creating a small
    WSDL that points to a static XML file that is a snippet of the data
    that is returned from my web service. These are the files that I
    attached in the first email.

    -Jake

    Amila Suriarachchi wrote:

        Can you look the request you send and the  response you received
        using the tcp mon. and send us?

        thanks,
        Amila.

        On Tue, Jul 8, 2008 at 2:07 AM, Jake Goulding
        <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
        <mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>>
        wrote:

           Apologies, but the XML should say:

           <tree xmlns="urn:/vivisimo/types"

           I attached an earlier version, before I cleaned up my namespaces.

           -Jake

           Jake Goulding wrote:

               Hey all:

               I am trying to figure out my other problems, and I ran
        into this:

               org.apache.axis2.AxisFault:
               org.apache.axis2.databinding.ADBException: Unexpected
        subelement
               Body
                      at
        org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
                      at vivisimo.ServiceStub.fromOM(ServiceStub.java:2346)
                      at vivisimo.ServiceStub.Simple(ServiceStub.java:194)
                      at Main.main(Main.java:24)
               Caused by: java.lang.Exception:
               org.apache.axis2.databinding.ADBException: Unexpected
        subelement
               Body
                      at
               vivisimo.ServiceStub$Tree$Factory.parse(ServiceStub.java:878)
                      at vivisimo.ServiceStub.fromOM(ServiceStub.java:2340)
                      ... 2 more
               Caused by: org.apache.axis2.databinding.ADBException:
        Unexpected
               subelement Body
                      at
               vivisimo.ServiceStub$Tree$Factory.parse(ServiceStub.java:864)
                      ... 3 more

               I have narrowed down my schema, WSDL, and java file to
        the attached.

               I have 2 nodes, <tree> and <node>. Tree has exactly one
        <node>
               child, and <node> can have 0-unbounded <node> children. I
        think
               the schema is correctly specifying this.

               However it looks like axis incorrectly exits out of the node,
               and then reports that the *containing* element is an
        "unexpected
               subelement".

               Boiled down, my example says:

               soap:body
                tree
                  node

               Any help on this would be great. Thanks!

               -Jake


------------------------------------------------------------------------

---------------------------------------------------------------------
               To unsubscribe, e-mail:
        [EMAIL PROTECTED]
        <mailto:[EMAIL PROTECTED]>
               <mailto:[EMAIL PROTECTED]
        <mailto:[EMAIL PROTECTED]>>

               For additional commands, e-mail:
        [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
               <mailto:[EMAIL PROTECTED]
        <mailto:[EMAIL PROTECTED]>>



---------------------------------------------------------------------
           To unsubscribe, e-mail: [EMAIL PROTECTED]
        <mailto:[EMAIL PROTECTED]>
           <mailto:[EMAIL PROTECTED]
        <mailto:[EMAIL PROTECTED]>>

           For additional commands, e-mail: [EMAIL PROTECTED]
        <mailto:[EMAIL PROTECTED]>
           <mailto:[EMAIL PROTECTED]
        <mailto:[EMAIL PROTECTED]>>




-- Amila Suriarachchi,
        WSO2 Inc.


    POST /soap/soap.xml HTTP/1.1
    Content-Type: application/soap+xml; charset=UTF-8; action="simple"
    User-Agent: Axis2
    Host: 127.0.0.1 <http://127.0.0.1>
    Content-Length: 251

    <?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope
    
xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope";><soapenv:Body><ns1:Simple
    xmlns:ns1="urn:/vivisimo/types"><ns1:query>hello
    world</ns1:query></ns1:Simple></soapenv:Body></soapenv:Envelope>HTTP/1.1
    200 OK
    Date: Tue, 08 Jul 2008 13:42:11 GMT
    Server: Apache
    Last-Modified: Mon, 07 Jul 2008 20:35:38 GMT
    ETag: "19ec2e0-1ac-4517504a83a80"
    Accept-Ranges: bytes
    Content-Length: 428
    Content-Type: application/xml

    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
                  xmlns:xsd="http://www.w3.org/2001/XMLSchema";
                  >
     <soap:Body>
       <tree xmlns="urn:/vivisimo/types">
         <node>
           <node>
             <description>Diary</description>
           </node>
         </node>
       </tree>
     </soap:Body>
    </soap:Envelope>
    ---------------------------------------------------------------------
    To unsubscribe, e-mail: [EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>
    For additional commands, e-mail: [EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>




--
Amila Suriarachchi,
WSO2 Inc.
import javax.xml.namespace.*;
import org.apache.axiom.om.*;
import org.apache.axis2.*;
import org.apache.axis2.transport.http.*;
import org.apache.axis2.databinding.types.*;
import vivisimo.*;

class Main {

    public static void main(String []args) throws Exception {

        try {

            ServiceStub q;
            q = new ServiceStub();
            q._getServiceClient().getOptions().setProperty(HTTPConstants.CHUNKED, false); 

            ServiceStub.Simple qs;
            qs = new ServiceStub.Simple();

            qs.setQuery("hello world");

            ServiceStub.Node qr;
            qr = q.Simple(qs);

        } catch (AxisFault af) {
            System.out.println("An error occurred: [" + af.getFaultCode() + "]");
            System.out.println(af.getDetail());
            af.printStackTrace();
        }
    }
}
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";
	       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
	       xmlns:xsd="http://www.w3.org/2001/XMLSchema";
	       >
  <soap:Body>
    <node xmlns="urn:/vivisimo/types" />
  </soap:Body>
</soap:Envelope>
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<definitions xmlns:tns="urn:/vivisimo"
	     xmlns:types="urn:/vivisimo/types"
	     xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
	     xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/";
	     xmlns="http://schemas.xmlsoap.org/wsdl/"; name="Simple"
	     targetNamespace="urn:/vivisimo"
	     >
  <types>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="urn:/vivisimo/types" elementFormDefault="qualified" targetNamespace="urn:/vivisimo/types" >

      <xs:element name="Simple">
	<xs:complexType>
	  <xs:sequence>
	    <xs:element minOccurs="0" maxOccurs="1" name="query" type="xs:string" />
	  </xs:sequence>
	</xs:complexType>
      </xs:element>

      <xs:element name="node">
	<xs:complexType>
	  <xs:sequence>
	    <xs:element minOccurs="1" maxOccurs="1" ref="node" />
	  </xs:sequence>
	</xs:complexType>
      </xs:element>
      
    </xs:schema>
  </types>

  <message name="Simple">
    <part name="parameters" element="types:Simple" />
  </message>
  <message name="SimpleResponse">
    <part name="monkey" element="types:node" />
  </message>

  <portType name="Port">
    <operation name="Simple">
      <input message="tns:Simple" />
      <output message="tns:SimpleResponse" />
    </operation>
  </portType>

  <binding name="Binding12" type="tns:Port" >
    <soap12:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"; />
    <operation name="Simple">
      <soap12:operation soapAction="simple" />
      <input>
	<soap12:body use="literal" />
      </input>
      <output>
	<soap12:body use="literal" />
      </output>
    </operation>
  </binding>

  <service name="Service">
    <documentation />
    <port name="Port12" binding="tns:Binding12" >
      <soap12:address location="http://192.168.0.20/soap/soap.soapxml"; />
    </port>
  </service>

</definitions>

Attachment: misleading-error.pcap
Description: Binary data

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

Reply via email to