[ 
https://issues.apache.org/jira/browse/AXIS2-4953?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12991812#comment-12991812
 ] 

Supun Malinga commented on AXIS2-4953:
--------------------------------------

Following are the list of Issue that came across,

1) Java2Wsdl creates an attribute called "nillable=true" for all the elements 
that got generated inside schema.
attachment: MyTestService.wsdl

2) Java2Wsdl creates anonymous complex types for the request, response and 
exception defined for an operation.

If see the attached sample1.zip/TestJ2WsdlService.wsdl, it contains an 
anonymous complex type in the name doJ2Wsdl ( same as operation name)
attachment also contains the interface and related class.

Proper defined types should be availabe,
Input options used are [1]


3) Abstract types are not generated properly in the wsdl after java2wsdl

The attached sample2.zip contains the generated wsdl and all the java classes 
used to generate wsdl.
The class AbstractRequest is abstract. But the type generated for 
AbstractRequest in the wsdl looks like

<xs:complexType name="AbstractRequest">
<xs:sequence>
<xs:element minOccurs="0" name="requestType" type="xs:int" />
</xs:sequence>
</xs:complexType>

it does not have the information of abstract.

ideally it should be

<xs:complexType abstract="true" name="AbstractRequest">
<xs:sequence>
<xs:element name="requestType" type="xs:int" />
</xs:sequence>
</xs:complexType> 


4) In the generated wsdl from java2Wsdl, Name of the complex anonymous type 
created for exception and name of the exception type are same.

The attachment has a wsdl TestJ2WsdlService which has content like this
<xs:element name="J2WsdlServiceException">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="J2WsdlServiceException"
nillable="true" type="ravi:J2WsdlServiceException" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="J2WsdlServiceException">
<xs:sequence />
</xs:complexType>

The name of the anonymous complex type and the complex type for exception is 
same J2WsdlServiceException.

Hence wsdl2java throws a RuntimeException
Attached zip contains the source. Following are the input arguments. [1]

Wsdl2java for generated wsdl fails with the following exception.  see 
attachment, exception1.txt.
use attached sample3.zip to reproduce the issue.


5) 
Annotation "WebResult" is not working. Still the wsdl has "return" as the name 
of the element.

In the attached source, the interface has a method doJ2Wsdl for which return 
type is J2WsdlServiceResponse.
I configured the annotation @WebResult(name = "j2WsdlResp") for the method but 
the generated wsdl does not seem to have the new value j2WsdlResp still it has 
the name of the element as "return"

Method signature:
@WebResult(name = "j2WsdlResp")
J2WsdlServiceResponse doJ2Wsdl(
@WebParam(name = "j2WsdlServiceRequest") J2WsdlServiceRequest request)
throws J2WsdlServiceException;


<xs:element name="doJ2WsdlResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="return" nillable="true"
type="ravi:J2WsdlServiceResponse" />
</xs:sequence>
</xs:complexType>
</xs:element>

 It seems there is a bug in class DefaultSchemaGenerator, method processMethods 
in the following code snippet.

                WebResultAnnotation returnAnnon = 
JSR181Helper.INSTANCE.getWebResultAnnotation(jMethod);
                String returnName = "return";
                if (returnAnnon != null) {
                    returnName = returnAnnon.getName();
                    if (returnName != null && !"".equals(returnName)) {
                        returnName = "return";
                    }
                } 

see the sample4.zip for reproducing the issue.

6)
Which Schema Generator to use? 
org.apache.axis2.description.java2wsdl.DefaultSchemaGenerator or 
org.apache.axis2.jaxbri.JaxbSchemaGenerator

Seems by default org.apache.axis2.description.java2wsdl.DefaultSchemaGenerator 
is used.

The Issue is,
With DefaultSchemaGenerator:

Suppose the java method throws standard java exception say 
java.lang.ClassNotFoundException
The generated wsdl has type as anyType
<xs:element name="ClassNotFoundException">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="ClassNotFoundException"
nillable="true" type="xs:anyType" />
</xs:sequence>
</xs:complexType>
</xs:element>

So with the generated wsdl if wsdl2Java is performed then xs:anyType would be 
treated as Object.


With JaxbSchemaGenerator:
Suppose the java method throws proper user defined exception.
In that case generated wsdl contains inline types for types like Throwable, 
Exception.


<xs:complexType name="j2WsdlServiceException">
<xs:complexContent>
<xs:extension base="tns:exception">
<xs:sequence />
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="exception">
<xs:complexContent>
<xs:extension base="tns:throwable">
<xs:sequence />
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="throwable">
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="stackTrace"
nillable="true" type="tns:stackTraceElement" />
</xs:sequence>
</xs:complexType>
<xs:complexType final="extension restriction" name="stackTraceElement">
<xs:sequence />
</xs:complexType> 



7)

The generated wsdl from java2wsdl contains three bindings by default. Http, 
SOAP11 and SOAP12
Is there a way to configure the required bindings.


[1]
-l http://localhost:8080/MyTestService 
-tp abc
-tn namespace
-stn namespace
-stp ravi
-p2n foo.bar.service.namespace
-o /path
-cn foo.bar.service.TestJ2WsdlService
-of TestJ2WsdlService.wsdl
-efd qualified
-afd unqualified
-st document
-u literal


> axis2 codegen related bugs
> --------------------------
>
>                 Key: AXIS2-4953
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4953
>             Project: Axis2
>          Issue Type: Bug
>          Components: codegen, kernel
>            Reporter: Supun Malinga
>            Priority: Minor
>


-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscr...@axis.apache.org
For additional commands, e-mail: java-dev-h...@axis.apache.org

Reply via email to