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 "Amila Chinthaka Suriarachchi (JIRA)" <ji...@apache.org> on 2010/12/25 13:04:45 UTC
[jira] Commented: (AXIS2-4297) java org.apache.axis2.wsdl.WSDL2Java
-d jaxbri creates unreachable code in
MessageReceiverInOut.java
[ https://issues.apache.org/jira/browse/AXIS2-4297?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12975046#action_12975046 ]
Amila Chinthaka Suriarachchi commented on AXIS2-4297:
-----------------------------------------------------
can you please attach your wsdl?
> 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
> Fix For: 1.6
>
> 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 is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org