Handling of OPS XML Error data

This space is made available to users of Open Patent Services (OPS) web-service and now also to users of EPO’s bulk data subscription products such as 14. EPO worldwide bibliographic database (DOCDB), 14.11 EPO worldwide legal status database (INPADOC), 14.12 EP full text data, 14.1 EP bibliographic data (EBD)and more.

Users can ask each other questions, exchange experiences and solutions, post ideas. The moderator will use this space to announce changes or other relevant information.
Post Reply

Mike_k43
Posts: 52
Joined: Fri Jan 06, 2017 1:34 pm

Handling of OPS XML Error data

Post by Mike_k43 » Sat Dec 16, 2017 3:23 pm

Dear OPS support,

We are currently finishing proper catching in software the possible WebExceptions that can be caused by error responses received from OPS (such as with 404, 400 or 403 Http codes). It is apparently possible in such error situations to retrieve the raw XML error data from the WebResponse's stream, and to deserialize this to a restFault object containing a code, a message and a detail field. In most case this works fine. However, in some cases the received raw error data are simply a byte array of 130 bytes lenght, containing only null characters "\0". That cannot be deserialised to the restFault object. It is not clear when such null bytes raw error responses are sent from OPS, but it seems that this happens after about 20 minutes, so this might be an OAuth2 authenication issue. Can you explain?

mike_k43


EPO / OPS Support
Posts: 1298
Joined: Thu Feb 22, 2007 5:32 pm

Re: Handling of OPS XML Error data

Post by EPO / OPS Support » Mon Dec 18, 2017 8:04 am

Hi,

As stated in OPS documentation, a token is only valid for 20 minutes and that corresponds with your findings, I would say.

Regards,
OPS support


Mike_k43
Posts: 52
Joined: Fri Jan 06, 2017 1:34 pm

Re: Handling of OPS XML Error data

Post by Mike_k43 » Mon Dec 18, 2017 8:55 am

Dear OPS Support,

Firstly, I do not know whether the 130 byte null character error message is indeed due to an expired OAuth2 token. The Manual says that in this case you should receive a properly formatted XML response with HTTP code 400 "Bad Request" and message "invalid_access_token". This is not the case here. Furthermore, how am I to know what the actual error is if the error message simply is a null character string, instead of a sensible XML message?

mike_k43


EPO / OPS Support
Posts: 1298
Joined: Thu Feb 22, 2007 5:32 pm

Re: Handling of OPS XML Error data

Post by EPO / OPS Support » Mon Dec 18, 2017 10:49 am

Hi,

In order to investigate it further we need either HAR of client server communication or curl -v response logged on a client

Can you please send this via email and not post it in this forum? Our email address is patentdata(at)epo.org

Thanks,

OPS support


Mike_k43
Posts: 52
Joined: Fri Jan 06, 2017 1:34 pm

Re: Handling of OPS XML Error data

Post by Mike_k43 » Wed Dec 27, 2017 10:35 am

I have tried to log OPS request/responses. However the communication to OPS is over HTTPS (SSL). This requires special measures on the local computer to decrypt HTTPS traffic. The HttpListener Class I have in my compiler seems to be able to handle Kerberos or NTLM authentication but not OAuth2. The known Telerik Fiddler logger is able to decrypt HTTPS traffic if properly configured but seems to interfere with the generation of the OAuth2 token. Currently I am stuck and cannot provide a logfile. Can you publish on the OPS forum site a manual on how to log HTTPS traffic to and from OPS?

mike_k43


Mike_k43
Posts: 52
Joined: Fri Jan 06, 2017 1:34 pm

Re: Handling of OPS XML Error data

Post by Mike_k43 » Tue Jan 02, 2018 12:14 pm

I have now found the major cause of the problem. There are two types of exceptions in OPS, faults and errors (to be deserialised to restFault and error objects, respectively). The expiry of the OAuth2 token generates an error, not a fault. The OPS manual shows XML representations of the error object but not of the restFault object. The XSD files provided by the EPO on the other hand generate a restFault class but not an error class. I had to write my own class code for the error object in order to be able to correctly deserialise and handle the error sent from OPS upon expiry of the OAuth2 token.

It is not documented in the OPS manual how to distiguish between restFault and error messages. The correct XMLSerializer needs to be created before deserialising the raw XML response to the correct object. This is particularly troublesome for HTTP code 400 "Bad Request", which may be either a fault (e.g. CLIENT.CQL) or an error (OAuth2 token expired, invalid_access_token).

The only way to do the distinction between error and restFault seems to check the headers of the XML response, such as for the presence or absence of the X-Throtthling-Control Header, but this should be described in the OPS manual.

Mike_k43


EPO / OPS Support
Posts: 1298
Joined: Thu Feb 22, 2007 5:32 pm

Re: Handling of OPS XML Error data

Post by EPO / OPS Support » Tue Jan 02, 2018 1:46 pm

Hi,

We will give your proposal to our developers although I am not sure if or when they will be able to fulfil your requests. I will try though,

Regards,
OPS support


Post Reply