XMLHttpRequest get 500 SERVER.Forbidden

This space is made available to users of Open Patent Services (OPS) web-service and now also to users of EPO’s raw data subscription products such as 14.7 DOCDB - worldwide bibliographic master database, 14.11 Worldwide legal status (INPADOC), 14.12 EP full text in XML, 14.1 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

gary8520
Posts: 4
Joined: Thu Nov 17, 2016 8:13 am

XMLHttpRequest get 500 SERVER.Forbidden

Post by gary8520 » Thu Nov 17, 2016 8:48 am

Hi
I've tried to use Javascript XMLHttpRequest to retrieve data on OPS

I get Access_token successfully, but get 500 Internal server error when retrieve a biblio data for testing.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<fault xmlns="http://ops.epo.org">
<code>SERVER.Forbidden</code>
<message>An unknown error occurred. Please contact Open Patent Services Team (open-patent-services-and-publication-se ... )</message>
</fault>

However, I sent a request through HttpRequester(firefox plugin) and got result correctly.

my script as below:

Code: Select all

        function retrieve(){
            var url=document.getElementById("requrl").value,
                input=document.getElementById("reqinput").value,
                auth=document.getElementById("auth").innerHTML,
                req = new XMLHttpRequest();
            req.onreadystatechange = function(){
                // console.log(this);
                var result=document.getElementById("result")
                switch(this.readyState){
                    case 4:
                        switch(this.status){
                            case 200:
                                result.innerHTML=this.response;
                                break;
                            case 403:
                                result.innerHTML=this.response;
                                break;
                            case 0:
                                result.innerHTML='status 0';
                                break;
                            default:
                                result.innerHTML=this.response;
                        }
                        console.log(this);
                        break;
                    default:
                        result.innerHTML="Now retrieving, please wait...."
                        break;
                }
            }
            req.open("POST", "https://ops.epo.org/3.2/rest-services/published-data/publication/docdb/", true);
            // req.setRequestHeader("Accept", "application/exchange+xml");
            if(auth_stat=="OK") req.setRequestHeader("Authorization", "Bearer "+auth);
            req.send("US.6808849");
        };
Many thanks


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

Re: XMLHttpRequest get 500 SERVER.Forbidden

Post by EPO / OPS Support » Thu Nov 17, 2016 10:02 am

Capture_us.PNG
With right mouse click chose View Image to see whole image
Capture_us.PNG (229.88 KiB) Viewed 794 times
Hi,

Unfortunatlly I am not able to see what your problems could be from information given below. But I can confirm that OPS is working properly and that your query is retriavable, even if you didn't include a kind code of the document, which you shoudl actaully always include in your search query.

Can you send me by email your OPS user ID so that I can check yor logs? I think you have our email address from registration emails?

Regards,
OPS support


gary8520
Posts: 4
Joined: Thu Nov 17, 2016 8:13 am

Re: XMLHttpRequest get 500 SERVER.Forbidden

Post by gary8520 » Thu Nov 17, 2016 12:08 pm

thanks for you reply!
I have sent my userID by mail to patentdata@epo.org

for I need to use Cross Domain Access ajax (with access_token in Authorization header), the browser sent a OPTIONS request
there is header:

OPTIONS /3.2/rest-services/published-data/publication/docdb/biblio HTTP/1.1
Host: ops.epo.org
Connection: keep-alive
Access-Control-Request-Method: POST
Origin: http://172.16.1.71:211
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36
Access-Control-Request-Headers: authorization
Accept: */*
Referer: http://172.16.1.71:211/gary/OPStest.html
Accept-Encoding: gzip, deflate, sdch, br
Accept-Language: zh-TW,zh;q=0.8,en-US;q=0.6,en;q=0.4

here is the response:
HTTP/1.1 500 Internal Server Error
Access-Control-Allow-Headers: Authorization
Access-Control-Allow-Methods: POST
Access-Control-Allow-Origin: *
Content-Language: en
Content-Type: application/xml
Date: Thu, 17 Nov 2016 10:57:31 GMT
Server: Apache
X-AnonymousQuotaPerDay-Used: 18910
X-AnonymousQuotaPerMinute-Used: 1
X-API: ops-v3.2
X-EPO-Client-IP: XXXXXX
X-EPO-Forwarded: [XXXXXX]
X-IndividualQuotaPerHour-Used: 1830
Content-Length: 305
Connection: keep-alive

then my chrome told me (in console):
XMLHttpRequest cannot load https://ops.epo.org/3.2/rest-services/p ... cdb/biblio. Response for preflight has invalid HTTP status code 500

Is there any hint about this problem?


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

Re: XMLHttpRequest get 500 SERVER.Forbidden

Post by EPO / OPS Support » Fri Nov 18, 2016 8:10 am

Hi,

Is there any Javascrip specialist here who can help this user?


If someone is using javascript to access OPS data then you will most probably be able to assist this user or if you need more information from his end you are welcome to tell us what you need.

We would appreciate your help, after all, even though we try to help with a lot of questions here this is still meant to be a place where users help other users especially were it comes to practical use cases.

Thank you in advance,

OPS support


gary8520
Posts: 4
Joined: Thu Nov 17, 2016 8:13 am

Re: XMLHttpRequest get 500 SERVER.Forbidden

Post by gary8520 » Mon Nov 21, 2016 7:11 am

Thanks who willing to help my problem!

However it would not a issue just about JavaScript.

I use the HttpRequester to send a simple request:

OPTIONS https://ops.epo.org/3.2/rest-services/p ... cdb/biblio
Origin: http://172.16.1.71:211
(or any other Origin header like "http://www.w3schools.com/" or "http://" or even "123456")

It will give back
-- response --
500 Internal Server Error
Access-Control-Allow-Headers: Authorization
Access-Control-Allow-Methods: POST
access-control-allow-origin: *
Content-Language: en
Content-Type: application/xml
Date: Mon, 21 Nov 2016 02:41:42 GMT
Server: Apache
X-API: ops-v3.2
X-EPO-Client-IP: XXXXX
X-EPO-Forwarded: [XXXXX]
X-IndividualQuotaPerHour-Used: 3050
X-RegisteredQuotaPerWeek-Used: 915
Content-Length: 305
Connection: keep-alive

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<fault xmlns="http://ops.epo.org">
<code>SERVER.Forbidden</code>
<message>An unknown error occurred. Please contact Open Patent Services Team (open-patent-services-and-publication-se ... )</message>
</fault>


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

Re: XMLHttpRequest get 500 SERVER.Forbidden

Post by EPO / OPS Support » Mon Nov 21, 2016 7:28 am

Hi,

I can only repeat what I told you already. We don't have any problem on our side. Our services 3.1 and 3.2 are working fine this whole time.

Try changing IP address and/or change service to 3.1. Maybe your IP address is for some reason blocked (maybe its only in a range of the addresses that were refused due to incorrect use of the service).

Regards,
OPS support


gary8520
Posts: 4
Joined: Thu Nov 17, 2016 8:13 am

Re: XMLHttpRequest get 500 SERVER.Forbidden

Post by gary8520 » Tue Nov 22, 2016 3:26 am

I know I just a little user and it seem that only me encounter this problem, and learned that OPS has implemented CORS having the Access-Control-Allow-[* header.
Vary thanks to OPS support team for reply.

Before I ask the question, I have try to change the server to sent the request, and send it to version3.1.

The conclusion is : We just only get 500 Internal Server Error if the request contained the header "Origin".
(Again, I can use the almost the same request to retrieve access_token)

following the error message, I just report this error to this forum.

We have change to send request on the server not in client side.

Many thanks.


Post Reply