我有简单的网络服务:
我也有同样的问题。当我不附加“?wsdl”时,我有肥皂法。我怎样才能避免这个异常?
@WebService
@SOAPBinding(style = Style.RPC)
public interface TimeServer {
@WebMethod
@WebResult(partName = "time_response")
String getTimeAsString();
@WebMethod
@WebResult(partName = "time_response")
long getTimeAsElapsed();
}
并暗示:
@WebService(endpointInterface = "x.y.z.TimeServer")
public class TimeServiceImpl implements TimeServer {
public TimeServiceImpl() {}
@Override
public String getTimeAsString() {return new Date().toString();}
@Override
public long getTimeAsElapsed() {return new Date().getTime();}
}
我在 Jboss As 7.0.1 中运行这个 Web 服务。 一切正常!
当我打开链接localhost:8080/project/time?wsdl 一切正常 -我有 wsdl。
但是当我不附加“?wsdl”时,我有例外。
14:26:58,192 WARNING [org.apache.cxf.phase.PhaseInterceptorChain] (http-localhost-127.0.0.1-8080-1) Interceptor for {http://x.z.y/}HelloWorld has thrown exception, unwinding now: org.apache.cxf.interceptor.Fault: No such operation: null (HTTP GET PATH_INFO: /project/timenull)
at org.apache.cxf.interceptor.URIMappingInterceptor.handleMessage(URIMappingInterceptor.java:88)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
我从服务器收到了这个回复:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>
No such operation: null (HTTP GET PATH_INFO: /soap-service/timenull)
</faultstring>
</soap:Fault>
</soap:Body>
</soap:Envelope>
我怎样才能避免这个异常?
如果客户端会看到另一条消息而不是这个错误响应,那会更好吗?当客户端打开没有“?wsdl”的链接时,如何发送另一个 XML?
感恩