I have simple web service :
I have the same problem. when I don't append "?wsdl" I have soap faylt. how can I avoid this exception?
@WebService
@SOAPBinding(style = Style.RPC)
public interface TimeServer {
@WebMethod
@WebResult(partName = "time_response")
String getTimeAsString();
@WebMethod
@WebResult(partName = "time_response")
long getTimeAsElapsed();
}
and impl:
@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();}
}
I run this web service in Jboss As 7.0.1. Everything works well!
When I open link localhost:8080/project/time?wsdl everything works well - I have wsdl.
but when I don't append "?wsdl" I have exception.
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)
and I have this response from server:
<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>
how can I avoid this exception?
It will be better , if client will see another message, instead of this error response? how can I send another XML when client opens link without "?wsdl"?
thnaks
Webservices won't support HTTP GET. If you enter the service url its directly making a HTTP GET. Thats the reason it responds with the error No such operation
Instead you need to make a SOAP POST to get response from webservice. Write a webservice client for this. You can refer this link for creating webservice clients