2 Replies Latest reply on Nov 17, 2013 3:44 PM by Dina Hess

    Return Soap Fault in CF web service

    Dina Hess

      How do I return a Soap Fault like this:

       

            <soapenv:Fault>

               <faultcode>soapenv:Client.Validation</faultcode>

               <faultstring>SalesCode must be 5 characters in length</faultstring>

              ...

            </soapenv:Fault>

       

      instead of a CFCInvocationException?

        • 1. Re: Return Soap Fault in CF web service
          raZorTTZ Level 1

          Hi Dina,

           

          Did you find a solution to your problem? I'm looking at doing the same thing.

           

          Cheers,
          Simon

          • 2. Re: Return Soap Fault in CF web service
            Dina Hess Level 1

            I had to use a workaround. In the complex type (CFC) returned by the web

            service, I added two additional properties, success (boolean) and fault

            (string). That way, if validation fails, I set success to false and return

            validation messages in the fault property using syntax like this:

            . It communicates what the client needs to know but

            is not in the format I originally wanted to implement. I did find a clue

            about how to get control of the SOAP envelope in a comment made by Arthur

            Blake at the end of one of Ben Nadel's blog entries about using HTTP to

            consume a web service. He said he could customize the XML request/response by

            writing a "proxy" in ColdFusion that forwards to the real SOAP service. I

            never did figure out how to go about doing that, so if you happen to get

            your head around it, please post your solution. In general, I found that

            ColdFusion 8 doesn't play nicely with a pre-defined complex WSDL that

            import XSDs and doesn't honor a "required=no" setting in the property tag

            of a complex type's CFC when generating its WSDL dynamically. In fact, I

            have a whole list of "gotchas" on this... Didn't mean to write a book, but

            you opened an old wound that had just about healed. Good luck, Simon.  Hope

            I didn't douse too much water on your passion to move forward with this.