[ http://issues.apache.org/jira/browse/AXIS2-763?page=all ]

Davanum Srinivas updated AXIS2-763:
-----------------------------------

    Description: 
I get the error below when I try to invoke the Echo web-service (see WSDL) 
using Axis2 with code generated by WSDL2Java.  

The invocation is successful and a valid reply is received.  However, the 
generated code, when parsing the reply, seems to expect an element that does 
not exist; namely EchoResponse.

Thanks.

============================================================================
<<<<<  The Error >>>>>>
java.lang.RuntimeException: java.lang.RuntimeException: Unexpected subelement 
return
        at 
com.xxx.axis2.SampleConnectorV2Stub.fromOM(SampleConnectorV2Stub.java:900)
        at 
com.xxx.axis2.SampleConnectorV2Stub.Echo(SampleConnectorV2Stub.java:141)
        at com.xxx.axis2.SampleTest.testEcho(SampleTest.java:40)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at junit.framework.TestCase.runTest(TestCase.java:154)
============================================================================
<<<<<  Message Sent  >>>>>>
1328 [main] DEBUG httpclient.wire.header  - >> "POST 
/Invoke?Handler=SampleConnectorV2 HTTP/1.1[\r][\n]"
1500 [main] DEBUG httpclient.wire.header  - >> "User-Agent: Axis/2.0[\r][\n]"
1500 [main] DEBUG httpclient.wire.header  - >> "SOAPAction: #Echo[\r][\n]"
1500 [main] DEBUG httpclient.wire.header  - >> "Host: 
xxx.xxx.xxx.xxx:pppp[\r][\n]"
1500 [main] DEBUG httpclient.wire.header  - >> "Content-Length: 270[\r][\n]"
1516 [main] DEBUG httpclient.wire.header  - >> "Content-Type: text/xml; 
charset=UTF-8[\r][\n]"
1516 [main] DEBUG httpclient.wire.header  - >> "[\r][\n]"
1516 [main] DEBUG httpclient.wire.content  - >> "<?xml version='1.0' 
encoding='UTF-8'?><soapenv:Envelope 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";><soapenv:Header 
/><soapenv:Body><ns1:Echo xmlns:ns1="urn:SampleConnector"><message>Hello 
World!</message></ns1:Echo></soapenv:Body></soapenv:Envelope>"

============================================================================
<<<<<  Reply Received  >>>>>>
1985 [main] DEBUG httpclient.wire.header  - << "HTTP/1.1 200 OK[\r][\n]"
2000 [main] DEBUG httpclient.wire.header  - << "Server: ATL Server - 
SoapTransport Sample HTTP Listener[\r][\n]"
2000 [main] DEBUG httpclient.wire.header  - << "Date: Mon, 22 May 2006 12:27:11 
GMT[\r][\n]"
2000 [main] DEBUG httpclient.wire.header  - << "Content-Type: text/xml[\r][\n]"
2000 [main] DEBUG httpclient.wire.header  - << "Content-Length: 417[\r][\n]"
2032 [main] DEBUG httpclient.wire.content  - << "<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"; 
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/";><soap:Body 
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";><snp:Echo 
xmlns:snp="urn:SampleConnector"><return>Hello 
World!</return></snp:Echo></soap:Body></soap:Envelope>"

============================================================================
<<<<<  WDSL  >>>>>>
<?xml version="1.0"?>
<definitions 
    xmlns:s="http://www.w3.org/2001/XMLSchema"; 
    xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"; 
    xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"; 
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"; 
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"; 
    xmlns:s0="urn:SampleConnector" 
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
    xmlns:atls="http://tempuri.org/vc/atl/server/";
    targetNamespace="urn:SampleConnector" 
    xmlns="http://schemas.xmlsoap.org/wsdl/";
>

    <message name="EchoIn">
        <part name="message" type="s:string"/>
    </message>
    <message name="EchoOut">
        <part name="return" type="s:string"/>
    </message>

    <portType name="SampleConnectorV2Soap">
        <operation name="Echo">
            <input message="s0:EchoIn"/>
            <output message="s0:EchoOut"/>
        </operation>
    </portType>

    <binding name="SampleConnectorV2Soap" type="s0:SampleConnectorV2Soap">
        <soap:binding transport="http://schemas.xmlsoap.org/soap/http"; 
style="rpc"/>
        <operation name="Echo">
            <soap:operation soapAction="#Echo" style="rpc"/>
            <input>
                <soap:body use="encoded" namespace="urn:SampleConnector" 
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </input>
            <output>
                <soap:body use="encoded" namespace="urn:SampleConnector" 
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </output>
        </operation>
    </binding>
    
    <service name="SampleConnectorV2">
        <port name="SampleConnectorV2Soap" binding="s0:SampleConnectorV2Soap">
            <soap:address 
location="http://xxx.xxx.xxx.xxx:pppp/Invoke?Handler=SampleConnectorV2"/>
        </port>
    </service>
    
</definitions>
============================================================================
<<<<<  Generated Code that Fails >>>>>>
public static EchoResponse parse(javax.xml.stream.XMLStreamReader reader) 
throws java.lang.Exception{
    EchoResponse object = new EchoResponse();
    int event;
    
    try {

        while (!reader.isStartElement() && !reader.isEndElement())
            reader.next();


        while (!reader.isStartElement() && !reader.isEndElement())
            reader.next();

        if (reader.isStartElement() && new 
javax.xml.namespace.QName("urn:SampleConnector","EchoResponse").equals(reader.getName())){
            object.setEchoResponse(EchoOut.Factory.parse(reader));


        }  // End of if for expected property start element
        else{
            // A start element we are not expecting indicates an invalid 
parameter was passed
--->>>>>>>> throw new java.lang.RuntimeException("Unexpected subelement " + 
reader.getLocalName());  <<<<<---- EXCEPTION THROWN HERE !!!!
        }



    } catch (javax.xml.stream.XMLStreamException e) {
        throw new java.lang.Exception(e);
    }

    return object;
}
============================================================================
<<<<< END OF DESCRIPTION >>>>>>


  was:

I get the error below when I try to invoke the Echo web-service (see WSDL) 
using Axis2 with code generated by WSDL2Java.  

The invocation is successful and a valid reply is received.  However, the 
generated code, when parsing the reply, seems to expect an element that does 
not exist; namely EchoResponse.

Thanks.

============================================================================
<<<<<  The Error >>>>>>
java.lang.RuntimeException: java.lang.RuntimeException: Unexpected subelement 
return
        at 
com.xxx.axis2.SampleConnectorV2Stub.fromOM(SampleConnectorV2Stub.java:900)
        at 
com.xxx.axis2.SampleConnectorV2Stub.Echo(SampleConnectorV2Stub.java:141)
        at com.xxx.axis2.SampleTest.testEcho(SampleTest.java:40)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at junit.framework.TestCase.runTest(TestCase.java:154)
============================================================================
<<<<<  Message Sent  >>>>>>
1328 [main] DEBUG httpclient.wire.header  - >> "POST 
/Invoke?Handler=SampleConnectorV2 HTTP/1.1[\r][\n]"
1500 [main] DEBUG httpclient.wire.header  - >> "User-Agent: Axis/2.0[\r][\n]"
1500 [main] DEBUG httpclient.wire.header  - >> "SOAPAction: #Echo[\r][\n]"
1500 [main] DEBUG httpclient.wire.header  - >> "Host: 
xxx.xxx.xxx.xxx:pppp[\r][\n]"
1500 [main] DEBUG httpclient.wire.header  - >> "Content-Length: 270[\r][\n]"
1516 [main] DEBUG httpclient.wire.header  - >> "Content-Type: text/xml; 
charset=UTF-8[\r][\n]"
1516 [main] DEBUG httpclient.wire.header  - >> "[\r][\n]"
1516 [main] DEBUG httpclient.wire.content  - >> "<?xml version='1.0' 
encoding='UTF-8'?><soapenv:Envelope 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";><soapenv:Header 
/><soapenv:Body><ns1:Echo xmlns:ns1="urn:SampleConnector"><message>Hello 
World!</message></ns1:Echo></soapenv:Body></soapenv:Envelope>"

============================================================================
<<<<<  Reply Received  >>>>>>
1985 [main] DEBUG httpclient.wire.header  - << "HTTP/1.1 200 OK[\r][\n]"
2000 [main] DEBUG httpclient.wire.header  - << "Server: ATL Server - 
SoapTransport Sample HTTP Listener[\r][\n]"
2000 [main] DEBUG httpclient.wire.header  - << "Date: Mon, 22 May 2006 12:27:11 
GMT[\r][\n]"
2000 [main] DEBUG httpclient.wire.header  - << "Content-Type: text/xml[\r][\n]"
2000 [main] DEBUG httpclient.wire.header  - << "Content-Length: 417[\r][\n]"
2032 [main] DEBUG httpclient.wire.content  - << "<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"; 
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/";><soap:Body 
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";><snp:Echo 
xmlns:snp="urn:SampleConnector"><return>Hello 
World!</return></snp:Echo></soap:Body></soap:Envelope>"

============================================================================
<<<<<  WDSL  >>>>>>
<?xml version="1.0"?>
<definitions 
    xmlns:s="http://www.w3.org/2001/XMLSchema"; 
    xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"; 
    xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"; 
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"; 
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"; 
    xmlns:s0="urn:SampleConnector" 
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
    xmlns:atls="http://tempuri.org/vc/atl/server/";
    targetNamespace="urn:SampleConnector" 
    xmlns="http://schemas.xmlsoap.org/wsdl/";
>

    <message name="EchoIn">
        <part name="message" type="s:string"/>
    </message>
    <message name="EchoOut">
        <part name="return" type="s:string"/>
    </message>

    <portType name="SampleConnectorV2Soap">
        <operation name="Echo">
            <input message="s0:EchoIn"/>
            <output message="s0:EchoOut"/>
        </operation>
    </portType>

    <binding name="SampleConnectorV2Soap" type="s0:SampleConnectorV2Soap">
        <soap:binding transport="http://schemas.xmlsoap.org/soap/http"; 
style="rpc"/>
        <operation name="Echo">
            <soap:operation soapAction="#Echo" style="rpc"/>
            <input>
                <soap:body use="encoded" namespace="urn:SampleConnector" 
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </input>
            <output>
                <soap:body use="encoded" namespace="urn:SampleConnector" 
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </output>
        </operation>
    </binding>
    
    <service name="SampleConnectorV2">
        <port name="SampleConnectorV2Soap" binding="s0:SampleConnectorV2Soap">
            <soap:address 
location="http://xxx.xxx.xxx.xxx:pppp/Invoke?Handler=SampleConnectorV2"/>
        </port>
    </service>
    
</definitions>
============================================================================
<<<<<  Generated Code that Fails >>>>>>
public static EchoResponse parse(javax.xml.stream.XMLStreamReader reader) 
throws java.lang.Exception{
    EchoResponse object = new EchoResponse();
    int event;
    
    try {

        while (!reader.isStartElement() && !reader.isEndElement())
            reader.next();


        while (!reader.isStartElement() && !reader.isEndElement())
            reader.next();

        if (reader.isStartElement() && new 
javax.xml.namespace.QName("urn:SampleConnector","EchoResponse").equals(reader.getName())){
            object.setEchoResponse(EchoOut.Factory.parse(reader));


        }  // End of if for expected property start element
        else{
            // A start element we are not expecting indicates an invalid 
parameter was passed
--->>>>>>>> throw new java.lang.RuntimeException("Unexpected subelement " + 
reader.getLocalName());  <<<<<---- EXCEPTION THROWN HERE !!!!
        }



    } catch (javax.xml.stream.XMLStreamException e) {
        throw new java.lang.Exception(e);
    }

    return object;
}
============================================================================
<<<<< END OF DESCRIPTION >>>>>>



Marking this as a blocker. We *Need* to inform the user that we don't support 
rpc/encoded during codegen.

thanks,
dims

> Code generated by WSDL2 Java expects a return element that does not exist in 
> the WSDL nor in the return message.
> ----------------------------------------------------------------------------------------------------------------
>
>                 Key: AXIS2-763
>                 URL: http://issues.apache.org/jira/browse/AXIS2-763
>             Project: Apache Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: wsdl
>    Affects Versions: 1.0
>         Environment: Affects version "Apache Axis2 1.0 build (May 5, 2006)"
>            Reporter: Sid Remey
>            Priority: Critical
>
> I get the error below when I try to invoke the Echo web-service (see WSDL) 
> using Axis2 with code generated by WSDL2Java.  
> The invocation is successful and a valid reply is received.  However, the 
> generated code, when parsing the reply, seems to expect an element that does 
> not exist; namely EchoResponse.
> Thanks.
> ============================================================================
> <<<<<  The Error >>>>>>
> java.lang.RuntimeException: java.lang.RuntimeException: Unexpected subelement 
> return
>       at 
> com.xxx.axis2.SampleConnectorV2Stub.fromOM(SampleConnectorV2Stub.java:900)
>       at 
> com.xxx.axis2.SampleConnectorV2Stub.Echo(SampleConnectorV2Stub.java:141)
>       at com.xxx.axis2.SampleTest.testEcho(SampleTest.java:40)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>       at java.lang.reflect.Method.invoke(Unknown Source)
>       at junit.framework.TestCase.runTest(TestCase.java:154)
> ============================================================================
> <<<<<  Message Sent  >>>>>>
> 1328 [main] DEBUG httpclient.wire.header  - >> "POST 
> /Invoke?Handler=SampleConnectorV2 HTTP/1.1[\r][\n]"
> 1500 [main] DEBUG httpclient.wire.header  - >> "User-Agent: Axis/2.0[\r][\n]"
> 1500 [main] DEBUG httpclient.wire.header  - >> "SOAPAction: #Echo[\r][\n]"
> 1500 [main] DEBUG httpclient.wire.header  - >> "Host: 
> xxx.xxx.xxx.xxx:pppp[\r][\n]"
> 1500 [main] DEBUG httpclient.wire.header  - >> "Content-Length: 270[\r][\n]"
> 1516 [main] DEBUG httpclient.wire.header  - >> "Content-Type: text/xml; 
> charset=UTF-8[\r][\n]"
> 1516 [main] DEBUG httpclient.wire.header  - >> "[\r][\n]"
> 1516 [main] DEBUG httpclient.wire.content  - >> "<?xml version='1.0' 
> encoding='UTF-8'?><soapenv:Envelope 
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";><soapenv:Header 
> /><soapenv:Body><ns1:Echo xmlns:ns1="urn:SampleConnector"><message>Hello 
> World!</message></ns1:Echo></soapenv:Body></soapenv:Envelope>"
> ============================================================================
> <<<<<  Reply Received  >>>>>>
> 1985 [main] DEBUG httpclient.wire.header  - << "HTTP/1.1 200 OK[\r][\n]"
> 2000 [main] DEBUG httpclient.wire.header  - << "Server: ATL Server - 
> SoapTransport Sample HTTP Listener[\r][\n]"
> 2000 [main] DEBUG httpclient.wire.header  - << "Date: Mon, 22 May 2006 
> 12:27:11 GMT[\r][\n]"
> 2000 [main] DEBUG httpclient.wire.header  - << "Content-Type: 
> text/xml[\r][\n]"
> 2000 [main] DEBUG httpclient.wire.header  - << "Content-Length: 417[\r][\n]"
> 2032 [main] DEBUG httpclient.wire.content  - << "<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"; 
> xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/";><soap:Body 
> soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";><snp:Echo 
> xmlns:snp="urn:SampleConnector"><return>Hello 
> World!</return></snp:Echo></soap:Body></soap:Envelope>"
> ============================================================================
> <<<<<  WDSL  >>>>>>
> <?xml version="1.0"?>
> <definitions 
>     xmlns:s="http://www.w3.org/2001/XMLSchema"; 
>     xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"; 
>     xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"; 
>     xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"; 
>     xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"; 
>     xmlns:s0="urn:SampleConnector" 
>     xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
>     xmlns:atls="http://tempuri.org/vc/atl/server/";
>     targetNamespace="urn:SampleConnector" 
>     xmlns="http://schemas.xmlsoap.org/wsdl/";
> >
>     <message name="EchoIn">
>         <part name="message" type="s:string"/>
>     </message>
>     <message name="EchoOut">
>         <part name="return" type="s:string"/>
>     </message>
>     <portType name="SampleConnectorV2Soap">
>         <operation name="Echo">
>             <input message="s0:EchoIn"/>
>             <output message="s0:EchoOut"/>
>         </operation>
>     </portType>
>     <binding name="SampleConnectorV2Soap" type="s0:SampleConnectorV2Soap">
>         <soap:binding transport="http://schemas.xmlsoap.org/soap/http"; 
> style="rpc"/>
>         <operation name="Echo">
>             <soap:operation soapAction="#Echo" style="rpc"/>
>             <input>
>                 <soap:body use="encoded" namespace="urn:SampleConnector" 
> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
>             </input>
>             <output>
>                 <soap:body use="encoded" namespace="urn:SampleConnector" 
> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
>             </output>
>         </operation>
>     </binding>
>     
>     <service name="SampleConnectorV2">
>         <port name="SampleConnectorV2Soap" binding="s0:SampleConnectorV2Soap">
>             <soap:address 
> location="http://xxx.xxx.xxx.xxx:pppp/Invoke?Handler=SampleConnectorV2"/>
>         </port>
>     </service>
>     
> </definitions>
> ============================================================================
> <<<<<  Generated Code that Fails >>>>>>
> public static EchoResponse parse(javax.xml.stream.XMLStreamReader reader) 
> throws java.lang.Exception{
>     EchoResponse object = new EchoResponse();
>     int event;
>     
>     try {
>         while (!reader.isStartElement() && !reader.isEndElement())
>             reader.next();
>         while (!reader.isStartElement() && !reader.isEndElement())
>             reader.next();
>         if (reader.isStartElement() && new 
> javax.xml.namespace.QName("urn:SampleConnector","EchoResponse").equals(reader.getName())){
>             object.setEchoResponse(EchoOut.Factory.parse(reader));
>         }  // End of if for expected property start element
>         else{
>             // A start element we are not expecting indicates an invalid 
> parameter was passed
> --->>>>>>>> throw new java.lang.RuntimeException("Unexpected subelement " + 
> reader.getLocalName());  <<<<<---- EXCEPTION THROWN HERE !!!!
>         }
>     } catch (javax.xml.stream.XMLStreamException e) {
>         throw new java.lang.Exception(e);
>     }
>     return object;
> }
> ============================================================================
> <<<<< END OF DESCRIPTION >>>>>>

-- 
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to