B4J Question How can I connect to a web service using a local certificate? (SII Hacienda for example)

MicroDrie

Well-Known Member
Licensed User
I don't quite understand what certificate you mean. Your link points to a site with an incorrect certificate. A number has been added to the web site link to take you to a web site that uses a likely forged certificate. ❗This deception tactic is widely used by criminals to steal victims' money or credentials ❗.
 
Upvote 0

Gabino A. de la Gala

Well-Known Member
Licensed User
Longtime User
I don't quite understand what certificate you mean. Your link points to a site with an incorrect certificate. A number has been added to the web site link to take you to a web site that uses a likely forged certificate. ❗This deception tactic is widely used by criminals to steal victims' money or credentials ❗.

It is the link of an official page of Spain. It is the page of the tax collection office here in Spain and they have enabled this link to periodically send the invoices issued and received. (I apologize for my English as a translator)
 
Upvote 0

Gabino A. de la Gala

Well-Known Member
Licensed User
Longtime User
I don't quite understand what certificate you mean. Your link points to a site with an incorrect certificate. A number has been added to the web site link to take you to a web site that uses a likely forged certificate. ❗This deception tactic is widely used by criminals to steal victims' money or credentials ❗.
This certificates:
CapturaCertificado.JPG
 
Upvote 0

MicroDrie

Well-Known Member
Licensed User
As I already wrote in my previous answer, your link is pointing to a website with a manipulated security certificate. What do you want to do with the false certificate?
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
A number has been added to the web site link to take you to a web site that uses a likely forged certificate
Are you talking about the www1 subdomain? It is a subdomain of agenciatributaria.gob.es. It is not a different site. Only someone with access to this domain can configure the subdomain.
 
Upvote 0

MicroDrie

Well-Known Member
Licensed User
It is the link of an official page of Spain. It is the page of the tax collection office here in Spain and they have enabled this link to periodically send the invoices issued and received. (I apologize for my English as a translator)
You misses my point, your given link points not to the official page of Spain, it points to a web site what has a corrupted certificate. That is why you see the error message.

What do you want to do with the original certificate from the Spanish government?
 
Upvote 0

Gabino A. de la Gala

Well-Known Member
Licensed User
Longtime User
Let's forget about the specific address.

what I need is to know how I can make a request to a url, but to identify myself I am not going to have a user and a password, but a certificate installed in the windows store or, if necessary, in a file on the hard disk.

Have I explained myself better now?
 
Upvote 0

Gabino A. de la Gala

Well-Known Member
Licensed User
Longtime User
This is part of the code I am using in Delphi:

B4X:
   //Creamos el objeto:
   oWS := CreateOleObject('MSXML2.ServerXMLHTTP.6.0');
   // La web de donde conectamos.
   oWS.Open('POST', EditUrlWebService.text, false);
   // Establecer el timeout de la operación:
   // resolveTimeout, connectTimeout, sendTimeout, receiveTimeout
   // Los valores son en milisegundos:
   oWS.setTimeouts(0, 60000, 300000, 300000);
    // Le paso como parámetro el certificado a utilizar
   oWS.SetOption(3, EditCertificado.Text);
   // El método al que vamos a llamar.
   oWS.SetRequestHeader('SOAPAction', 'VNifV2');
   // Hacemos la llamada
   oWS.Send(UTF8Encode(MemoXML.Lines.Text));
   // Esperamos la respuesta y según el status, mostramos el posible error
   if ows.Status <> 200 Then MemoRespuesta.Lines.add(IntToStr(ows.Status) + ' - ' + ows.StatusText);
   // Con esto obtengo la respuesta en bruto. IDEAL para sabar cuales son los mensajes de error que devuelve el servidor
   {   MemoRes.Lines.add(oWS.responseText);
       MemoRes.Lines.add('----'); }
   // Mostramos la respuesta obtenida en el memo correspondiente
   MemoRespuesta.Lines.clear;
   MemoRespuesta.text := XMLDoc.FormatXMLData(oWS.responseXML.XML);
 
Upvote 0

Gabino A. de la Gala

Well-Known Member
Licensed User
Longtime User
You are looking for client certificates. It is not supported by jOkHttp.


Well, I'm sorry, since with the libraries that I have seen published in the forum to convert xml to json and vice versa, they would have simplified my life a lot.
Maybe then save the xml to a file from delphi and then "work" with it from B4J.

Thank you.
 
Upvote 0
Top