1
votes

I have been doing some reading up on web services programming with Java, Eclipse, etc. and I found one particular example where the person created the web service and client by doing the following:

  1. define the web service java class (interface + impl)
  2. deploy the web service using Endpoint.publish
  3. grab the wsdl from the url of the web service (eg, localhost://greeting?wsdl)
  4. use wsimport to generate stubs
  5. create a client class using generated stubs

Is there another way to generate the wsdl without having to publish the web service and download it? Perhaps a maven plugin to auto-generate wsdl and client stubs?

Update: Rather than creating a new question I am just going to piggyback on this one.

I have created my web service by defining an interface:

@WebService
public interface HelloWorldWs {
    @WebMethod
    public String sayHello(String name);
}

and an impl class:

@WebService(endpointInterface = "com.me.helloworldws.HelloWorldWs")
public class HelloWorldWsImpl implements HelloWorldWs {
    @Override
    @WebMethod
    public String sayHello(String name) {
        return "Hello World Ws, " + name;
    }
}

When I run wsgen I get the following error:

The @javax.jws.WebMethod annotation cannot be used in with @javax.jws.WebService.endpointInterface element.

Eclipse seems to be okay with it.

Any idea why?

Note, I originally did not have the annotation but when I tried to call my webservice I got the following error:

com.me.helloworldws.HelloWorldWsImpl is not an interface
2
I am learning Web Services in java and i am looking for the above example where the person created the web .. bla bla. Can you send me link of that example, it would be very helpful for me to understand the Web Services09Q71AO534

2 Answers

1
votes

The JSR 224 says in 3.1 section:

An SEI is a Java interface that meets all of the following criteria:

  • Any of its methods MAY carry a javax.jws.WebMethod annotation (see 7.11.2).
  • javax.jws.WebMethod if used, MUST NOT have the exclude element set to true.

If the implementation class include the javax.jws.WebMethod, then you cant put @WebMethod(exclude=true) and that in not possible, according to specification.

Depends of custom version of Eclipse, shows a warning for this. e.g. Rational Application Developer for Websphere shows:

JSR-181, 3.1: WebMethod cannot be used with the endpointInterface 
              property of WebService
0
votes

While programming/building a project (with some advanced IDE) normally you should be able to find it between auto-generated stuff - the IDE should generate it. Just check carefully.