Announcement Announcement Module
Collapse
No announcement yet.
M5 ws-handler error Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • M5 ws-handler error

    I am upgrading from M3 snapshot to M5 for web service target .
    This is working fine in the old version.
    Here is the config :

    Code:
    <ws-handler id="holidaycalendar" uri="${holiday.webservice.url}" />
    
    <service-activator input-channel="holidayRequestChannel"
    	          ref="holidaycalendar"/>
    Is this config correct ? I didnt see any concrete example of ws-handler in the docs.

    I see the following exception :

    Code:
    org.springframework.ws.client.WebServiceTransportException: Not Found [404]
    	at org.springframework.ws.client.core.WebServiceTemplate.handleError(WebServiceTemplate.java:590)
    	at org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:514)
    	at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:465)
    	at org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:420)
    	at org.springframework.ws.client.core.WebServiceTemplate.sendSourceAndReceiveToResult(WebServiceTemplate.java:366)
    	at org.springframework.ws.client.core.WebServiceTemplate.sendSourceAndReceiveToResult(WebServiceTemplate.java:357)
    	at org.springframework.integration.ws.handler.SimpleWebServiceHandler.doHandle(SimpleWebServiceHandler.java:67)
    	at org.springframework.integration.ws.handler.AbstractWebServiceHandler.handle(AbstractWebServiceHandler.java:74)
    	at org.springframework.integration.endpoint.HandlerEndpoint$HandlerInvokingTarget.send(HandlerEndpoint.java:136)
    	at org.springframework.integration.endpoint.TargetEndpoint.handleMessage(TargetEndpoint.java:103)
    	at org.springframework.integration.endpoint.TargetEndpoint.poll(TargetEndpoint.java:111)
    	at org.springframework.integration.endpoint.EndpointPoller.visitEndpoint(EndpointPoller.java:25)
    	at org.springframework.integration.endpoint.AbstractEndpoint.doSend(AbstractEndpoint.java:252)
    	at org.springframework.integration.endpoint.AbstractEndpoint.send(AbstractEndpoint.java:225)
    	at org.springframework.integration.endpoint.AbstractEndpoint.send(AbstractEndpoint.java:213)
    	at org.springframework.integration.dispatcher.AbstractDispatcher.sendMessageToTarget(AbstractDispatcher.java:74)
    	at org.springframework.integration.dispatcher.BroadcastingDispatcher.send(BroadcastingDispatcher.java:44)
    What could be the issue..

  • #2
    Based on that stack trace, it actually appears to be working correctly, but you are receiving a 404 (not found). Can you double check that the URL you are passing is reachable?

    -Mark

    Comment


    • #3
      Yes..it is..
      It also works fine with the M3 snapshot version and ws-target config.

      I have SI M5 and Spring 1.5.3 .
      Do I need to upgrade to Spring 1.5.4A and Spring-WS 1.5.1.A for this to work ?

      Comment


      • #4
        With Spring Integration M5, you should be using the following versions:
        Spring Framework: 2.5.4.A
        Spring Web Services: 1.5.1.A

        Please try those versions. However, the stack trace does show the correct series of methods being invoked and a 404 being received. Are there any other differences at all between your M3 version and this one? Are they pointing to the same properties file for that property placeholder you are using for the URL?

        Comment


        • #5
          We are wary of using intermediate versions i.e 1.5.4A etc and were hoping that M5 would be backward compatible with Spring 1.5.3 that we were using.

          Also.. no..there is no other difference in the other 2 versions that I can see and the property is fine as I had tried with the actual value in the uri too with the same error.

          One thing I would like is to have the config rechecked by you , as I dont see any example of the ws-handler (the one in Ref includes channel element which is actually not allowed in the ws-handler definition)

          Am I using the service-activator appropriately ?

          Code:
          <ws-handler id="holidaycalendar" uri="${holiday.webservice.url}" />
          <service-activator input-channel="holidayRequestChannel"
          	          ref="holidaycalendar"/>

          Comment


          • #6
            Spring 2.5.4.A is not an intermediate version (nor Spring-WS 1.5.1.A). To understand the meaning of the 'A' there, please read this entry from the SpringSource Enterprise Bundle Repository FAQ: https://www.springsource.com/repository/app/faq#q12

            The WebServiceDemo in the Spring Integration samples provides a working example of the ws-handler element. You can check it out in the org.springframework.integration.samples JAR file (and the associated 'sources' JAR), but here is the configuration:
            Code:
            <beans:beans xmlns="http://www.springframework.org/schema/integration"
            	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            	xmlns:beans="http://www.springframework.org/schema/beans"
            	xsi:schemaLocation="http://www.springframework.org/schema/beans
            			http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
            			http://www.springframework.org/schema/integration
            			http://www.springframework.org/schema/integration/spring-integration-ws-1.0.xsd">
            
            	<message-bus/>
            
            	<channel id="fahrenheitChannel"/>
            
            	<!-- The service activator receives from the 'fahrenheitChannel',
            	     invokes the handler, and sends the reply Message to the 'celsiusChannel'. -->
            	<service-activator input-channel="fahrenheitChannel"
            	                   ref="temperatureConverter"
            	                   output-channel="celsiusChannel"/>
            
            	<!-- The handler invokes the WebService for the given URI and returns a reply Message. -->
            	<ws-handler id="temperatureConverter" 
            				uri="http://www.w3schools.com/webservices/tempconvert.asmx"/>
            
            	<!-- The response from the service is logged to the console. -->
            	<channel-adapter id="celsiusChannel" target="console"/>
            
            	<console-target id="console"/>
            
            </beans:beans>
            Are you providing a 'returnAddress' on the Message that you are sending to the ws-handler? If not, you probably want to specify an "output-channel" attribute.

            Comment


            • #7
              I tried with the Spring 1.5.4.A and spring -ws 1.5.1.A and still see the same issues. Has anything changed in the underlying implementation of WebServiceTemplate class ? I upped the log level and see the following now :
              Code:
              10:53:32,427 DEBUG [WebServiceTemplate] Opening [org.springframework.ws.transport.http.HttpUrlConnection@3e0339] to [http://myserver001/SDSServices/WebService/Gfp1.ASMX]
              10:53:32,521 DEBUG [sent] Sent request [SaajSoapMessage {http://www.my.sds.gfp1/}GetUSBankHolidays]
              10:53:33,411 DEBUG [WebServiceTemplate] Received error for request [SaajSoapMessage {http://www.my.sds.gfp1/}GetUSBankHolidays]
              10:53:33,411 WARN  [MessagePublishingErrorHandler] failure occurred in messaging task
              org.springframework.ws.client.WebServiceTransportException: Not Found [404]
              	at org.springframework.ws.client.core.WebServiceTemplate.handleError(WebServiceTemplate.java:590)
              	at org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:514)
              	at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:465)
              	at org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:420)
              	at org.springframework.ws.client.core.WebServiceTemplate.sendSourceAndReceiveToResult(WebServiceTemplate.java:366)
              	at org.springframework.ws.client.core.WebServiceTemplate.sendSourceAndReceiveToResult(WebServiceTemplate.java:357)
              	at org.springframework.integration.ws.handler.SimpleWebServiceHandler.doHandle(SimpleWebServiceHandler.java:67)
              	at org.springframework.integration.ws.handler.AbstractWebServiceHandler.handle(AbstractWebServiceHandler.java:74)
              What could be the issue..anything about proxy setup etc that changed ?

              Comment


              • #8
                The *only* change in the M5 version involves the configuration of the WebService MessageFactory. Please refer to these two issues for the details:
                http://jira.springframework.org/browse/INT-291
                http://jira.springframework.org/browse/INT-295

                If you need to set the messageFactory, the namespace now supports it. You can add the "message-factory" attribute to your <ws-handler/> element.

                Can you please provide the configuration for your working M3 version of the <ws-target/> element?

                Comment


                • #9
                  I got it working now, but in a very weird way .. I was trying to intercept the webservice request through tcpmon and when I have
                  -DproxySet=true -Dhttp.proxyHost=127.0.0.1 -Dhttp.proxyPort=8988
                  it apparently works fine, No 404 , rather a valid response back.

                  If I remove the above system properties , it reverts back to 404.

                  It seems like when it goes through the proxy , it is routed correctly, but going through pure spring webservice it sees some issues..

                  Any explanation of this behavior ??

                  Comment


                  • #10
                    If you are running in an environment that requires a proxy configuration, then those system properties need to be provided. This is not directly related to either Spring Integration or Spring WS but rather the underlying java.net.HttpURLConnection (delegated to by Spring Web Services' default message sender strategy). No changes in Spring Integration or Spring Web Services versions would have affected this, so it seems to be an environmental difference. Are you running the M3 and M5 versions in exactly the same environment and from the same machine with exactly the same URL? Perhaps the run target/startup script for the M3 version already had these -D arguments specified? Any other differences?

                    On a related note, you might find this article informative:
                    http://gleichmann.wordpress.com/2007...rough-a-proxy/

                    Regards,
                    Mark

                    Comment


                    • #11
                      The proxy I mentioned is not a firewall proxy, rather a tcpmon proxy.
                      And yes, the M3 snapshot ran fine without the proxy setup on the same url and the same machine.

                      Comment


                      • #12
                        Does the Web Service you are invoking require a SoapAction header? If so, can you provide the relevant code/configuration where you are setting the header on the Message? Also, please do provide the M3 configuration excerpt for the <ws-target/> so that I can compare it to the M5 <ws-handler/> that you provided earlier.

                        Finally, as I mentioned above, the only change between M3 and M5 is related to the WebServiceMessageFactory. Are you providing the messageFactory in your configuration, or are you relying on the default? (I don't see it in your M5 example, but I haven't seen your M3 configuration yet).

                        Comment


                        • #13
                          M3 config :
                          Code:
                          <endpoint input-channel="holidayRequestChannel"           handler-ref="magicAdapter"/>
                          	
                          <beans:bean id="magicAdapter" class="org.springframework.integration.ws.adapter.SimpleWebServiceTargetAdapter">
                          <beans:constructor-arg value="${holiday.webservice.url}"/>
                          <beans:property name="messageFactory" ref="messageFactory"/>
                          	</beans:bean>
                          
                          <beans:bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory">
                               	<beans:property name="messageFactory">
                          	<beans:bean class="com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl"></beans:bean>
                                  </beans:property>
                              </beans:bean>
                          I do want to use the messageFactory config but I have not added that in the config yet <it works on standalone as is, issue is in Jboss , but im testing standalone right now>

                          And yes, there is a soap action to be set which I mimicked from your WebService sample , i.e :
                          Code:
                          //Child class
                          props.put(AbstractWebServiceHandler.SOAP_ACTION_PROPERTY_KEY, soapAction);
                          
                          //Parent class
                          Enumeration<?> iter = props.keys();
                          
                          while (iter.hasMoreElements())
                          {
                          key = (String)iter.nextElement();
                          header.setProperty(key, props.getProperty(key));
                          }

                          Comment


                          • #14
                            Can you verify (or have you already) that the M3 version does actually work after removing the messageFactory configuration there? Also, can you try adding that same configuration to the M5 version (in M5, there is a "message-factory" attribute for specifying the reference on the <ws-handler/> element). I would just like to know what happens after removing all differences between your 2 versions. As I mentioned, there have been no code changes for the WebService target/handler itself other than the ability to set the messageFactory via the WebServiceTemplate constructor. Therefore, I don't think a change in Spring Integration is causing this. My hypothesis is that it is related to SAAJ handling of headers.

                            Comment


                            • #15
                              For M3 :

                              Yes , it was working fine without messageFactory in standalone environment , but we added the bean definition and messageFactory for JBoss setup.

                              For M5 :

                              I just added the messageFactory config as follows :
                              Code:
                              <ws-handler id="holidaycalendar" 
                              	uri="http://myserver001/SDSServices/WebService/Gfp1.ASMX" 
                              	message-factory="messageFactory" /> 
                              <beans:bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory">
                                    	<beans:property name="messageFactory">
                                  	<beans:bean class="com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl"></beans:bean>
                                      </beans:property>
                                  </beans:bean>
                              It still works as before , i.e with the properties set , and gives a 404 without those.

                              I dont think its Spring Integration either, but maybe Spring web service since we upgraded it to 1.5.1.A .

                              Comment

                              Working...
                              X