Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
No replies
SystemAdmin
SystemAdmin
403 Posts
ACCEPTED ANSWER

Pinned topic CICS Requester Web Service - SOAP Fault

‏2011-01-21T18:00:39Z |
Hello,
I have a CICS Web Service Requester application. I would like to know, how do we read and parse the SOAP Fault messages after the EXEC CICS INVOKE WEBSERVICE call. When we get the return code of 'INVREQ' from EXEC CICS INVOKE WEBSERVICE call, I believe it means SOAP Fault is issued from the Web Service call.

For (e.g.), let's say, if we have the SOAP fault message of --- how do parse this SOAP Fault message in the COBOL CICS requester application.

<Envelope>
<Body>
<Fault>
<faultcode>401</faultcode>
<faultstring>401: Insufficient privilege</faultstring>
<faultactor>Tst</faultactor>
<dtl>
<Exception>
401 <Audience>user</Audience>
<Message>Insufficient privilege</Message>
</Exception>
</dtl>
</Fault>
</Body>
</Envelope>

Could you please provide any information on this topic?
Updated on 2011-06-27T09:50:23Z at 2011-06-27T09:50:23Z by SystemAdmin
  • mazogi
    mazogi
    31 Posts
    ACCEPTED ANSWER

    Re: CICS Requester Web Service - SOAP Fault

    ‏2011-01-24T20:50:09Z  in response to SystemAdmin
    There are a few methods that can be employed to parse XML:

    • You could write some code that uses the XML PARSE verb in the IBM Enterprise COBOL compiler.
    • If you are running your code under CICS Transaction Server 4.1, you could write some code that uses the EXEC CICS TRANSFORM XMLTODATA API. (Latest versions of RDz integrate the CICS tools that can produce artifacts necessary to use the TRANSFORM XML API.)
    • You could parse out contents of the message without parsing the XML (by using the INSPECT verb in COBOL) if the message content is simple and you know exactly what you are looking for.

    Thanks,

    Gary
    • BillCarey-Pok
      BillCarey-Pok
      1 Post
      ACCEPTED ANSWER

      Re: CICS Requester Web Service - SOAP Fault

      ‏2011-01-25T01:42:50Z  in response to mazogi
      Another option is to use XML System Services. For an overview of XML System Services see:
      http://www.ibm.com/systems/z/os/zos/features/xml/

      For information on use of XML System Services from COBOL, see: http://www.redbooks.ibm.com/abstracts/sg247810.html?Open

      Bill Carey
      System z Strategy and Technology
    • SystemAdmin
      SystemAdmin
      403 Posts
      ACCEPTED ANSWER

      Re: CICS Requester Web Service - SOAP Fault

      ‏2011-01-25T12:53:18Z  in response to mazogi
      Thanks for the information.

      In a CICS WebService Requester application, when we call a webservice through 'EXEC CICS INVOKE WEBSERVICE' command, we will get the response code of '0', meaning the call is successful - so that we can retrieve the data returned from the WebService from the main container of 'DFHWS-DATA'.

      But if there is a SOAP FAULT, we will get the response code of 'INVREQ' for 'EXEC CICS INVOKE WEBSERVICE'. Is that correct? If so, from where I can retrieve the SOAP FAULT XML message? Once I retrieve the SOAP FAULT XML, I can parse the data as you had mentioned.

      Whether the SOAP FAULT message will be stored in any container like the successful scenario? If it's stored in a a container, whether the SOAP Fault XML message be parsed by CICS, so that it can be moved to a copybook structure rather parsing it manually?
      • mazogi
        mazogi
        31 Posts
        ACCEPTED ANSWER

        Re: CICS Requester Web Service - SOAP Fault

        ‏2011-01-27T01:09:27Z  in response to SystemAdmin
        I believe SOAP Fault body in this case will be placed in a container called DFHWS-BODY. But in any case, the entire response (headers, envelope and body) is in the container called DFHRESPONSE.

        There is some more information about this in the CICS Web Services Guide.
        Thanks,

        Gary
      • SystemAdmin
        SystemAdmin
        403 Posts
        ACCEPTED ANSWER

        Re: CICS Requester Web Service - SOAP Fault

        ‏2011-01-27T18:48:26Z  in response to SystemAdmin
        You are correct, if a SOAPFault is returned by the invoked service, EIBRESP will be INVREQ. But, wait, there's more... INVREQ is insufficient to identify a SOAPFAULT, you must also examine EIBRESP2 to see if it has a value of 6. There are over 20 different documented EIBRESP2 values for INVREQ.

        We do something similar to what has been suggested in this thread, namely using the COBOL XML PARSE verb to parse the SOAPFault, which we retrieve from the DFHWS-BODY container.

        The relevant information from the SOAPFault is passed to a message formatting routine, which in turn uses the WRITE OPERATOR CICS API to log the error. We also preserve the SOAP request and dump that to the CESE TD queue, along with the contents of the other containers on the channel we used in the INVOKE WEBSERVICE CICS API.
        • SystemAdmin
          SystemAdmin
          403 Posts
          ACCEPTED ANSWER

          Re: CICS Requester Web Service - SOAP Fault

          ‏2011-01-28T21:10:27Z  in response to SystemAdmin
          Thank you for the information!
        • SystemAdmin
          SystemAdmin
          403 Posts
          ACCEPTED ANSWER

          Re: CICS Requester Web Service - SOAP Fault

          ‏2011-06-27T09:50:23Z  in response to SystemAdmin
          Parsing the SOAPfault is only needed when your application really needs to know the type of SOAPfault and/or other data from the SOAPfault. That is that further execution of your application is different for the various kinds of SOAPfaults.

          What I do in case of SOAPfault is to display the SOAPfault into CICS log for analysis purposes (another way is to store the raw xml soapfualt into in a database column). But no parsing.
    • Srihari_Varma
      Srihari_Varma
      1 Post
      ACCEPTED ANSWER

      Re: CICS Requester Web Service - SOAP Fault

      ‏2014-08-11T06:30:05Z  in response to mazogi

      It would be much helpful, if IBM could provide this information in a container such as 'DFHWS-FAULT' whenever a Fault occurs, so that we can check this container directly instead of parsing the entire response. Do we have this feature in latest CICS versions?

      Updated on 2014-08-11T06:30:47Z at 2014-08-11T06:30:47Z by Srihari_Varma
      • mazogi
        mazogi
        31 Posts
        ACCEPTED ANSWER

        Re: CICS Requester Web Service - SOAP Fault

        ‏2014-08-11T17:06:01Z  in response to Srihari_Varma

        If there is a fault, DFHWS-FAULT will contain the info about what kind of fault occurred.  You don't need to parse the entire response to figure out that the fault occurred.  You only need to parse the fault body if you need specific details that the body may contain.