WebServiceTransportException: Not Found [404]

帅比萌擦擦* 提交于 2019-12-05 04:46:11

Maybe your URI:

 <bean name="webserviceTemplate"
 class="org.springframework.ws.client.core.WebServiceTemplate">
     <property name="defaultUri" value="http://localhost:8080/mywebservice" />

Check this value:

"http://mylocal:8080/mywebservice"

Here is how I resolved this error:

  1. Declare a SoapActionCallback.
  2. Use this callback in the marshalSendAndReceive() as follows.

    final EightBallResponse response = new EightBallResponse();
    final SoapActionCallback soapActionCallback = new SoapActionCallback("<the operation name as defined in the WSDL>");
    response = (EightBallResponse) getWebServiceTemplate()
        .marshalSendAndReceive(request, soapActionCallback );
    responseString = response.getAnswer().toString();
    

In my case, the solution was to pay attention to the case in the URI. I had it in all lower case, but the webservice was expecting a CamelCase action name.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!