简体   繁体   English

EJB WebService(JAX-WS)的WSDL的URL是什么?

[英]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). 部署应用程序后,WebService将在应用程序服务器(例如WebSphere)中公开。 Then what is the URL of WSDL, where other applications can find my service? 那么WSDL的URL是什么,其他应用程序可以在其中找到我的服务?

The URL of your WSDL on the server should be in the following format: 服务器上WSDL的URL应采用以下格式:

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. 但这是在以下假设下运行的:您的sun-jaxws.xml文件中的endpoint实体的url-pattern属性使用与Web服务类相同的名称。

Just a hint to the first answer/URL, 只是第一个答案/ URL的提示,

In some cases the "context Root" get excluded from the webservice url after deployment. 在某些情况下,“上下文根”会在部署后从Web服务URL中排除。

I can't say for other application servers but for WebLogic and EJB web service URL follow the following default pattern: 对于其他应用程序服务器,我不能说,但是对于WebLogic和EJB Web服务URL,请遵循以下默认模式:

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

where 'className' is the simple name of the Java class implementing the web service. 其中,“ className”是实现Web服务的Java类的简单名称。

You can easily override the end of the URL by setting the serviceName attribute in the @WebService annotation. 通过在@WebService批注中设置serviceName属性,可以轻松地覆盖URL的末尾。 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). 如果需要更改根上下文,则必须将Web服务打包为嵌入EAR的EJB jar,并使用WebLogic特定的部署描述符(我将不惜一切代价避免使用)。

Hope it helps :) 希望能帮助到你 :)

you need to publish it, You can have a Publisher class like this: 您需要发布它,您可以拥有一个Publisher类,如下所示:

 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());

    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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