我使用JAX-WS API创建了一个WebService。使用Endpoint类时,此服务运行没有任何问题。

main(String args[])
{
(...)
MyService service=new MyService();
service.setParam1("limit=100");
service.setParam2("hello");
service.setParam3("max-value=10");
Endpoint endpoint = Endpoint.create(service);
endpoint.publish("http://localhost:8090/ws");
(...)
}

现在,我想在glassfish中部署这项服务。但是,正如我在我的示例中所写,我想用一些参数初始化我的服务。我怎样才能做到这一点?我应该使用其他API吗?

非常感谢提前

有帮助吗?

解决方案

好的,我终于找到了答案:使用 javax.xml.ws.WebServiceContext 是解决方案。请看其他答案如何从JAX-WS Web服务中访问ServletContext?

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top