Page 1 of 1

OPS usage via VB.NET

Posted: Wed Dec 04, 2013 8:21 am
by ksb
Hi,
I am using VB.NET programming language to access OPS. Has somebody here experience and can answer the following questions?

1. How to download PDF documents via OPS
When using the following code:

Code: Select all

Dim RestStr As String = "http://ops.epo.org/3.1/rest-services/published-data/images/EP/" & pn & "/" & ki & "/fullimage"
Dim WReq As WebRequest = WebRequest.Create(RestStr)
Try
   Dim wResp As WebResponse = WReq.GetResponse
   Dim sr = New IO.BinaryReader(wResp.GetResponseStream())
   Dim bytes(wResp.ContentLength) As Byte
   bytes = sr.ReadBytes(wResp.ContentLength)
   wResp.Close()
   Return bytes
Catch ex As System.Net.WebException
   MsgBox(ex.Message)
End Try
Of course of existence of the image data has been checked before - without errors. But the code execution above results most often in a 500 server error:

"The remote server returned an error: (500) Internal Server Error."

The strange thing: sometimes it's working, but most often not. And: it is always working when I use the same URL manually in a web browser. I assume that I need to provide some properties to the WebRequest class of VB.NET?

2. How to pass on login credentials
How to pass on the OPS login credentials received from the EPO to the VB.NET objects above? Any idea?

Thanks a lot.

ksb

Re: OPS usage via VB.NET

Posted: Wed Jul 30, 2014 1:25 pm
by ksb
Seems I am the only one using VB.NET for OPS access.
Problems above had been solved...

ksb