Hi there,

since I am still very fresh to the area of webservices, I'm not sure, if
my problem is related to a bug in the code gerneration of Axis2 or if I
made an error.

I try to write a simple webservie that adds two integers and gives back
the sum. After writing the WSDL file and and generating code with
WSDL2Java, I notice errors in the code. I tried both Axis2 1.0 and the nightly build of today. In 1.0 I get an error about newXMLStreamReader() as described in http://issues.apache.org/jira/browse/AXIS2-760?page=all and in the nightly I get totally funny code like this:
wrappedParam =
()fromOM(
msgContext.getEnvelope().getBody().getFirstElement(),
.class,
getEnvelopeNamespaces(msgContext.getEnvelope()));

I'd appriciate an explaination and a workaround very much.

I used the following WSDL file:

<?xml version="1.0"?>
<definitions name="mathWS"

targetNamespace="http://chris.math.ut.ee/plus.wsdl";
          xmlns:tns="http://chris.math.ut.ee/plus.wsdl";
          xmlns:xsd1="http://chris.math.ut.ee/plus.xsd";
          xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
          xmlns="http://schemas.xmlsoap.org/wsdl/";>

    <types>
       <schema xmlns="http://www.w3.org/2000/10/XMLSchema";>
          <element name="sum" type="integer"/>
          <element name="summands">
             <complexType>
                <all>
                   <element name="summand0" type="integer"/>
                   <element name="summand1" type="integer"/>
                </all>
             </complexType>
          </element>
       </schema>
    </types>

    <message name="getSum">
       <part name="rightHandSide" type="sum"/>
    </message>

    <message name="getSummands">
       <part name="leftHandSide" type="summands"/>
    </message>

    <portType name="mathWSPortType">
       <operation name="plus">
          <input message="tns:getSummands"/>
          <output message="tns:getSum"/>
       </operation>
    </portType>

    <binding name="mathWSSoapBinding" type="tns:mathWSPortType">
        <soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
        <operation name="plus">
           <soap:operation soapAction="http://chris.math.ut.ee/plus"/>
           <input>
               <soap:body use="literal"/>
           </input>
           <output>
               <soap:body use="literal"/>
           </output>
        </operation>
    </binding>

    <service name="MathWS">
        <documentation>Does your maths</documentation>
        <port name="MathWSPort" binding="tns:mathWSSoapBinding">
           <soap:address location="http://example.com/mathws"/>
        </port>
    </service>

</definitions>

Afterwards, I decided to try the example WSDL file from the spec (http://www.w3.org/TR/wsdl#_wsdl), which gives an exception with both versions of Axis2. Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException: Error parsing WSDL at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerationEngine.java:123)
        at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:32)
        at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:21)
Caused by: org.apache.axis2.AxisFault: null; nested exception is:
        java.lang.NullPointerException
at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.populateService(WSDL11ToAxisServiceBuilder.java:226) at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerationEngine.java:114)
        ... 2 more
Caused by: java.lang.NullPointerException
at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.generateWrapperSchema(WSDL11ToAxisServiceBuilder.java:888) at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.populateService(WSDL11ToAxisServiceBuilder.java:192)
        ... 3 more

Any suggestions?

TIA, Chris

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

Reply via email to