Full name
David Dow
Submitted by David on Thu, 04/04/2013 - 00:00
Forums

Niels,

Does IceBreak support SOAP standard faults as described here: http://www.w3schools.com/soap/soap_fault.asp ?

Regards,
David.

Niels Liisberg

Thu, 04/04/2013 - 00:00

Hi David;

Short and easy : Yes !!

Your code is place in a "monitor" and if that fails, the client will receive the SOAP-fault.

...The fault tag, It has been around since 24/09/2012.

 

Try this:

N will be divided by zero in this code:

<%@ language="RPGLE" pgmtype="webservice"%>
<%
h nomain debug
/include qasphdr,ilob

/* -----------------------------------------------------------------------------------
   save file
   ----------------------------------------------------------------------------------- */
p saveFile...
p b export
d pi
d file * input

// Local variables
d outilob s *
d n s 10U 0

/free
// ----------------------------------------------------------------------------------------------------------

  // Decode the BASE64 and save the binary contents
  outilob = sesGetIlob('out');
  ilob_Base64Decode(outilob:file);
  ilob_SaveToBinaryStream(outilob:'/www/john.jpg');
  
  n = 1 / n;


/end-free
p saveFile...
p e

Which will produce what you see on the attached screen shot.

Best regards,
Niels Liisberg 

Hi David;

Since the normal control of the SOAP envelope is so much different, your only option now is to send an escape message within your code, which terminates the SOAP procedure and response the fault document.

But that can be done relatively simply by something like:

D SendEscMsg       pr              extpgm('QMHSNDPM')
D   MsgID                     7    const
D   MsgFile                  20    const
D   MsgDta                   80    const
D   MsgDtaLen                10i 0 const
D   MsgType                  10    const
D   MsgQ                     10    const
D   MsgQNbr                  10i 0 const
D   MsgKey                    4
D   ErrorDS                  16 

D ErrorDS          ds        16
D   BytesProv                10i 0 inz(16)
D   BytesAvail               10i 0
D   ExceptionID               7

D MsgDta           s        256
D MsgKey           s          4


….


// Send the escape message
   MsgDta = 'My SOAP failed'
   SendEscMsg ('CPF9898':
            'QCPFMSG QSYS':
             MsgDta:
             %len(%trimr(MsgDta)):
             '*ESCAPE':
             '*':               <==== Not sure about this
             2:                 <==== And this

             MsgKey:
             ErrorDS)

 

Best regards,
Niels Liisberg            

This is very useful Niels.

When Icebreak catches an error using the monitor, what is the format of the data it returns in the faultactor tag? Is there a datastructure for this somewhere?

Does it include the %status() code of the error anywhere?

Thanks,
Craig

Hi Craig;

 

It will return the messages id of the escape message + the error text.

 

The error list wil contain the program name info.

 

Regards

 

Niels