[英]Publish Jax-WS Webservice under specified Path
I am working on a SOAP Web Service in an Glassfish 4 application server. 我正在使用Glassfish 4应用程序服务器中的SOAP Web服务。 The SOAP service itself is working, but I want to publish it under a specified context or path.
SOAP服务本身正在运行,但是我想在指定的上下文或路径下发布它。 But I can't find any solution how to do this.
但是我找不到任何解决方案。
This is my service: 这是我的服务:
@WebService(
serviceName = "HelloPersonService",
targetNamespace = "http://example.nl/hellopersonservice/1.0",
portName = "HelloPersonServicePort",
wsdlLocation = "WEB-INF/wsdl/my.wsdl",
endpointInterface="my.HelloPersonServicePortType")
public class HelloPersonServiceImpl
implements HelloPersonServicePortType {
@Override
public HelloPersonServiceResponseType greetPerson(HelloPersonServiceRequestType helloPersonServiceRequest) {
return null;
}
}
In the moment the service is available under this url: 目前,该服务可在以下URL下使用:
/webservice/HelloPersonService
but I want to move it to: 但我想将其移至:
/webservice/collection/HelloPersonService
Do you know how to do this? 你知道怎么做吗?
Thank you very much, arres 非常感谢,亲爱的
I could finally manage it to configure the path for the webservice. 我最终可以管理它来配置Web服务的路径。 This is possible by adding a jax-ws deploymentdescriptor "sun-jaxws.xml".
这可以通过添加jax-ws部署描述符“ sun-jaxws.xml”来实现。
There it is possible to add a parameter called "url-pattern" for each service. 可以为每个服务添加一个名为“ url-pattern”的参数。
@Dubas thank you for your help. @Dubas谢谢您的帮助。 your hint pointed into the right direction.
您的提示指向正确的方向。
If you are using JAX-WS servlet change the servlet path to point the desired path. 如果使用的是JAX-WS servlet,请更改servlet路径以指向所需的路径。
If you are using automatic JAX-WS generation (like Websphere 7) you should try changing the serviceName = "HelloPersonService" to serviceName = "collection/HelloPersonService" 如果使用的是自动生成JAX-WS(例如Websphere 7),则应尝试将serviceName =“ HelloPersonService”更改为serviceName =“ collection / HelloPersonService”
More information about servlet : Change JAX-WS Service URL 有关servlet的更多信息: 更改JAX-WS服务URL
In your publisher class, you can change your published endpoint URL as per your requirement. 在您的发布者类中,您可以根据需要更改发布的端点URL。
Endpoint.publish("http://localhost:8888/webservice/HelloPersonService", new HelloPersonServiceImpl());
Endpoint.publish("http://localhost:8888/webservice/collection/HelloPersonService", new HelloPersonServiceImpl());
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.