Web Service exception - link without "?wsdl", HTTP GET PATH_INFO

7.7k Views Asked by At

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

2

There are 2 best solutions below

4
On BEST ANSWER

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

0
On

@grep I see this post as bit old, but still will try to answer if anyone else with similar problem is able to. Well, I had the same issue and wondered what were the reasons behind those. here are the two steps that i tried and fixed up the issue. make sure you are able to access the wsdl in browser.

  1. Close the SOAPUI, delete the soapui_workspace.xml created in user folder under C:/users.
  2. Restart the Soap_ui and open up preferences>Proxy setting.
  3. Change from automatic to None.
  4. Create new project. This did solved my issue and got the response from webservice in SOAPUI.

    Secondly, in this case, make sure you have deployed the webservice correctly as mentioned by @Dinal.