My guess is that the error is caused by the fact that you use the same
input message for both operations. Axis (and WS-I Basic Profile)
requires that each operation have a unique message signature (which is
the QName of the child element of the <soap:Body>). Both or your
operations use the same signature: "myNamespace"}myMethod.
The error might also be caused by the fact that "myNamespace" is not a
valid URI. A namespace must be a valid URI.
To fix your problem:
1. Change the target namespace to a valid URI (e.g., "urn:myNamespace")
2. Define unique input elements for your two operations
Meanwhile, WSDL2Java should not generate an NPE, so please also file a JIRA.
Anne
On 8/23/06, CHAPELLIERE Olivier ORANGE-FT
<[EMAIL PROTECTED]> wrote:
Hi everybody,
I have a NullPointerException while generating client code for a WSDL.
I tried axis2 version 1.0 and nightly build of august 22th 2006 and I always
have the exception.
My command line is:
WSDL2Java.sh -uri bug.wsdl -o gen
My wsdl file is the following:
1 <?xml version="1.0" encoding="UTF-8"?>
2 <wsdl:definitions xmlns="mynamespace"
3 xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
4 xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
5 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
6 targetNamespace="mynamespace">
7
8 <wsdl:types>
9 <xsd:schema elementFormDefault="qualified"
10 targetNamespace="mynamespace"
11 xmlns:mynamespace="mynamespace"
12 xmlns:xsd="http://www.w3.org/2001/XMLSchema">
13
14 <xsd:element name="myStatus"><xsd:complexType><xsd:sequence>
15 <xsd:element maxOccurs="1" minOccurs="1" name="errorcode"
type="xsd:int"/>
16 </xsd:sequence></xsd:complexType></xsd:element>
17
18 <xsd:element name="myMethod"><xsd:complexType><xsd:sequence>
19 <xsd:element maxOccurs="1" minOccurs="1" name="myArg"
type="xsd:string"/>
20 </xsd:sequence></xsd:complexType></xsd:element>
21
22 <xsd:element
name="myMethod1Response"><xsd:complexType><xsd:sequence>
23 <xsd:element maxOccurs="1" minOccurs="1"
ref="mynamespace:myStatus"/>
24 </xsd:sequence></xsd:complexType></xsd:element>
25
26 <xsd:element
name="myMethod2Response"><xsd:complexType><xsd:sequence>
27 <xsd:element maxOccurs="1" minOccurs="1"
ref="mynamespace:myStatus"/>
28 </xsd:sequence></xsd:complexType></xsd:element>
29
30 </xsd:schema>
31 </wsdl:types>
32
33 <wsdl:message name="myMethodRequest">
34 <wsdl:part name="input" element="myMethod"/>
35 </wsdl:message>
36 <wsdl:message name="myMethod1Result">
37 <wsdl:part name="output" element="myMethod1Response"/>
38 </wsdl:message>
39 <wsdl:message name="myMethod2Result">
40 <wsdl:part name="output" element="myMethod2Response"/>
41 </wsdl:message>
42
43 <wsdl:portType name="myWebServices">
44 <wsdl:operation name="myMethod1" parameterOrder="input">
45 <wsdl:input name="myMethodRequest"
message="myMethodRequest"/>
46 <wsdl:output name="myMethod1Result"
message="myMethod1Result"/>
47 </wsdl:operation>
48 <wsdl:operation name="myMethod2" parameterOrder="input">
49 <wsdl:input name="myMethodRequest"
message="myMethodRequest"/>
50 <wsdl:output name="myMethod2Result"
message="myMethod2Result"/>
51 </wsdl:operation>
52 </wsdl:portType>
53
54 <wsdl:binding name="myWebServicesSoapBinding" type="myWebServices">
55 <wsdlsoap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
56 <wsdl:operation name="myMethod1">
57 <wsdlsoap:operation soapAction="myMethod1"/>
58 <wsdl:input><wsdlsoap:body use="literal"/></wsdl:input>
59 <wsdl:output><wsdlsoap:body use="literal"/></wsdl:output>
60 </wsdl:operation>
61 <wsdl:operation name="myMethod2">
62 <wsdlsoap:operation soapAction="myMethod2"/>
63 <wsdl:input><wsdlsoap:body use="literal"/></wsdl:input>
64 <wsdl:output><wsdlsoap:body use="literal"/></wsdl:output>
65 </wsdl:operation>
66 </wsdl:binding>
67
68 <wsdl:service name="myWebServices">
69 <wsdl:port name="myWebServices"
binding="myWebServicesSoapBinding">
70 <wsdlsoap:address
location="http://localhost:8080/axis2/services/myWebServices"/>
71 </wsdl:port>
72 </wsdl:service>
73 </wsdl:definitions>
And I get the following exception stack trace:
Exception in thread "main"
org.apache.axis2.wsdl.codegen.CodeGenerationException: java.lang.RuntimeException:
java.lang.reflect.InvocationTargetException
at
org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:224)
at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:32)
at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:21)
Caused by: java.lang.RuntimeException:
java.lang.reflect.InvocationTargetException
at
org.apache.axis2.wsdl.codegen.extension.SimpleDBExtension.engage(SimpleDBExtension.java:52)
at
org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:177)
... 2 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
org.apache.axis2.wsdl.codegen.extension.SimpleDBExtension.engage(SimpleDBExtension.java:49)
... 3 more
Caused by: org.apache.axis2.schema.SchemaCompilationException:
java.lang.NullPointerException
at
org.apache.axis2.schema.writer.JavaBeanWriter.write(JavaBeanWriter.java:218)
at
org.apache.axis2.schema.SchemaCompiler.writeComplexType(SchemaCompiler.java:838)
at
org.apache.axis2.schema.SchemaCompiler.processElement(SchemaCompiler.java:563)
at
org.apache.axis2.schema.SchemaCompiler.processElement(SchemaCompiler.java:436)
at
org.apache.axis2.schema.SchemaCompiler.process(SchemaCompiler.java:1373)
at
org.apache.axis2.schema.SchemaCompiler.processParticle(SchemaCompiler.java:1336)
at
org.apache.axis2.schema.SchemaCompiler.processComplexType(SchemaCompiler.java:859)
at
org.apache.axis2.schema.SchemaCompiler.processAnonymousComplexSchemaType(SchemaCompiler.java:792)
at
org.apache.axis2.schema.SchemaCompiler.processSchema(SchemaCompiler.java:775)
at
org.apache.axis2.schema.SchemaCompiler.processElement(SchemaCompiler.java:475)
at
org.apache.axis2.schema.SchemaCompiler.processElement(SchemaCompiler.java:446)
at
org.apache.axis2.schema.SchemaCompiler.compile(SchemaCompiler.java:308)
at
org.apache.axis2.schema.SchemaCompiler.compile(SchemaCompiler.java:230)
at
org.apache.axis2.schema.ExtensionUtility.invoke(ExtensionUtility.java:77)
... 8 more
Caused by: java.lang.NullPointerException
at
org.apache.axis2.schema.writer.JavaBeanWriter.process(JavaBeanWriter.java:353)
at
org.apache.axis2.schema.writer.JavaBeanWriter.write(JavaBeanWriter.java:213)
... 21 more
I noticed that if I comment either line 23 or line 27 it works
I look into the archive and don't find anything
Is this a know problem? Do I miss something?
Thanks for your help
Olivier
*********************************
This message and any attachments (the "message") are confidential and intended
solely for the addressees. Any unauthorised
use or dissemination is prohibited.
Messages are susceptible to alteration. France Telecom Group shall not be
liable for the message if altered, changed or
falsified.
If you are not the intended addressee of this message, please cancel it
immediately and inform the sender.
********************************
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]