Uploaded image for project: 'Spring Web Services'
  1. Spring Web Services
  2. SWS-137

WebServiceTemplate hasFaut skips check for fault in response if the connection implements FaultAwareWebServiceConnection

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.0 RC1
    • Fix Version/s: 1.0 RC2
    • Component/s: Core
    • Labels:
      None

      Description

      The method should check for a fault in the connection and then in the response as follows:

      protected boolean hasFault(WebServiceConnection connection, WebServiceMessage response) throws IOException {
      if (connection instanceof FaultAwareWebServiceConnection)

      { if (((FaultAwareWebServiceConnection) connection).hasFault()) return true; }

      return response.hasFault();
      }

        Issue Links

          Activity

          Hide
          arjen.poutsma Arjen Poutsma added a comment -

          Are you experiencing problems with the way it currently works? The current way is more suitable for streaming access of the response message. In the way suggested, you have to fully parse the response message in the positive case (i.e. no fault), which is too expensive. What I can imagine is something like:

          protected boolean hasFault(WebServiceConnection connection, WebServiceMessage response) throws IOException

          { if (!((FaultAwareWebServiceConnection) connection).hasFault()) return false; }


          return response.hasFault();
          }

          This way, we double check whether the connection fault really is a fault.

          The hasFault() means (in HTTP terms) an error 500, in accordance with the WS-I spec. If a server sends a fault without a 500, it is not interoperable. And it's not just HTTP, JMS has a similar mechanism (a boolean property).

          Show
          arjen.poutsma Arjen Poutsma added a comment - Are you experiencing problems with the way it currently works? The current way is more suitable for streaming access of the response message. In the way suggested, you have to fully parse the response message in the positive case (i.e. no fault), which is too expensive. What I can imagine is something like: protected boolean hasFault(WebServiceConnection connection, WebServiceMessage response) throws IOException { if (!((FaultAwareWebServiceConnection) connection).hasFault()) return false; } return response.hasFault(); } This way, we double check whether the connection fault really is a fault. The hasFault() means (in HTTP terms) an error 500, in accordance with the WS-I spec. If a server sends a fault without a 500, it is not interoperable. And it's not just HTTP, JMS has a similar mechanism (a boolean property).
          Hide
          pdep Pablo Depietri added a comment -

          I am connecting to a 3rd party HTTP server that is returning a fault without an error 500. Since I have no control over the server, I will extend
          WebServiceTemplate and override hasFault() as I had previously suggested.

          Thanks for the quick reply!

          Show
          pdep Pablo Depietri added a comment - I am connecting to a 3rd party HTTP server that is returning a fault without an error 500. Since I have no control over the server, I will extend WebServiceTemplate and override hasFault() as I had previously suggested. Thanks for the quick reply!
          Hide
          arjen.poutsma Arjen Poutsma added a comment -

          I could also add a property to the template: "checkConnectionForFault", which by default is true, but you can set to false, so that you don't have to override the method.

          Show
          arjen.poutsma Arjen Poutsma added a comment - I could also add a property to the template: "checkConnectionForFault", which by default is true, but you can set to false, so that you don't have to override the method.
          Hide
          arjen.poutsma Arjen Poutsma added a comment -

          I've added the checkConnectionForFault property to the WebServiceTemplate to with Web services which are not WS-I compliant.

          Show
          arjen.poutsma Arjen Poutsma added a comment - I've added the checkConnectionForFault property to the WebServiceTemplate to with Web services which are not WS-I compliant.
          Hide
          arjen.poutsma Arjen Poutsma added a comment -

          Closing 1.0 RC2 issues.

          Show
          arjen.poutsma Arjen Poutsma added a comment - Closing 1.0 RC2 issues.

            People

            • Assignee:
              arjen.poutsma Arjen Poutsma
              Reporter:
              pdep Pablo Depietri
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: