Announcement Announcement Module
Collapse
No announcement yet.
org.springframework.ws.soap.client.SoapFaultClient Exception: Server Error Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • org.springframework.ws.soap.client.SoapFaultClient Exception: Server Error

    Hi,

    I am trying to integrate my webservices using Spring Integration.
    Currently i am using the jaxws and it is working fine.

    This is my wsdl service part:

    Code:
    <wsdl:definitions name="Demo_Rec_Req"
    	targetNamespace="http://demo.com/Demo_Rec" xmlns:p1="http://demo.com/Demo_Rec"
    	xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
    <wsdl:service name="Rec_ReqService">
            <wsdl:port name="Rec_ReqPort" binding="p1:Rec_ReqBinding"
                xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
                <soap:address
                    location="http://localhosturl/Rec_Req"
                    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" />
            </wsdl:port>
        </wsdl:service>
    </wsdl:definitions>
    When i tried integrating it with Spring integration using the following code:
    Code:
    <int:chain input-channel="fahrenheitChannel" output-channel="celsiusChannel">
    		<ws:outbound-gateway id="webserviceGateway"
    			uri="http://localhosturl/Rec_Req"
    			message-sender="httpMessageSender"  />
    	</int:chain>
    
    	<stream:stdout-channel-adapter id="celsiusChannel" />
    Test class code:
    Code:
    public static void main(String[] args)
    	{
    		try
    		{
    			FileSystemXmlApplicationContext context = new FileSystemXmlApplicationContext(
    					"/WebContent/WEB-INF/config/spring/test/temperatureConversion.xml");
    			ChannelResolver channelResolver = new BeanFactoryChannelResolver(context);
    
    			String request = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">"
    					+ "<soapenv:Header/><soapenv:Body><Rec_SOAP_Req><code>5455454073</code> <division>1099</division>"
    					+ "</Rec_SOAP_Req></soapenv:Body></soapenv:Envelope>";
    
    			
    			Message<String> message = MessageBuilder.withPayload(request).build();
    
    			
    			MessageChannel channel = channelResolver.resolveChannelName("fahrenheitChannel");
    			channel.send(message);
    		}
    		catch (SoapFaultClientException e)
    		{
    			System.out.println("here in SoapFaultClientException  " + e.getFaultStringOrReason() + "   =====   " + e.getFaultCode());
    		}
    
    		catch (Exception e)
    		{
    
    			e.printStackTrace();
    			System.out.println("here in exception  " + e.getMessage());
    		}
    I got the following error:

    Code:
    org.springframework.integration.MessageHandlingException: error occurred in message handler [org.springframework.integration.ws.SimpleWebServiceOutboundGateway#62c09554]
    here in exception  error occurred in message handler [org.springframework.integration.ws.SimpleWebServiceOutboundGateway#62c09554]
    	at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:84)
    	at org.springframework.integration.handler.MessageHandlerChain$1.send(MessageHandlerChain.java:150)
    	at org.springframework.integration.core.MessagingTemplate.doSend(MessagingTemplate.java:288)
    	at org.springframework.integration.core.MessagingTemplate.send(MessagingTemplate.java:149)
    	at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.sendMessage(AbstractReplyProducingMessageHandler.java:176)
    	at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.sendReplyMessage(AbstractReplyProducingMessageHandler.java:160)
    	at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.produceReply(AbstractReplyProducingMessageHandler.java:125)
    	at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleResult(AbstractReplyProducingMessageHandler.java:119)
    	at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:101)
    	at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:78)
    	at org.springframework.integration.handler.MessageHandlerChain.handleMessageInternal(MessageHandlerChain.java:133)
    	at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:78)
    	at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:110)
    	at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:97)
    	at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:44)
    	at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:157)
    	at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:128)
    	at com.test.WebserviceTest.main(WebserviceTest.java:43)
    Caused by: org.springframework.ws.soap.client.SoapFaultClientException: Server Error
    	at org.springframework.ws.soap.client.core.SoapFaultMessageResolver.resolveFault(SoapFaultMessageResolver.java:37)
    	at org.springframework.ws.client.core.WebServiceTemplate.handleFault(WebServiceTemplate.java:733)
    	at org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:559)
    	at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:496)
    	at org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:451)
    	at org.springframework.ws.client.core.WebServiceTemplate.sendSourceAndReceiveToResult(WebServiceTemplate.java:395)
    	at org.springframework.ws.client.core.WebServiceTemplate.sendSourceAndReceiveToResult(WebServiceTemplate.java:386)
    	at org.springframework.integration.ws.SimpleWebServiceOutboundGateway.doHandle(SimpleWebServiceOutboundGateway.java:69)
    	at org.springframework.integration.ws.AbstractWebServiceOutboundGateway.handleRequestMessage(AbstractWebServiceOutboundGateway.java:104)
    	at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:98)
    	at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:78)
    	... 17 more
    Where am i going wrong.
    Please help.
    Thanks in advance...
    Regards,
    Annuk

  • #2
    Caused by: org.springframework.ws.soap.client.SoapFaultClient Exception: Server Error
    Looks like your web service doesn't like the request.

    BTW, while not related to your problem, it's not best practice to expose the messaging infrastructure to your client. Much better to use a messaging gateway...

    Code:
    <int:gateway service-interface="foo.Gateway" default-request-channel="fahrenheitChannel" />
    
    public interface Gateway {
         String sendAndReceive(String request);
    }
    Code:
    String request = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">"
    		+ "<soapenv:Header/><soapenv:Body><Rec_SOAP_Req><code>5455454073</code> <division>1099</division>"
    		+ "</Rec_SOAP_Req></soapenv:Body></soapenv:Envelope>";
    
    String result = myGateway.sendAndReceive(request);

    Comment


    • #3
      Hi Gary,

      Thanks for your reply..
      Yes u were right my webservice dint like the request.
      Changed the request to the <wsdl:message name="Rec_SOAP_Req"> tag present in wsdl.
      So my new request is:

      String request = "<Rec_SOAP_Req><code>5455454073</code> <division>1099</division>"
      + "</Rec_SOAP_Req>";


      Regarding your suggestion of not exposing the messaging infrastructure to the client.I followed it too.
      I removed the messaging template code from my class and passed the message to a messageChannel which became the request-channel for my ws-outboundgateway.

      Thanks for your reply and suggestion.
      It helped.
      Regards,
      Annuk

      Comment

      Working...
      X