Hi,
Haven't gone through the messages in detail but I can tell you why this
occurs (its not due to headers)
This happens when the xml instance is not compliant with the schema, most
probably elements out of sequence.
It can be that there is a mismatch in the namespaces also .

Ajith

On Fri, May 23, 2008 at 10:29 AM, Carsten Sierks <[EMAIL PROTECTED]> wrote:

> Hi all,
>
> I just try to get a JavaScript-Client (run from the Browser, based on
> http://riait.co.uk/2008/05/19/calling-web-services-from-javascript/) to
> connect to an Axis2 deployed WebService. The connection works fine, but I
> always get the error:
>
> org.apache.axis2.databinding.ADBException: Unexpected subelement
>
> A friend of mine, uses a client generated also with Axis2 and Java does not
> get that error. So we tried to get the messages to be the same.
>
> First the relevant part of the wsdl file (I have copied it from the
> browser, and shortened it, hopefully without mistake. It has been
> automatically created):
>
> <WSDL>
> <wsdl:definitions targetNamespace="http://test.project.com";>
> -
>        <wsdl:types>
> -
>        <xs:schema attributeFormDefault="qualified"
> elementFormDefault="qualified" targetNamespace="http://test.project.com";>
> <xs:import namespace="http://util.test.project.com"/>
> -
>        <xs:element name="identify">
> -
>        <xs:complexType>
> -
>        <xs:sequence>
> <xs:element minOccurs="0" name="username" nillable="true"
> type="xs:string"/>
> <xs:element minOccurs="0" name="password" nillable="true"
> type="xs:string"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> -
>        <xs:element name="identifyResponse">
> -
>        <xs:complexType>
> -
>        <xs:sequence>
> <xs:element minOccurs="0" name="sessionID" nillable="true"
> type="xs:string"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> -
> </xs:schema>
> -
> </wsdl:types>
> -
>        <wsdl:message name="identifyRequest">
> <wsdl:part name="parameters" element="ns:identify">
>    </wsdl:part>
> </wsdl:message>
> -
>        <wsdl:message name="identifyResponse">
> <wsdl:part name="parameters" element="ns:identifyResponse">
>    </wsdl:part>
> </wsdl:message>
> -
>        <wsdl:portType name="testPortType">
> -
>        <wsdl:operation name="identify">
> <wsdl:input message="ns:identifyRequest" wsaw:Action="urn:identify">
>    </wsdl:input>
> <wsdl:output message="ns:identifyResponse"
> wsaw:Action="urn:identifyResponse">
>    </wsdl:output>
> </wsdl:operation>
> </wsdl:portType>
> -
>        <wsdl:binding name="testSoap12Binding" type="ns:testPortType">
> <soap12:binding style="document" transport="
> http://schemas.xmlsoap.org/soap/http"/>
> -
>        <wsdl:operation name="identify">
> <soap12:operation soapAction="urn:identify" style="document"/>
> -
>        <wsdl:input>
> <soap12:body use="literal"/>
> </wsdl:input>
> -
>        <wsdl:output>
> <soap12:body use="literal"/>
> </wsdl:output>
> </wsdl:operation>
> </wsdl:binding>
> -
>        <wsdl:binding name="testSoap11Binding" type="ns:testPortType">
> <soap:binding style="document" transport="
> http://schemas.xmlsoap.org/soap/http"/>
> -
>        <wsdl:operation name="identify">
> <soap:operation soapAction="urn:identify" style="document"/>
> -
>        <wsdl:input>
> <soap:body use="literal"/>
> </wsdl:input>
> -
>        <wsdl:output>
> <soap:body use="literal"/>
> </wsdl:output>
> </wsdl:operation>
> </wsdl:binding>
> -
>        <wsdl:binding name="testHttpBinding" type="ns:testPortType">
> <http:binding verb="POST"/>
> -
>        <wsdl:operation name="identify">
> <http:operation location="test/identify"/>
> -
>        <wsdl:input>
> <mime:content part="identify" type="text/xml"/>
> </wsdl:input>
> -
>        <wsdl:output>
> <mime:content part="identify" type="text/xml"/>
> </wsdl:output>
> </wsdl:operation>
> </wsdl:binding>
> -
> <wsdl:service name="test">
> -
>        <wsdl:port name="testHttpSoap12Endpoint"
> binding="ns:testSoap12Binding">
> <soap12:address location="http://172.25.16.25:8080/axis2/services/test"/>
> </wsdl:port>
> -
>        <wsdl:port name="testHttpSoap11Endpoint"
> binding="ns:testSoap11Binding">
> <soap:address location="http://172.25.16.25:8080/axis2/services/test"/>
> </wsdl:port>
> -
>        <wsdl:port name="testHttpEndpoint" binding="ns:testHttpBinding">
> <http:address location="http://172.25.16.25:8080/axis2/services/test"/>
> </wsdl:port>
> </wsdl:service>
> </wsdl:definitions>
> </WSDL>
>
> First I tried to approach the WebService using Soap 1.1 (
> http://schemas.xmlsoap.org/soap/envelope) after having made the message
> similar to the one of my friend. This is the TCP/IP talk between my browser
> and the WebService (incorrect Content-Length due to changeing
> username/password):
>
> <TCPIP_SOAP11_REQUEST>
> POST /axis2/services/Test HTTP/1.1
> Accept: */*
> Accept-Language: de
> Referer: http://172.25.16.25:8080/axis2/axis2-web/testpage/riait_test.html
> soapaction: urn:identify
> Content-Type: text/xml; charset=utf-8
> UA-CPU: x86
> Accept-Encoding: gzip, deflate
> User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR
> 1.1.4322; .NET CLR 2.0.50727)
> Host: 172.25.16.25:8080
> Content-Length: 339
> Connection: Keep-Alive
> Cache-Control: no-cache
>
>
> <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="
> http://schemas.xmlsoap.org/soap/envelope/";>  <soapenv:Body>
>  <ns:identify xmlns:ns="http://test.project.com/";>
>  <ns:username>username</ns:username>
>  <ns:password>password</ns:password>    </ns:identify>
>  </soapenv:Body></soapenv:Envelope>
> </TCPIP_SOAP11_REQUEST>
>
> The response was:
> <TCPIP_SOAP11_RESPONSE>
> HTTP/1.1 500 Internal Server Error
> Content-Type: text/xml;charset=utf-8
> Transfer-Encoding: chunked
> Date: Fri, 23 May 2008 13:10:44 GMT
> Server: Apache-Coyote/1.1
> Connection: close
>
> 154
> <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="
> http://schemas.xmlsoap.org/soap/envelope/";><soapenv:Body><soapenv:Fault><faultcode>soapenv:Server</faultcode><faultstring>org.apache.axis2.databinding.ADBException:
> Unexpected subelement username</faultstring><detail
> /></soapenv:Fault></soapenv:Body></soapenv:Envelope>
> 0
> </TCPIP_SOAP11_RESPONSE>
>
> The only difference between his message and mine was the Soap version, he
> is using Soap 1.2. So I tried to change the headers accordingly.
> <TCPIP_SOAP12_REQUEST>
> POST /axis2/services/Test HTTP/1.1
> Accept: */*
> Accept-Language: de
> Referer: http://172.25.16.25:8080/axis2/axis2-web/testpage/riait_test.html
> Content-Type: application/soap+xml; charset=utf-8;action="urn:identify"
> UA-CPU: x86
> Accept-Encoding: gzip, deflate
> User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR
> 1.1.4322; .NET CLR 2.0.50727)
> Host: 172.25.16.25:8080
> Content-Length: 337
> Connection: Keep-Alive
> Cache-Control: no-cache
>
> <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="
> http://www.w3.org/2003/05/soap-envelope";>  <soapenv:Body>    <ns:identify
> xmlns:ns="http://test.project.com/";>
>  <ns:username>username</ns:username>
>  <ns:password>password</ns:password>    </ns:identify>
>  </soapenv:Body></soapenv:Envelope>
> </TCPIP_SOAP12_REQUEST>
>
> With response:
> <TCPIP_SOAP12_RESPONSE>
> HTTP/1.1 500 Internal Server Error
> Content-Type: application/soap+xml; action="
> http://www.w3.org/2005/08/addressing/soap/fault";charset=utf-8
> Transfer-Encoding: chunked
> Date: Fri, 23 May 2008 13:22:12 GMT
> Server: Apache-Coyote/1.1
> Connection: close
>
> 1b5
> <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="
> http://www.w3.org/2003/05/soap-envelope";><soapenv:Body><soapenv:Fault><soapenv:Code><soapenv:Value>soapenv:Receiver</soapenv:Value></soapenv:Code><soapenv:Reason><soapenv:Text
> xml:lang="en-US">org.apache.axis2.databinding.ADBException: Unexpected
> subelement username</soapenv:Text></soapenv:Reason><soapenv:Detail
> /></soapenv:Fault></soapenv:Body></soapenv:Envelope>
> 0
> </TCPIP_SOAP12_RESPONSE>
>
> Furthermore the Soap1.2 has the effect, that the XMLHTTPRequest does not
> become aware of the finishing of the transmission (if I do not mistake, the
> Soap1.1 response has a trailing empty line, missing with the Soap1.2
> response).
>
> Before I forget, this is the working request:
> <WORKING_REQUEST>
> POST /axis2/services/Test HTTP/1.1
> Content-Type: application/soap+xml; charset=UTF-8; action="urn:getObject"
> User-Agent: Axis2
> Host: 172.25.16.25:8090
> Transfer-Encoding: chunked
>
> <?xml version='1.0' encoding='utf-8'?>
> <soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope";>
> <soapenv:Body>
> <ns2:identify xmlns:ns2="http://test.project.com";>
> <ns2:username>username</ns2:username>
> <ns2:password>password</ns2:password>
> </ns2:identify>
> </soapenv:Body>
> </soapenv:Envelope>
> </WORKING_REQUEST>
>
> Perhaps anyone has any idea. My only guess up to now is, that the extra
> HTTP-Headers confuse the Axis2 message parser.
>
>
> Carsten
> --
> Super-Acktion nur in der GMX Spieleflat: 10 Tage für 1 Euro.
> Über 180 Spiele downloaden und spiele: http://flat.games.gmx.de
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
Ajith Ranabahu

Reading, after a certain age, diverts the mind too much from its creative
pursuits. Any man who reads too much and uses his own brain too little falls
into lazy habits of thinking - Albert Einstein

Reply via email to