Hi Deepal,
I've butted my head against the same issue during the past few weeks (most
recently with the June 19 Axis2 snap) and have had to resort to fixing the
wsdl with a perl script. Rather easy to reproduce with 2 source files:
test.MyService.java
####################
package test;
import test.MyData;
public class MyService
{
private MyData myData = new MyData();
public MyData retrieveMyData()
{
return myData;
}
}
Test.MyData.java
###################
package test;
public class MyData
{
private String myString = null;
public String getMyString() { return this.myString; }
public void setMyString(String arg) { this.myString = arg; }
}
I ran:
..\bin\java2wsdl.bat -cp . -sn TEST -l
http://localhost:8080/axis2/services/Logger -st wrapped -cn test.MyService
(and I did try different styles - same result)
Which resulted in the following wsdl with the element "MyData" defined
twice:
###################
wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:axis2="http://test"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:ns1="http://test/xsd"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
targetNamespace="http://test">
<wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ns="http://test/xsd" targetNamespace="http://test/xsd"
elementFormDefault="unqualified" attributeFormDefault="unqualified">
<xs:element type="ns:MyData" name="MyData" />
<xs:complexType name="MyData">
<xs:sequence>
<xs:element type="xs:string" name="myString" />
</xs:sequence>
</xs:complexType>
<xs:element name="retrieveMyData">
<xs:complexType />
</xs:element>
<xs:element name="retrieveMyDataResponse">
<xs:complexType>
<xs:sequence>
<xs:element type="ns:MyData" name="return" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="MyData">
<xs:sequence>
<xs:element type="xs:string" name="myString" />
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="retrieveMyDataMessage">
<wsdl:part element="ns1:retrieveMyData" name="part1" />
</wsdl:message>
<wsdl:message name="retrieveMyDataResponseMessage">
<wsdl:part element="ns1:retrieveMyDataResponse" name="part1" />
</wsdl:message>
<wsdl:portType name="TESTPortType">
<wsdl:operation name="retrieveMyData">
<wsdl:input message="axis2:retrieveMyDataMessage" />
<wsdl:output message="axis2:retrieveMyDataResponseMessage" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding type="axis2:TESTPortType" name="TESTSOAP11Binding">
<soap:binding style="wrapped"
transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="retrieveMyData">
<soap:operation style="wrapped" soapAction="urn:retrieveMyData" />
<wsdl:input>
<soap:body namespace="http://test" use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body namespace="http://test" use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding type="axis2:TESTPortType" name="TESTSOAP12Binding">
<soap12:binding style="wrapped"
transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="retrieveMyData">
<soap12:operation style="wrapped" soapAction="urn:retrieveMyData" />
<wsdl:input>
<soap12:body namespace="http://test" use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body namespace="http://test" use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="TEST">
<wsdl:port binding="axis2:TESTSOAP11Binding" name="TESTSOAP11port">
<soap:address
location="http://localhost:8080/axis2/services/LoggerTEST" />
</wsdl:port>
<wsdl:port binding="axis2:TESTSOAP12Binding" name="TESTSOAP12port">
<soap12:address
location="http://localhost:8080/axis2/services/LoggerTEST" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
-----Original Message-----
From: Deepal Jayasinghe [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 27, 2006 12:41 AM
To: [email protected]
Subject: Re: The duplicate type is happening here for the WSDL file
Hi Jim;
can you please provide a way to recreate the issue , I mean any
possibility of sending java class that you use :)
Jim Bender wrote:
> I don't know the precise step, but by the time that we leave the
> generateOM() method in the Java2OMBuilder, there are two complex type
> definitions in the WSDL.
>
> public OMElement generateOM() throws Exception {
> OMFactory fac = OMAbstractFactory.getOMFactory();
> wsdl = fac.createOMNamespace(WSDL_NAMESPACE,
> DEFAULT_WSDL_NAMESPACE_PREFIX);
> OMElement ele = fac.createOMElement("definitions", wsdl);
>
> ele.addAttribute("targetNamespace", targetNamespace, null);
> generateNamespaces(fac, ele);
> generateTypes(fac, ele);
> generateMessages(fac, ele);
> generatePortType(fac, ele);
> generateBinding(fac, ele);
> generateService(fac, ele);
> return ele;
> }
>
> The element's printString shows the story:
>
> <wsdl:types xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"><xs:schema
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:ns="http://testexamples/xsd"
> targetNamespace="http://testexamples/xsd"
> elementFormDefault="unqualified" attributeFormDefault="unqualified">
> <xs:element type="ns:FoodDescription" name="FoodDescription" />
> <xs:complexType name="FoodDescription">
> <xs:sequence>
> <xs:element type="xs:int" name="calories" />
> <xs:element type="xs:int" name="fatGrams" />
> <xs:element type="xs:int" name="fiberGrams" />
> <xs:element type="xs:int" name="points" />
> </xs:sequence>
> </xs:complexType>
> <xs:element name="calculatePoints">
> <xs:complexType>
> <xs:sequence>
> <xs:element type="ns:FoodDescription" name="param0" />
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> <xs:element name="calculatePointsResponse">
> <xs:complexType>
> <xs:sequence>
> <xs:element type="xs:int" name="return" />
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> <xs:complexType name="FoodDescription">
> <xs:sequence>
> <xs:element type="xs:int" name="calories" />
> <xs:element type="xs:int" name="fatGrams" />
> <xs:element type="xs:int" name="fiberGrams" />
> <xs:element type="xs:int" name="points" />
> </xs:sequence>
> </xs:complexType>
> </xs:schema></wsdl:types>
>
> Regards,
>
> Jim
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
--
Thanks,
Deepal
................................................................
~Future is Open~
---------------------------------------------------------------------
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]