求助:webservice 启动报接口错误 50
本机用两个eclipse启动了webservice的服务端和客户端!客户端是用wsdl2java自动生成的当执行到java.lang.String_sayHello__r...
本机用两个eclipse 启动了webservice的服务端和客户端!客户端是用wsdl2java自动生成的 当执行到java.lang.String _sayHello__return = port.sayHello(_sayHello_arg0);(简单的helloword例子)时控制台报了如下的错误:
Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Could not instantiate service class test.HelloWorld because it is an interface.
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:160)
at com.sun.proxy.$Proxy35.sayHello(Unknown Source)
at WsImpl.HelloWorld_HelloWorldPort_Client.main(HelloWorld_HelloWorldPort_Client.java:56)
Caused by: org.apache.cxf.binding.soap.SoapFault: Could not instantiate service class test.HelloWorld because it is an interface.
at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.unmarshalFault(Soap11FaultInInterceptor.java:86)
----------------------------------------------------------------------------------------------------------
一下是接口和实现类的代码:
import javax.jws.WebService;
@WebService
public interface HelloWorld
{
public String sayHello(String name);
}
------
import javax.jws.WebService;
import test.HelloWorld;
@WebService(endpointInterface="test.HelloWorld",serviceName="HelloWorldWebService")
public class HelloWorldImpl implements HelloWorld
{
@Override
public String sayHello(String name)
{
System.out.println("sayHello方法被调用");
return ("Hello"+name);
}
}
真不知道哪里的错误,请高手不吝赐教!50分不要嫌少 展开
Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Could not instantiate service class test.HelloWorld because it is an interface.
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:160)
at com.sun.proxy.$Proxy35.sayHello(Unknown Source)
at WsImpl.HelloWorld_HelloWorldPort_Client.main(HelloWorld_HelloWorldPort_Client.java:56)
Caused by: org.apache.cxf.binding.soap.SoapFault: Could not instantiate service class test.HelloWorld because it is an interface.
at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.unmarshalFault(Soap11FaultInInterceptor.java:86)
----------------------------------------------------------------------------------------------------------
一下是接口和实现类的代码:
import javax.jws.WebService;
@WebService
public interface HelloWorld
{
public String sayHello(String name);
}
------
import javax.jws.WebService;
import test.HelloWorld;
@WebService(endpointInterface="test.HelloWorld",serviceName="HelloWorldWebService")
public class HelloWorldImpl implements HelloWorld
{
@Override
public String sayHello(String name)
{
System.out.println("sayHello方法被调用");
return ("Hello"+name);
}
}
真不知道哪里的错误,请高手不吝赐教!50分不要嫌少 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询