CXF adds @WebMethod annotation without import section when async binding is 
turned on
-------------------------------------------------------------------------------------

                 Key: CXF-1875
                 URL: https://issues.apache.org/jira/browse/CXF-1875
             Project: CXF
          Issue Type: Bug
    Affects Versions: 2.1.2
         Environment: Windows XP 64-bit, Java JDK 1.5. update 14 (32-bit)
            Reporter: Slobodan Marjanovic
            Priority: Minor


I use CXF to generate a WS client classes. There are some smaller issues in 
generated code. CXF uses @WebMethod annotation but it doesn't adds it to the 
import section of the class.  This happens only when async-binding is turned on.

========================
CXF ant task:
<target name="generate">
                <java classname="org.apache.cxf.tools.wsdlto.WSDLToJava" 
fork="true">
                        <arg value="-client" />
                        <arg value="-b" />
                        <arg value="async_binding.xml" />
                        <arg value="-d" />
                        <arg value="src" />
                        <arg value="${wsdl.url}" />
                        <classpath>
                                <fileset dir="${basedir}/lib">
                                        <include name="*.jar" />
                                </fileset>
                        </classpath>
                </java>

        </target>
========================

========================
async_binding.xml
<bindings
    xmlns:xsd="http://www.w3.org/2001/XMLSchema";
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
    xmlns="http://java.sun.com/xml/ns/jaxws";>
    <bindings node="wsdl:definitions">
        <enableAsyncMapping>true</enableAsyncMapping>
    </bindings>
</bindings>
========================

========================
WSDL in question:

<definitions name='HelloWorldSecurityService' 
targetNamespace='http://session.poc.prozone.com/' 
xmlns='http://schemas.xmlsoap.org/wsdl/' 
xmlns:soap12='http://schemas.xmlsoap.org/wsdl/soap12/' 
xmlns:tns='http://session.poc.prozone.com/' 
xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
 <types></types>
 <message name='HelloWorldSecurityBean_helloWorldResponse'>
  <part name='return' type='xsd:string'></part>
 </message>
 <message name='HelloWorldSecurityBean_helloWorld'></message>
 <portType name='HelloWorldSecurityBean'>
  <operation name='helloWorld'>
   <input message='tns:HelloWorldSecurityBean_helloWorld'></input>
   <output message='tns:HelloWorldSecurityBean_helloWorldResponse'></output>
  </operation>
 </portType>
 <binding name='HelloWorldSecurityBeanBinding' 
type='tns:HelloWorldSecurityBean'>
  <soap12:binding style='rpc' transport='http://schemas.xmlsoap.org/soap/http'/>
  <operation name='helloWorld'>
   <soap12:operation soapAction=''/>
   <input>
    <soap12:body namespace='http://session.poc.prozone.com/' use='literal'/>
   </input>
   <output>
    <soap12:body namespace='http://session.poc.prozone.com/' use='literal'/>
   </output>
  </operation>
 </binding>
 <service name='HelloWorldSecurityService'>
  <port binding='tns:HelloWorldSecurityBeanBinding' 
name='HelloWorldSecurityPort'>
   <soap12:address 
location='http://127.0.0.1:8080/HelloWorldSecurity-app/HelloWorldSecurityBean'/>
  </port>
 </service>
</definitions>
========================

========================
Problematic generate class:
package com.prozone.poc.session;

import java.util.concurrent.Future;
import javax.jws.WebMethod;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;
import javax.xml.ws.AsyncHandler;
import javax.xml.ws.Response;

/**
 * This class was generated by Apache CXF 2.1.2
 * Thu Oct 16 11:33:29 CEST 2008
 * Generated source version: 2.1.2
 * 
 */
 
@WebService(targetNamespace = "http://session.poc.prozone.com/";, name = 
"HelloWorldSecurityBean")
@SOAPBinding(style = SOAPBinding.Style.RPC)
public interface HelloWorldSecurityBean {

    @WebResult(name = "return", targetNamespace = 
"http://session.poc.prozone.com/";, partName = "return")
    @WebMethod
    public java.lang.String helloWorld();

    @WebMethod(operationName = "helloWorld")
    public Response<java.lang.String> helloWorldAsync();

    @WebMethod(operationName = "helloWorld")
    public Future<?> helloWorldAsync(
        @WebParam(name = "asyncHandler", targetNamespace = "")
        AsyncHandler<java.lang.String> asyncHandler
    );
}

========================
As you can see annotation @WebMethod has no import declaration in class, so it 
has to be imported manually when ever the client is generated.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to