View Full Version : M5 ws-handler error
diippi
Aug 6th, 2008, 04:23 PM
I am upgrading from M3 snapshot to M5 for web service target .
This is working fine in the old version.
Here is the config :
<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 :
org.springframework.ws.client.WebServiceTransportE xception: Not Found [404]
at org.springframework.ws.client.core.WebServiceTempl ate.handleError(WebServiceTemplate.java:590)
at org.springframework.ws.client.core.WebServiceTempl ate.doSendAndReceive(WebServiceTemplate.java:514)
at org.springframework.ws.client.core.WebServiceTempl ate.sendAndReceive(WebServiceTemplate.java:465)
at org.springframework.ws.client.core.WebServiceTempl ate.doSendAndReceive(WebServiceTemplate.java:420)
at org.springframework.ws.client.core.WebServiceTempl ate.sendSourceAndReceiveToResult(WebServiceTemplat e.java:366)
at org.springframework.ws.client.core.WebServiceTempl ate.sendSourceAndReceiveToResult(WebServiceTemplat e.java:357)
at org.springframework.integration.ws.handler.SimpleW ebServiceHandler.doHandle(SimpleWebServiceHandler. java:67)
at org.springframework.integration.ws.handler.Abstrac tWebServiceHandler.handle(AbstractWebServiceHandle r.java:74)
at org.springframework.integration.endpoint.HandlerEn dpoint$HandlerInvokingTarget.send(HandlerEndpoint. java:136)
at org.springframework.integration.endpoint.TargetEnd point.handleMessage(TargetEndpoint.java:103)
at org.springframework.integration.endpoint.TargetEnd point.poll(TargetEndpoint.java:111)
at org.springframework.integration.endpoint.EndpointP oller.visitEndpoint(EndpointPoller.java:25)
at org.springframework.integration.endpoint.AbstractE ndpoint.doSend(AbstractEndpoint.java:252)
at org.springframework.integration.endpoint.AbstractE ndpoint.send(AbstractEndpoint.java:225)
at org.springframework.integration.endpoint.AbstractE ndpoint.send(AbstractEndpoint.java:213)
at org.springframework.integration.dispatcher.Abstrac tDispatcher.sendMessageToTarget(AbstractDispatcher .java:74)
at org.springframework.integration.dispatcher.Broadca stingDispatcher.send(BroadcastingDispatcher.java:4 4)
What could be the issue..
Mark Fisher
Aug 6th, 2008, 04:29 PM
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
diippi
Aug 6th, 2008, 04:36 PM
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 ?
Mark Fisher
Aug 6th, 2008, 04:49 PM
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?
diippi
Aug 6th, 2008, 04:59 PM
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 ?
<ws-handler id="holidaycalendar" uri="${holiday.webservice.url}" />
<service-activator input-channel="holidayRequestChannel"
ref="holidaycalendar"/>
Mark Fisher
Aug 6th, 2008, 05:05 PM
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:
<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.
diippi
Aug 7th, 2008, 10:06 AM
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 :
10:53:32,427 DEBUG [WebServiceTemplate] Opening [org.springframework.ws.transport.http.HttpUrlConne ction@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.WebServiceTransportE xception: Not Found [404]
at org.springframework.ws.client.core.WebServiceTempl ate.handleError(WebServiceTemplate.java:590)
at org.springframework.ws.client.core.WebServiceTempl ate.doSendAndReceive(WebServiceTemplate.java:514)
at org.springframework.ws.client.core.WebServiceTempl ate.sendAndReceive(WebServiceTemplate.java:465)
at org.springframework.ws.client.core.WebServiceTempl ate.doSendAndReceive(WebServiceTemplate.java:420)
at org.springframework.ws.client.core.WebServiceTempl ate.sendSourceAndReceiveToResult(WebServiceTemplat e.java:366)
at org.springframework.ws.client.core.WebServiceTempl ate.sendSourceAndReceiveToResult(WebServiceTemplat e.java:357)
at org.springframework.integration.ws.handler.SimpleW ebServiceHandler.doHandle(SimpleWebServiceHandler. java:67)
at org.springframework.integration.ws.handler.Abstrac tWebServiceHandler.handle(AbstractWebServiceHandle r.java:74)
What could be the issue..anything about proxy setup etc that changed ?
Mark Fisher
Aug 7th, 2008, 11:13 AM
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?
diippi
Aug 7th, 2008, 01:53 PM
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 ??
Mark Fisher
Aug 7th, 2008, 02:21 PM
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/11/24/how-to-call-a-webservice-with-spring-ws-through-a-proxy/
Regards,
Mark
diippi
Aug 7th, 2008, 02:40 PM
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.
Mark Fisher
Aug 7th, 2008, 03:01 PM
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).
diippi
Aug 7th, 2008, 03:10 PM
M3 config :
<endpoint input-channel="holidayRequestChannel" handler-ref="magicAdapter"/>
<beans:bean id="magicAdapter" class="org.springframework.integration.ws.adapter.SimpleW ebServiceTargetAdapter">
<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.SaajSoapMessageFa ctory">
<beans:property name="messageFactory">
<beans:bean class="com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessage Factory1_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 :
//Child class
props.put(AbstractWebServiceHandler.SOAP_ACTION_PR OPERTY_KEY, soapAction);
//Parent class
Enumeration<?> iter = props.keys();
while (iter.hasMoreElements())
{
key = (String)iter.nextElement();
header.setProperty(key, props.getProperty(key));
}
Mark Fisher
Aug 7th, 2008, 03:26 PM
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.
diippi
Aug 7th, 2008, 03:46 PM
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 :
<ws-handler id="holidaycalendar"
uri="http://myserver001/SDSServices/WebService/Gfp1.ASMX"
message-factory="messageFactory" />
<beans:bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFa ctory">
<beans:property name="messageFactory">
<beans:bean class="com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessage Factory1_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 .
Mark Fisher
Aug 7th, 2008, 03:54 PM
I will check on that for Spring-WS, but didn't you originally have this issue before upgrading to 1.5.1.A?
If not, can you try to use the same Spring-WS version with the M5 example while also keeping the same <ws-handler/> configuration (including the 'message-factory')? In other words - using everything exactly the same between M3 and M5.
diippi
Aug 7th, 2008, 04:35 PM
Actually it seems i had the issue with the old version i.e 1.5.0 too with SI M5.
Im not sure exactly what is going wrong and where but the main variables is SI M5 .
Mark Fisher
Aug 7th, 2008, 04:54 PM
Do you see the soapAction header on the request WS message in tcpmon?
diippi
Aug 7th, 2008, 05:00 PM
Yes , as follows :
POST http://myserver001/SDSServices/WebService/Gfp1.ASMX HTTP/1.1
Accept-Encoding: gzip
Accept: text/xml, text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
SOAPAction: "http://www.domain.sds.gfp1/GetUSBankHolidays"
Content-Type: text/xml; charset=utf-8
Mark Fisher
Aug 7th, 2008, 05:47 PM
Can you try running the WebServiceDemo in the Spring Integration samples using your M5 environment?
I just did another line-by-line comparison between the M3 ws-target and M5 ws-handler implementations. Indeed, the only variable is the support for setting the messageFactory as a constructor argument. Since you do see the soapAction header, I really don't see any change that could possible produce this.
Are there are *any* other differences at all? Java version, JARs on the classpath, different VM args, etc?
If not, can you paste side-by-side tcpmon results from the M3 and M5 request messages?
diippi
Aug 8th, 2008, 10:19 AM
Yes..I tried the webservice sample provided by SI and it works fine with M5 .
Here are the tcpmon results for :
M3 :
POST http://mcib1smdt001/SDSServices/WebService/Gfp1.ASMX HTTP/1.1
Accept-Encoding: gzip
Accept: text/xml, text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
SOAPAction: "http://www.wachovia.sds.gfp1/GetUSBankHolidays"
Content-Type: text/xml; charset=utf-8
Content-Length: 249
Cache-Control: no-cache
Pragma: no-cache
User-Agent: Java/1.5.0_11
Host: mcib1smdt001
Proxy-Connection: keep-alive
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header/><SOAP-ENV:Body><GetUSBankHolidays xmlns="http://www.wachovia.sds.gfp1/">
<iYear>2008</iYear>
</GetUSBankHolidays></SOAP-ENV:Body></SOAP-ENV:Envelope>
M5:
POST http://mcib1smdt001/SDSServices/WebService/Gfp1.ASMX HTTP/1.1
Accept-Encoding: gzip
Accept: text/xml, text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
SOAPAction: "http://www.wachovia.sds.gfp1/GetUSBankHolidays"
Content-Type: text/xml; charset=utf-8
Content-Length: 249
Cache-Control: no-cache
Pragma: no-cache
User-Agent: Java/1.5.0_11
Host: mcib1smdt001
Proxy-Connection: keep-alive
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header/><SOAP-ENV:Body><GetUSBankHolidays xmlns="http://www.wachovia.sds.gfp1/">
<iYear>2008</iYear>
</GetUSBankHolidays></SOAP-ENV:Body></SOAP-ENV:Envelope>
I dont see any difference in the 2 traces..
diippi
Aug 11th, 2008, 03:11 PM
Strangely this works fine if deployed on Jboss.
But it fails consistently on standalone tests without the tcpmon in between. Any ideas ?
Mark Fisher
Aug 11th, 2008, 04:39 PM
Can you compare the versions of all related JARs in your classpath across these environments?
For example, these are the correct dependencies for M5:
com.sun.xml.messaging.saaj-1.3.0.jar
javax.xml.soap-1.3.0.jar
javax.xml.stream.1.0.1.jar
Powered by vBulletin® Version 4.2.1 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.