1

I have a client which sends request to my cxf jax-ws web service as "GET" instead of "POST"

According to this answer link Webservice having "No such operation: HTTP GET PATH_INFO", it should be "POST". I have searched for how to set the HTTP-Method as "POST" in cxf but couldn't get much help. I found there is a constant string HTTP_REQUEST_METHOD in Message class but couldn't find any information on how to use it. Please help.

Here is the stack trace:

ID: 4
Address: http://localhost/ws/services/NTServiceHttpSoapEndpoint
Http-Method: GET
Content-Type: 
Headers: {Accept=[text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2], cache-control=[no-cache], connection=[keep-alive], Content-Type=[null], host=[10.19.9.80:8080], pragma=[no-cache], user-agent=[Java/1.7.0_10]}
--------------------------------------

> Jul 22, 2016 9:15:58 PM org.apache.cxf.phase.PhaseInterceptorChain
> doDefaultLogging WARNING: Interceptor for
> {http://example.com/wsdl/service/nm/triggering/v3_0}NTriggeringService
> has thrown exception, unwinding now org.apache.cxf.interceptor.Fault:
> No such operation:  (HTTP GET PATH_INFO:
> /ws/services/NotificationManagerTriggeringServiceHttpSoapEndpoint)    at
> org.apache.cxf.interceptor.URIMappingInterceptor.handleMessage(URIMappingInterceptor.java:93)
>   at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
>   at
> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
>   at
> org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:237)
>   at
> org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:239)
>   at
> org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:213)
>   at
> org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:131)
>   at
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:266)
>   at
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:191)
>   at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)     at
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:242)
>   at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
>   at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
>   at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
>   at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
>   at
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
>   at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
>   at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
>   at
> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
>   at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
>   at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:395)
>   at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:250)
>   at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
>   at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:166)
>   at
> org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
>   at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>   at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>   at java.lang.Thread.run(Thread.java:745)

Jul 22, 2016 9:15:58 PM org.apache.cxf.services.NotificationManagerTriggeringService.NotificationManagerTriggeringServiceHttpSoapEndpoint.NotificationManagerTriggeringServicePortType
INFO: Outbound Message
---------------------------
ID: 4
Response-Code: 500
Encoding: UTF-8
Content-Type: text/xml
Headers: {}
Payload: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>No such operation:  (HTTP GET PATH_INFO: /ws/services/NTHttpSoapEndpoint)</faultstring></soap:Fault></soap:Body></soap:Envelope>
--------------------------------------
Community
  • 1
  • 1
Amit Sinha
  • 11
  • 3

1 Answers1

0

Recently I encountered the very same issue. Encountered error was:

Caused by: javax.wsdl.WSDLException: WSDLException: faultCode=PARSER_ERROR: Problem parsing 'http://172.22.2.7/enmac/SOAP'.: java.io.IOException: Server returned HTTP response code: 405 for URL: http://172.22.2.7/enmac/SOAP

It also showed error like "Get method not allowed"

Reason for the issue: SOAP always work with HTTP/S over POST request. When we send SOAP request from SOAP UI it automatically binds request to Post request. Hence somehow the application code was binding request to Get. So, there was a problem in the way Web Service Client was created.

Resolution: Initially, I called client Web Service using given below code:

Incident ss = new Incident(wsdlURL, SERVICE_NAME); IncidentSoap port = ss.getIncidentSoap()

This was creating problem. The resolution is creating Web Service instance using org.apache.cxf.jaxws.JaxWsProxyFactoryBean. Apache CXF also generated a client beans xml with given below content:

Hence, I used this spring managed client object and BINGO, it worked. I believe when we create web service instance in this manner, then it takes care of HTTP binding and all.

Best Regards Hitesh

Hitesh
  • 703
  • 1
  • 9
  • 14
  • Are you aware that you can [edit] your post instead of deleting and reposting? – Yunnosch May 05 '21 at 05:35
  • I think you could shrink the problem statement and simply focus on answering the problem stated at the top of this page. – Yunnosch May 05 '21 at 05:37
  • @Yunnosch. I deleted the post by mistake. Yes, I am aware of the fact that one can edit the post – Hitesh May 06 '21 at 07:23
  • @Yunnosch, I provided the complete problem statement to give more clarity. Anyways, I have shrunk the content as suggested – Hitesh May 06 '21 at 07:24
  • You should also be able to undelete posts which you have deleted yourself. (Possibly not posts which were deleted by others.) – Yunnosch May 06 '21 at 07:27