• 1 reply
  • Latest Post - ‏2012-04-25T14:21:20Z by SystemAdmin
535 Posts

Pinned topic RPG WebService Client : Error handling

‏2011-10-12T12:18:01Z |
Anyone knows how to retreive err messages from the webservice server in a correct way?

I have used to generate RPG stubs.

The err message I'm intressted of is never returned from stub_op_getxxxxxOp(WsStub:Input:Result) in the parameter.
Well it is partial returned in WsStub.excString (2048 alpha)
Ive made an ugly work around in stub_getxxxxxPortType_ExcH@ and removed

g_excString@   = %str(excString@:2048);
that caused the err string to be stripped at the first null.
Instead I return the complete excString@ (including nulls) from stub_getxxxxxPortType_ExcH@ that includes the backend error message.
But I hope there is an more correct way to do this, please tell if you know.

Updated on 2012-04-25T14:21:20Z at 2012-04-25T14:21:20Z by SystemAdmin
  • SystemAdmin
    535 Posts

    Re: RPG WebService Client : Error handling

    Actually, I have learned that processing error messages are not returned in the "result" parameter, but are always returned in excString. This is a function of SOAP "fault" processing. So your code should look like this:

    // Call the web service and check for exceptions                      
    if (stub_op_xxxxxxxx(WsStub:Input:Result) = *on);   
    // Process the Result....   
    // -- If NOT successful, log the error and send notification   
    // FAULT/ERROR; WRITE TO LOG FILE                              LogMsg = %subst(wsStub.excString:1:128); Write LogMsg; EndIf;