You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Venkatakrishnan (JIRA)" <ji...@apache.org> on 2006/04/17 19:49:42 UTC

[jira] Updated: (AXIS2-544) Java2WSDL generates invalid WSDL

     [ http://issues.apache.org/jira/browse/AXIS2-544?page=all ]

Venkatakrishnan updated AXIS2-544:
----------------------------------

    Attachment: Java2WSDL - Axis2 Patch.txt

I downloaded the source from the SVN this morning and tried out Java2WSDL.  The output seems to be better now.   However here are some points that need to be addressed and I have attached a patch for the same.  This patch also takes cares of the issue raised by Sebastian Mittelstädt : -

- The namespace prefixed as "ns1" in the wsdl:definitions element is not configurable. i.e. it is always set to "http://org.apache.axis2/xsd".  On the other hand it must reflect the schematargetNamespace.  According to the current implementation if the schemaTargetNamespace is input by the user to something different using the -stn option  this will again lead to the old problems related to the message parts.  

- The targetnamespace and the targetnamespaceprefix are always set to a predefined constant.  Hence if there are any user preferences input using the -tn and -tp options they will not take effect.

- As for the default targetNamespace I thought if there was namespace that could be generated out fo the input classname it would be a good default value since it will aid the proper java package information when WSDL2Java is used on the generated wsdl output.  

- There can be another class called Java2WSDLUtils that can host the utility methods.  Infact the method 'getSimpleName' has implementation in two classes.  

Here is a summary of changes I have made: -
- Added a Java2WSDLUtils class and have moved the utitlity methods into this, invokable as static methods
- In the SchemaGenerator class if the user has not specified any input for the schemaTargetNamespace then the default value will be derived from the classname that is input by the user
- The J2OMBuilder takes an additional argument in its constructor for the targetNamespacePrefix and an instance variable has been added to the class to hold the value of this.
- In creating the wsdl:defintions element the values for targetNamespace and targetNamespacePrefix if input by the user are utitlized.  If the user has not set targetNamespace then it derived from the classname that is input by the user.
- Removed a method from Java2WSDLBuilder and have used a method from the Java2WSDLUtils class.

Please let me know if this makes sense.

Next I am trying to see how the generation of multiple schema elements can be done.  This will again be useful in consistent round-trips of the generated wsdl back to Java Types.  Right now all Java types will be mapped under the same target namespaces even if they belonged to different Java packages.  If anybody is already working on this let me know. 

 Thanks.



> 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
>     Assignee: Deepal Jayasinghe
>  Attachments: Java2WSDL - Axis2 Patch.txt
>
> 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