简体   繁体   中英

What is URL of WSDL of EJB WebService (JAX-WS)?

As far as I understood, you can introduce:

@Stateless
@WebService
public class MyWebServiceEndpoint {

@Inject SomeBean aBean;

  @WebMethod
  public String getSomething() {
     return "something";
  }
}

and when application deployed, the WebService is exposed in the Application Server (such as WebSphere). Then what is the URL of WSDL, where other applications can find my service?

The URL of your WSDL on the server should be in the following format:

http://hostname:port/contextRoot/MyWebServiceEndpoint?WSDL

But this is running under the assumption that the url-pattern attribute of the endpoint entity in your sun-jaxws.xml file uses the same name as your web service class.

Just a hint to the first answer/URL,

In some cases the "context Root" get excluded from the webservice url after deployment.

I can't say for other application servers but for WebLogic and EJB web service URL follow the following default pattern:

http://host:port/ 'className'/'className'+Service

where 'className' is the simple name of the Java class implementing the web service.

You can easily override the end of the URL by setting the serviceName attribute in the @WebService annotation. If you need to change the root context you must package your web service as an EJB jar embedded in an EAR and use the WebLogic specific deployement descriptor (which I would avoid at all costs).

Hope it helps :)

you need to publish it, You can have a Publisher class like this:

 import javax.xml.ws.Endpoint;

//Endpoint publisher
public class Publisher {

    public static void main(String[] args) {

 Endpoint.publish("http://localhost:9999/webserv/Test", new FilenetWebService());

    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM