[ http://issues.apache.org/jira/browse/AXIS2-544?page=comments#action_12374044 ]
Venkatakrishnan commented on AXIS2-544: --------------------------------------- I have also been trying out Java2WSDL and found similar problems. Here is the output WSDL. I invoked the tool providing only the output location and the class name as inputs. i.e. the -o and -cn optoins alone were used. Here is the output. <wsdl:definitions 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://ws.apache.org/axis2" targetNamespace="http://ws.apache.org/axis2"> <wsdl:types> <xs:schema xmlns:ns2="http://www.w3.org/2001/XMLSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ns0="http://www.w3.org/2001/XMLSchema" xmlns:ns1="http://www.w3.org/2001/XMLSchema" ns1:elementFormDefault="unqualified" ns0:attributeFormDefault="unqualified" ns2:targetNamespace="http://org.apache.axis2/xsd"> <ns2:element type="ns1:Customer" name="Customer"></ns2:element> <ns2:complexType name="Customer"> <ns2:sequence></ns2:sequence> </ns2:complexType> <ns2:element name="getCustomerDetailsRequest"> <ns2:complexType> <ns2:sequence> <ns2:element type="xs:string" name="custId"></ns2:element> </ns2:sequence> </ns2:complexType> </ns2:element> <ns2:element name="getCustomerDetailsResponse"> <ns2:complexType> <ns2:sequence> <ns2:element type="ns1:Customer" name="return"></ns2:element> </ns2:sequence> </ns2:complexType> </ns2:element> <ns2:element name="getValueRequest"> <ns2:complexType> <ns2:sequence> <ns2:element type="xs:string" name="custId"></ns2:element> <ns2:element type="xs:string" name="stockSymbol"></ns2:element> </ns2:sequence> </ns2:complexType> </ns2:element> <ns2:element name="getValueResponse"> <ns2:complexType> <ns2:sequence> <ns2:element type="xs:int" name="return"></ns2:element> </ns2:sequence> </ns2:complexType> </ns2:element> </xs:schema> </wsdl:types> <wsdl:message name="getValueResponseMessage"> <wsdl:part name="part1" element="ns1:getValueResponse"></wsdl:part> </wsdl:message> <wsdl:message name="getCustomerDetailsResponseMessage"> <wsdl:part name="part1" element="ns1:getCustomerDetailsResponse"></wsdl:part> </wsdl:message> <wsdl:message name="getCustomerDetailsRequestMessage"> <wsdl:part name="part1" element="ns1:getCustomerDetailsRequest"></wsdl:part> </wsdl:message> <wsdl:message name="getValueRequestMessage"> <wsdl:part name="part1" element="ns1:getValueRequest"></wsdl:part> </wsdl:message> <wsdl:portType name="CustomerValuePortType"> <wsdl:operation name="getCustomerDetails"> <wsdl:input message="tns:getCustomerDetailsRequestMessage"></wsdl:input> <wsdl:output message="tns:getCustomerDetailsResponseMessage"></wsdl:output> </wsdl:operation> <wsdl:operation name="getValue"> <wsdl:input message="tns:getValueRequestMessage"></wsdl:input> <wsdl:output message="tns:getValueResponseMessage"></wsdl:output> </wsdl:operation> </wsdl:portType> <wsdl:binding name="CustomerValueBinding" type="tns:CustomerValuePortType"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"></soap:binding> <wsdl:operation name="getCustomerDetails"> <soap:operation soapAction="getCustomerDetails" style="document"></soap:operation> <wsdl:input> <soap:body use="literal" namespace="http://ws.apache.org/axis2"></soap:body> </wsdl:input> <wsdl:output> <soap:body use="literal" namespace="http://ws.apache.org/axis2"></soap:body> </wsdl:output> </wsdl:operation> <wsdl:operation name="getValue"> <soap:operation soapAction="getValue" style="document"></soap:operation> <wsdl:input> <soap:body use="literal" namespace="http://ws.apache.org/axis2"></soap:body> </wsdl:input> <wsdl:output> <soap:body use="literal" namespace="http://ws.apache.org/axis2"></soap:body> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="CustomerValue"> <wsdl:port name="CustomerValuePort" binding="axis2:CustomerValueBinding"> <soap:address location="http://127.0.0.1:8080/axis2/services/CustomerValue"></soap:address> </wsdl:port> </wsdl:service> </wsdl:definitions> Here is a summary of where this WSDL is having problems 1) The attributes of the element <xs:schema > 2) The prefix used in the element attribute of <wsdl:part> I have try to fix some of this by refactoring some code. i.e. I have crunched the implementations in the Java2WSDL, Java2WSDLBuilder and Java2WSDLCodegen classes into a single class. The code in this class predominantly deals with setting up the user inputs and default values to appropriate variables. From here on I have used all other classes as is. With this I have been able to fix these problems but for the one related to <wsdl:part> for which there needs to be some modifications done to the WOMtoWSDL11Writer class. I have figured out where the changes should go but have deliberately kept out of it. Here is what I could generate after these fixes. <wsdl:definitions 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://test.generate.java2wsdl.tools.tuscany.apache.org" targetNamespace="http://test.generate.java2wsdl.tools.tuscany.apache.org"> <wsdl:types> <xs:schema xmlns:stns="http://test.generate.java2wsdl.tools.tuscany.apache.org" targetNamespace="http://test.generate.java2wsdl.tools.tuscany.apache.org" elementFormDefault="qualified" attributeFormDefault="qualified"> <xs:element type="stns:Customer" name="Customer"></xs:element> <xs:complexType name="Customer"> <xs:sequence></xs:sequence> </xs:complexType> <xs:element name="getCustomerDetailsRequest"> <xs:complexType> <xs:sequence> <xs:element type="xs:string" name="custId"></xs:element> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="getCustomerDetailsResponse"> <xs:complexType> <xs:sequence> <xs:element type="stns:Customer" name="return"></xs:element> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="getValueRequest"> <xs:complexType> <xs:sequence> <xs:element type="xs:string" name="custId"></xs:element> <xs:element type="xs:string" name="stockSymbol"></xs:element> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="getValueResponse"> <xs:complexType> <xs:sequence> <xs:element type="xs:int" name="return"></xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> </wsdl:types> <wsdl:message name="getCustomerDetailsResponseMessage"> <wsdl:part name="part1" element="stns:getCustomerDetailsResponse"></wsdl:part> </wsdl:message> <wsdl:message name="getCustomerDetailsRequestMessage"> <wsdl:part name="part1" element="stns:getCustomerDetailsRequest"></wsdl:part> </wsdl:message> <wsdl:message name="getValueResponseMessage"> <wsdl:part name="part1" element="stns:getValueResponse"></wsdl:part> </wsdl:message> <wsdl:message name="getValueRequestMessage"> <wsdl:part name="part1" element="stns:getValueRequest"></wsdl:part> </wsdl:message> <wsdl:portType name="CustomerValuePortType"> <wsdl:operation name="getCustomerDetails"> <wsdl:input message="tns:getCustomerDetailsRequestMessage"></wsdl:input> <wsdl:output message="tns:getCustomerDetailsResponseMessage"></wsdl:output> </wsdl:operation> <wsdl:operation name="getValue"> <wsdl:input message="tns:getValueRequestMessage"></wsdl:input> <wsdl:output message="tns:getValueResponseMessage"></wsdl:output> </wsdl:operation> </wsdl:portType> <wsdl:binding name="CustomerValueBinding" type="tns:CustomerValuePortType"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"></soap:binding> <wsdl:operation name="getCustomerDetails"> <soap:operation soapAction="getCustomerDetails" style="document"></soap:operation> <wsdl:input> <soap:body use="literal" namespace="http://test.generate.java2wsdl.tools.tuscany.apache.org"></soap:body> </wsdl:input> <wsdl:output> <soap:body use="literal" namespace="http://test.generate.java2wsdl.tools.tuscany.apache.org"></soap:body> </wsdl:output> </wsdl:operation> <wsdl:operation name="getValue"> <soap:operation soapAction="getValue" style="document"></soap:operation> <wsdl:input> <soap:body use="literal" namespace="http://test.generate.java2wsdl.tools.tuscany.apache.org"></soap:body> </wsdl:input> <wsdl:output> <soap:body use="literal" namespace="http://test.generate.java2wsdl.tools.tuscany.apache.org"></soap:body> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="CustomerValue"> <wsdl:port name="CustomerValuePort" binding="tns:CustomerValueBinding"> <soap:address location="http://127.0.0.1:8080/axis2/services/CustomerValue"></soap:address> </wsdl:port> </wsdl:service> </wsdl:definitions> I know there are other things to be fixed as well. But then it would be preferable to make these changes into the AXIS2 codebase itself instead of doing it on the periphery as I have done upto now. So, can I work on refactoring the Axis2 code itself? Who owns the Java2WSDL codegen components? Since this is my first open-source community involvement I am not aware of the modus operandi for this. > Java2WSDL generates invalid WSDL > -------------------------------- > > Key: AXIS2-544 > URL: http://issues.apache.org/jira/browse/AXIS2-544 > Project: Apache Axis 2.0 (Axis2) > Type: Bug > Components: Tools > Versions: 0.95 > Reporter: Sebastian Mittelstädt > > In 0.95, the Java2WSDL class generates invalid WSDL. > The following WSDL was generated with Java2WSDL: > java2wsdl -cn com.mycompany.r002.R002 -cp bin -tn http://com.mycompany.r002 > -stn http://com.mycompany.r002.schema -stp r002schema -sn r002 -of r002.wsdl > This generated the following WSDL: > <?xml version="1.0" encoding="UTF-8"?> > <wsdl:definitions targetNamespace="http://com.mycompany.r002" > 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://com.mycompany.r002"> > <wsdl:types> > <xs:schema targetNamespace="http://com.mycompany.r002.schema" > elementFormDefault="unqualified" attributeFormDefault="unqualified" > xmlns:r002schema="http://com.mycompany.r002.schema"> > <!-- Type definitions (omitted) --> > </xs:schema> > </wsdl:types> > <wsdl:message name="calculateResponseMessage"> > <wsdl:part name="part1" element="r002schema:calculateResponse"/> > </wsdl:message> > <wsdl:message name="calculateRequestMessage"> > <wsdl:part name="part1" element="r002schema:calculateRequest"/> > </wsdl:message> > <wsdl:portType name="r002PortType"> > <wsdl:operation name="calculate"> > <wsdl:input message="tns:calculateRequestMessage"/> > <wsdl:output message="tns:calculateResponseMessage"/> > </wsdl:operation> > </wsdl:portType> > <wsdl:binding name="r002Binding" type="tns:r002PortType"> > <soap:binding transport="http://schemas.xmlsoap.org/soap/http" > style="document"/> > <wsdl:operation name="calculate"> > <soap:operation soapAction="calculate" style="document"/> > <wsdl:input> > <soap:body use="literal" namespace="http://com.mycompany.r002"/> > </wsdl:input> > <wsdl:output> > <soap:body use="literal" namespace="http://com.mycompany.r002"/> > </wsdl:output> > </wsdl:operation> > </wsdl:binding> > <wsdl:service name="r002"> > <wsdl:port name="r002Port" binding="axis2:r002Binding"> > <soap:address location="http://127.0.0.1:8080/axis2/services/r002"/> > </wsdl:port> > </wsdl:service> > </wsdl:definitions> > This WSDL is invalid due to the following errors: > - The value 'axis2:r002Binding' of attribute 'binding' on element 'wsdl:port' > is not valid with respect to its type, 'QName'. > - The value 'r002schema:calculateRequest' of attribute 'element' on element > 'wsdl:part' is not valid with respect to its type, 'QName'. > - The value 'r002schema:calculateResponse' of attribute 'element' on element > 'wsdl:part' is not valid with respect to its type, 'QName'. > - Cannot resolve 'axis2:r002Binding' as a QName: the prefix 'axis2' is not > declared. > - Cannot resolve 'r002schema:calculateRequest' as a QName: the prefix > 'r002schema' is not declared. > - Cannot resolve 'r002schema:calculateResponse' as a QName: the prefix > 'r002schema' is not declared. -- 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