1

I have been use the function GetUrl to save an xml obtained from a web page without problems, but two days ago, it started to gave me an error when downloading.

The following is the code for the function that is called to perform the retrieve and saving of the file:

Arguments for the function are: S_PATH_URL as string S_INVOICE_NO as string

Integer li_rc
String ls_filename, s_FILEPATH
string s_XMLdata
blob b_XML
long li_filesave


SetPointer(HourGlass!)

li_rc = iinet_base.GetURL(s_PATHURL, in_irdata)

IF li_rc = 1 THEN

s_FILEPATH = "C:\SIA\" 

s_XMLdata =  String(in_irdata.iblob_data, EncodingUTF8!)
s_XMLdata = Remove_xtrachars (s_XMLdata)
b_XML = Blob(s_XMLdata, EncodingUTF8!)

ls_filename = s_FILEPATH + s_INVOICENUM + ".xml"

in_irdata.of_WriteFile(ls_filename, b_XML)

MessageBox("Success", "XML File Successfully downloaded")
SetPointer(Arrow!)
    RETURN 0
ELSE
   MessageBox("Error", "GetURL Failed")
   SetPointer(Arrow!)
   RETURN -1
END IF

The URL path that is provided in S_PATHURL is like the following:

https://www.facturadigital.com.mx/sistemacfdi32/webservices/getxml_secure.php?token=6d2d1d3acffb0655f2f90c0c29333569f1d40fb8

what changes is the token content. Obviously, if I put this in a browser, it works. It was working well, but as I said, two weeks ago, the GetUrl function always return -1 when called...

Any hints?....

  • Your code sample is incomplete and cannot compile. What are `iinet_base`, `remove_xtrachars`, `s_INVOICENUM`, `in_irdata`? – Seki Mar 04 '16 at 14:34

1 Answers1

1

Has the security certificate from the server you are connecting to expired?

Matt Balent
  • 2,337
  • 2
  • 20
  • 23
  • 1
    Apparently it was it. Looking at the page for the certificate info it appears that the certificate is valid from March 3, 2016 to one year after. It is working again, without any modification to the code. Thanks for the hint anyway.... regards – Ricardo Perez Mar 07 '16 at 21:50
  • Nice catch Matt. I was going to suggest it might be a timing issue. I've used the INET object and remember needing to make sure that the http request is finished, there is a property you can check to make sure that it's finished and if not it can cause some odd behavior. – Rich Bianco Mar 18 '16 at 08:46