Web References Error Handling

Web References Error Handling


I'm consuming a soap web reference that has some authentication mechanism using tokens in the soap header.
Associated with this token there are severel erros (Access Denied, InvalidToken, TokenExpired, ...) and they all have a code but when a exception occours I'm not hable to acesso the error code, only the message.

Is there any way to access the error code?
It must be in the returned envelope but how can I acces that?

António Braz

Hi António,

You cannot access the XML directly, unfortunately. If you really need to handle it, you need to call the web service from an extension. However, I find it strange that you do not get the error code. Are you sure it's in the message (use e.g. SoapUI to make sure)? If so, is it in the XSD/WSDL?
Hi Kilian,

thanks for your reply.

Yes, the return message sends the error code. Here a sample request where I'm not sending the Auth sessionID in the Header

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.xxxxxxxx.com/service/cms/2013/08">

The return message with ther error code:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
         <faultstring>Invalid session id - AuthenticateSession</faultstring>
            <ServiceFault xmlns="http://www.xxxxxxxx.com/service/cms/2013/08" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
               <TrackingCode i:nil="true"/>

Outsytems only returns the <faultstring> not the <Errorcode> 

There should be a way of accessing this, at least througth the EnhancedWebReferences xif.

António Braz

just whant to reference a component thar might help other with the same problem.