Hi all,
we are playing around with the samples from the tutorial... we have extended the
MyService to take a comlpexType (a string, an int and a double) and would like
to create the client from the WSDL.
Axis has created the attached WSDL from our service, but WSDL2Java fails when
called like this:
---------------
axis2/bin# WSDL2Java -uri ..\samples\MyService.wsdl -o ..\samples\src -p
org.apache.axis2
-----------------
with this error:
--------------------------
Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException
: org.apache.axis2.wsdl.codegen.CodeGenerationException: Invalid WSDL: The WSDL
Types Schema does not define a targetNamespace in file:../samples/
at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGener
ationEngine.java:118)
at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:31)
at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:21)
Caused by: org.apache.axis2.wsdl.codegen.CodeGenerationException: Invalid WSDL:
The WSDL Types Schema does not define a targetNamespace in file:../samples/
at org.apache.axis2.wsdl.codegen.extension.WSDLValidatorExtension.engage
(WSDLValidatorExtension.java:70)
at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGener
ationEngine.java:80)
... 2 more
If we try to enter anything else in the targetNamespace attribute in the WSDL,
it gives us a NullPointerException instead.
Any clues?
Thanks a lot in advance!
-- Sebi
<wsdl:definitions xmlns:ns1="http://org.apache.axis2/xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://org.apache.axis2/"
targetNamespace="http://org.apache.axis2/"><wsdl:types><xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ns2="http://www.w3.org/2001/XMLSchema"
xmlns:ns0="http://www.w3.org/2001/XMLSchema"
xmlns:ns1="http://org.apache.axis2/xsd" ns1:elementFormDefault="qualified"
ns0:attributeFormDefault="unqualified"
ns2:targetNamespace="http://org.apache.axis2/xsd">
<xs:element ns0:name="echoRequest">
<xs:complexType>
<xs:sequence>
<xs:element xmlns:ns1="http://www.w3.org/2001/XMLSchema" ns0:name="param0"
ns1:type="xs:anyType"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element ns0:name="echoResponse">
<xs:complexType>
<xs:sequence>
<xs:element xmlns:ns1="http://www.w3.org/2001/XMLSchema" ns0:name="return"
ns1:type="xs:anyType"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element ns0:name="pingRequest">
<xs:complexType>
<xs:sequence>
<xs:element xmlns:ns1="http://www.w3.org/2001/XMLSchema" ns0:name="param0"
ns1:type="xs:anyType"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element ns0:name="plingRequest">
<xs:complexType>
<xs:sequence>
<xs:element xmlns:ns1="http://www.w3.org/2001/XMLSchema" ns0:name="param0"
ns1:type="xs:string"/>
<xs:element xmlns:ns1="http://www.w3.org/2001/XMLSchema" ns0:name="param1"
ns1:type="xs:int"/>
<xs:element xmlns:ns1="http://www.w3.org/2001/XMLSchema" ns0:name="param2"
ns1:type="xs:double"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element ns0:name="plingResponse">
<xs:complexType>
<xs:sequence>
<xs:element xmlns:ns1="http://www.w3.org/2001/XMLSchema" ns0:name="return"
ns1:type="xs:anyType"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element ns0:name="pingFRequest">
<xs:complexType>
<xs:sequence>
<xs:element xmlns:ns1="http://www.w3.org/2001/XMLSchema" ns0:name="param0"
ns1:type="xs:anyType"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema></wsdl:types><wsdl:message name="pingFRequestMessage"><wsdl:part
name="part1" element="ns1:pingFRequest"/></wsdl:message><wsdl:message
name="plingResponseMessage"><wsdl:part name="part1"
element="ns1:plingResponse"/></wsdl:message><wsdl:message
name="echoResponseMessage"><wsdl:part name="part1"
element="ns1:echoResponse"/></wsdl:message><wsdl:message
name="echoRequestMessage"><wsdl:part name="part1"
element="ns1:echoRequest"/></wsdl:message><wsdl:message
name="pingRequestMessage"><wsdl:part name="part1"
element="ns1:pingRequest"/></wsdl:message><wsdl:message
name="plingRequestMessage"><wsdl:part name="part1"
element="ns1:plingRequest"/></wsdl:message><wsdl:portType
name="MyServicePort"><wsdl:operation name="pling"><wsdl:input
message="tns:plingRequestMessage"/><wsdl:output
message="tns:plingResponseMessage"/></wsdl:operation><wsdl:operation
name="pingF"><wsdl:input
message="tns:pingFRequestMessage"/></wsdl:operation><wsdl:operation
name="echo"><wsdl:input message=
"tns:echoRequestMessage"/><wsdl:output
message="tns:echoResponseMessage"/></wsdl:operation><wsdl:operation
name="ping"><wsdl:input
message="tns:pingRequestMessage"/></wsdl:operation></wsdl:portType><wsdl:binding
name="MyServiceBinding" type="tns:MyServicePort"><soap:binding
transport="http://schemas.xmlsoap.org/soap/http"
style="document"/><wsdl:operation name="pling"><soap:operation name="operation"
soapAction="pling" style="document"/><wsdl:input><soap:body use="literal"
namespace="http://www.org.apache.axis2"/></wsdl:input><wsdl:output><soap:body
use="literal"
namespace="http://www.org.apache.axis2"/></wsdl:output></wsdl:operation><wsdl:operation
name="pingF"><soap:operation name="operation" soapAction="pingF"
style="document"/><wsdl:input><soap:body use="literal"
namespace="http://www.org.apache.axis2"/></wsdl:input></wsdl:operation><wsdl:operation
name="echo"><soap:operation name="operation" soapAction="echo"
style="document"/><wsdl:input><soap:body use="literal" namesp
ace="http://www.org.apache.axis2"/></wsdl:input><wsdl:output><soap:body
use="literal"
namespace="http://www.org.apache.axis2"/></wsdl:output></wsdl:operation><wsdl:operation
name="ping"><soap:operation name="operation" soapAction="ping"
style="document"/><wsdl:input><soap:body use="literal"
namespace="http://www.org.apache.axis2"/></wsdl:input></wsdl:operation></wsdl:binding><wsdl:service
name="MyService"><wsdl:port name="MyServicePortType"
binding="tns:MyServiceBinding"><soap:address
location="http://localhost/axis2/services/MyService"/></wsdl:port></wsdl:service></wsdl:definitions>