【发布时间】:2015-05-13 14:27:32
【问题描述】:
我想知道如何处理这种情况。 我所做的是我遵循了教程http://www.mkyong.com/webservices/jax-ws/deploy-jax-ws-web-services-on-tomcat-ssl-connection/ 创建一个类似的安全网络服务,我能够实现它,但我有一个错误,
ml.ws.api.server.InstanceResolver.createNewInstance(InstanceResolver.java:222) 在 com.sun.xml.ws.api.server.InstanceResolver.createDefault(InstanceResolver.java:184) 在 com.sun.xml.ws.server.EndpointFactory.create(EndpointFactory.java:209)
错误是因为我正在实例化 web 服务,例如,从这个例子中 HelloWorldImpl 类有一个带有参数的构造函数来设置类的参数。 我了解,Jax-ws Web 服务中只能使用默认构造函数,但在这种情况下,我想知道如何处理?
说喜欢
package com.mkyong.ws;
import javax.jws.WebService;
//Service Implementation Bean
@WebService(endpointInterface = "com.mkyong.ws.HelloWorld")
public class HelloWorldImpl implements HelloWorld{
private ABC abc;
public HelloWorldImpl (ABC abc)
{
this.abc = abc;
}
@Override
public String getHelloWorldAsString() {
return "Hello World JAX-WS";
}
// and i use this abc in one of the methods
}
【问题讨论】:
-
你能告诉我们什么将调用这个构造函数,你将如何为它提供 abc 实例?
标签: java web-services tomcat