[SWS-440] WebServiceTemplate still creates a connection even if a ClientInterceptor sets a Response Created: 23/Oct/08  Updated: 04/May/12  Resolved: 27/Jan/09

Status: Closed
Project: Spring Web Services
Component/s: Core
Affects Version/s: 1.5.4
Fix Version/s: 1.5.6

Type: Bug Priority: Minor
Reporter: Hans-Peter Störr Assignee: Arjen Poutsma
Resolution: Won't Fix Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SWS-263 Provide xml based Mock for Web Services Closed

 Description   

Problem: When a response is set on the messagecontext by a ClientInterceptor.handleRequest, an actual connection to the webservice is still created and the Webservice is actually accessed in hasError or hasFault. I would expect that the WebServiceTemplate would not even create a connection in this case.

Background: I tried to write a ClientInterceptor for the WebServiceTemplate that simulates an actual webservice call during a selftest of the system. ClientInterceptor.hasRequest checks whether this is during a selftest and sets the response on the MessageContext and the other system should never be contacted at all.

Possible Solutions:

  • As a quick fix one could extend the first if(messageContext.hasResponse() ) in WebServiceTemplate.doSendAndReceive(MessageContext, ...) to the hasError check, since this check does not make much sense if the response was not sent, does it? 8-)
  • Even if this quick fix is done, MessageContext.createConnection is still called, which does not seem appropriate to me. Perhaps this should be done only later, after the interceptors have been called?


 Comments   
Comment by Arjen Poutsma [ 16/Dec/08 ]

SWS-263 seems related to what you're trying to do.

That said, the connection should not be opened. I will fix.

Comment by Arjen Poutsma [ 27/Jan/09 ]

I tried fixing this without breaking backwards compatibility and also make sure that all the various other transports and callbacks kept working, but couldn't. So I am resolving this as Won't Fix, unfortunately.

Overall, taking the route of a Mock Transport (SWS-263) for doing integration tests on web services would have my preference for the scenario you describe.

Comment by Arjen Poutsma [ 04/May/12 ]

Closing old issues

Generated at Sun Dec 17 06:00:44 UTC 2017 using JIRA 6.4.14#64029-sha1:ae256fe0fbb912241490ff1cecfb323ea0905ca5.