[prev in list] [next in list] [prev in thread] [next in thread] 

List:       axis-dev
Subject:    [jira] [Updated] (AXIS2-4297) java org.apache.axis2.wsdl.WSDL2Java -d jaxbri creates unreachable cod
From:       "Eranda Sooriyabandara (JIRA)" <jira () apache ! org>
Date:       2015-07-23 3:08:04
Message-ID: JIRA.12421883.1238683957000.267540.1437620884753 () Atlassian ! JIRA
[Download RAW message or body]


     [ https://issues.apache.org/jira/browse/AXIS2-4297?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel \
]

Eranda Sooriyabandara updated AXIS2-4297:
-----------------------------------------
    Attachment: AXIS2-4297.patch

Updating the patch to resolve regression.

> java org.apache.axis2.wsdl.WSDL2Java -d jaxbri creates unreachable code in \
>                 <ServiceName>MessageReceiverInOut.java
> -----------------------------------------------------------------------------------------------------------------
>  
> Key: AXIS2-4297
> URL: https://issues.apache.org/jira/browse/AXIS2-4297
> Project: Axis2
> Issue Type: Bug
> Components: codegen
> Affects Versions: 1.4
> Environment: JDK 1.6.0_10
> AXIS2 1.4
> Reporter: Martin Gainty
> Priority: Minor
> Labels: jaxb
> Fix For: 1.7.0
> 
> Attachments: AXIS2-4297.patch, AXIS2-4297.patch
> 
> Original Estimate: 48h
> Remaining Estimate: 48h
> 
> //I took your code
> package darcy;
> //public interface MyService
> public class MyService
> {
> String User;
> //  public User createUser(User userSpecification);
> public String createUser(String userSpecification)
> {
> this.User=userSpecification;
> return this.User;
> }
> }
> javac ./darcy/MyService.java
> //to generate the following /jaxb/MyService.WSDL
> %AXIS2_HOME%\samples\Darcy>Java2WSDL -cp .;%CLASSPATH% -o .\jaxb -sn MyService -st \
> jaxb -u jaxb -cn darcy.MyService Using AXIS2_HOME:   F:\AXIS\axis2-1.4
> Using JAVA_HOME:    C:\JAVA6\jdk
> //Start of generated /jaxb/MyService.WSDL
> <?xml version="1.0" encoding="UTF-8"?>
> <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" \
> xmlns:ns1="http://org.apache.axis2/xsd" xmlns:ns="http://darcy" \
> xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" \
> xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" \
> xmlns:xs="http://www.w3.org/2001/XMLSchema" \
> xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" \
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" \
> xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" \
> targetNamespace="http://darcy"> <wsdl:types>
> <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" \
> targetNamespace="http://darcy"> <xs:element name="createUser">
> <xs:complexType>
> <xs:sequence>
> <xs:element minOccurs="0" name="param0" nillable="true" type="xs:string"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> <xs:element name="createUserResponse">
> <xs:complexType>
> <xs:sequence>
> <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:schema>
> </wsdl:types>
> <wsdl:message name="createUserRequest">
> <wsdl:part name="parameters" element="ns:createUser"/>
> </wsdl:message>
> <wsdl:message name="createUserResponse">
> <wsdl:part name="parameters" element="ns:createUserResponse"/>
> </wsdl:message>
> <wsdl:portType name="MyServicePortType">
> <wsdl:operation name="createUser">
> <wsdl:input message="ns:createUserRequest" wsaw:Action="urn:createUser"/>
> <wsdl:output message="ns:createUserResponse" wsaw:Action="urn:createUserResponse"/>
> </wsdl:operation>
> </wsdl:portType>
> <wsdl:binding name="MyServiceSoap11Binding" type="ns:MyServicePortType">
> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="jaxb"/>
> <wsdl:operation name="createUser">
> <soap:operation soapAction="urn:createUser" style="jaxb"/>
> <wsdl:input>
> <soap:body use="jaxb"/>
> </wsdl:input>
> <wsdl:output>
> <soap:body use="jaxb"/>
> </wsdl:output>
> </wsdl:operation>
> </wsdl:binding>
> <wsdl:binding name="MyServiceSoap12Binding" type="ns:MyServicePortType">
> <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="jaxb"/>
> <wsdl:operation name="createUser">
> <soap12:operation soapAction="urn:createUser" style="jaxb"/>
> <wsdl:input>
> <soap12:body use="jaxb"/>
> </wsdl:input>
> <wsdl:output>
> <soap12:body use="jaxb"/>
> </wsdl:output>
> </wsdl:operation>
> </wsdl:binding>
> <wsdl:binding name="MyServiceHttpBinding" type="ns:MyServicePortType">
> <http:binding verb="POST"/>
> <wsdl:operation name="createUser">
> <http:operation location="MyService/createUser"/>
> <wsdl:input>
> <mime:content type="text/xml" part="createUser"/>
> </wsdl:input>
> <wsdl:output>
> <mime:content type="text/xml" part="createUser"/>
> </wsdl:output>
> </wsdl:operation>
> </wsdl:binding>
> <wsdl:service name="MyService">
> <wsdl:port name="MyServiceHttpSoap11Endpoint" binding="ns:MyServiceSoap11Binding">
> <soap:address location="http://localhost:8080/axis2/services/MyService"/>
> </wsdl:port>
> <wsdl:port name="MyServiceHttpSoap12Endpoint" binding="ns:MyServiceSoap12Binding">
> <soap12:address location="http://localhost:8080/axis2/services/MyService"/>
> </wsdl:port>
> <wsdl:port name="MyServiceHttpEndpoint" binding="ns:MyServiceHttpBinding">
> <http:address location="http://localhost:8080/axis2/services/MyService"/>
> </wsdl:port>
> </wsdl:service>
> </wsdl:definitions>
> //END /jaxb/MyService.WSDL generated
> //and now we will use MyService.wsdl to generate JAXB Java classes with
> %AXIS2_HOME%\samples\Darcy>java org.apache.axis2.wsdl.WSDL2Java -d jaxbri -
> ss -sd -t -o target/darcy/MyService -u -uri ./jaxb/MyService.wsdl
> //produces these Java classes
> Directory of %AXIS2_HOME%\samples\Darcy\target\darcy\MyService\src\darcy
> 04/02/2009  10:13 AM             1,744 CreateUser.java
> 04/02/2009  10:13 AM             1,764 CreateUserResponse.java
> 04/02/2009  09:49 AM            13,530 MyServiceMessageReceiverInOut.java
> 04/02/2009  09:49 AM               869 MyServiceSkeleton.java
> 04/02/2009  10:13 AM             2,360 ObjectFactory.java
> 04/02/2009  10:13 AM               150 package-info.java
> //Please note public MyServiceMessageReceiverInOut extends
> //org.apache.axis2.receivers.AbstractInOutMessageReceiver
> //since the WSDL2Java binding is JAXB the User objects are created as JAXBContext
> //inside the MyServiceMessageReceiverInOut.java as illustrated here:
> private static javax.xml.bind.JAXBContext _darcy_CreateUser;
> private static javax.xml.bind.JAXBContext _darcy_CreateUserResponse;
> private static final java.util.HashMap<Class,javax.xml.bind.JAXBContext>
> //run build.xml jar.server and see if we can find any nasty BUGs
> %AXIS2_HOME%\samples\Darcy\target\darcy\MyService>ant jar.server
> Buildfile: build.xml
> init:
> [mkdir] Created dir: %AXIS2_HOME%\samples\Darcy\target\darcy\MyService\
> build
> [mkdir] Created dir: %AXIS2_HOME%\samples\Darcy\target\darcy\MyService\
> build\classes
> [mkdir] Created dir: %AXIS2_HOME%\samples\Darcy\target\darcy\MyService\
> build\lib
> [mkdir] Created dir: %AXIS2_HOME%\samples\Darcy\target\darcy\MyService\
> test
> pre.compile.test:
> [echo] JAX-B RI Availability = true
> [echo] Stax Availability= true
> [echo] Axis2 Availability= true
> compile.src:
> [javac] Compiling 6 source files to %AXIS2_HOME%\samples\Darcy\target\d
> arcy\MyService\build\classes
> [javac] %AXIS2_HOME%\samples\Darcy\target\darcy\MyService\src\darcy\MyS
> erviceMessageReceiverInOut.java:51: unreachable statement
> [javac]         newMsgContext.setEnvelope(envelope);
> [javac]         ^
> [javac] 1 error
> BUILD FAILED
> //please comment out generated MyServiceMessageReceiverInOut.java:
> //this else doesnt make any sense since methodName is already assigned
> //else
> //{
> //    throw new java.lang.RuntimeException("method not found");
> //}
> //lets run build.xml and see if we can generate the .aar
> %AXIS2_HOME%\samples\Darcy\target\darcy\MyService>ant jar.server



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic