tags:

views:

558

answers:

2

Hi guys

I'm currently using Eclipse 3.6 (Helios). I have tried using Ant wsgen task but that doesn't exist on Ant (what am I missing?)

I want to generate a Web Service WSDL from the following sample code:

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;

/**
 * @author Let's keep this private for now :p
 * @since 19 July 2010
 *
 */
@WebService(name="SampleWS")
@SOAPBinding 
(
        style = SOAPBinding.Style.DOCUMENT,
        use = SOAPBinding.Use.LITERAL,
        parameterStyle = SOAPBinding.ParameterStyle.WRAPPED
)
public class SampleWSImpl implements SampleWS {

    private static String userName;

    /* (non-Javadoc)
     * @see SampleWS#setUserName(java.lang.String)
     */
    @WebMethod
    @Override
    public void setUserName(@WebParam(name="userName") String userName) {
        // TODO Auto-generated method stub
        this.userName = userName;

    }

    /* (non-Javadoc)
     * @see SampleWS#getUserName()
     */
    @WebMethod
    @Override
    public String getUserName() {
        // TODO Auto-generated method stub
        return userName;
    }
}

Using Eclipse Axis 1.4 Web Service generator, it works fine. However, I want to get away from using Axis 1 completely.

Thanks in advance.

PPS* How do I setup Eclipse to use Axis2?

+1  A: 

I haven't tried this in Helios, but I know some of the earlier Eclipse versions did not have the ability to generate JAX-WS artifacts.

As I recall, the SoapUI plugin can generate these artifacts, but I've never used it. You can find SoapUI on the Eclipse Marketplace (Help -> Eclipse Marketplace...).

Incidentally, Apache does make CXF, a JAX-WS/JAX-RS stack, in addition to the older Axis/Axis 2 products.

R. Bemrose
The thing that works well is Apache CXF on top of the Axis2.
The Elite Gentleman
A: 

What I did was this,

I configured Axis 2 on Eclipse as well as Apache CXF 2.9. This way, you can use JEE (java 5 or higher) Web Service annotations to generate Web Services.

Bear in mind that Apache CXF supports up to WSDL 1.2 while Apache 2 (the latest release of time of writing, 2.5.1) supports up to WSDL 2.0

Hope this helps someone else.

The Elite Gentleman