EldoS | Feel safer!

Software components for data protection, secure storage and transfer

SOAPClient help

Also by EldoS: BizCrypto
Components for BizTalk® and SQL Server® Integration Services that let you securely store and transfer information in your business automation solutions.
#34620
Posted: 10/07/2015 07:54:20
by Tadej Gruber (Basic support level)
Joined: 10/07/2015
Posts: 4

Hello.

I am using your evaluation copy of SecureBlackBox.VCL library and was learning to send XML over SOAPClient example in samples.

I added a button to the sample so i could create my own soap procedure by following your example.

I have to send certain signed XML files over soap. My files are created by another program so i cannot create file by adding the parameters to SOAPClient as done in example but i have to import XML contents.

When i try to send my XML file over said client, i get an error "Decode from Base64 failed". And all the errors that are caused by this one follow. But, if i first create some short message by Add button in the sample, and send it (which works fine), and after that send my XML, then the response comes back error free.

And i do not understand why it works only if some parameters were added to client before sending my xml.

This is my code inside click function of my button:

Code
btnExploreRequestXML.Enabled := false;
btnExploreResponseXML.Enabled := false;

try
FSOAPClient.SOAPPrefix := 'soap';

FSOAPClient.SOAPVersion := SOAP_v1_2;

FSOAPClient.OperationName := 'InvoiceRequest';
FSOAPClient.OperationNamespaceURI := 'http://www.fu.gov.si/';

FSOAPClient.MessageNamespaces.AddNamespace('fu', 'http://www.fu.gov.si/');

FSOAPClient.GenerateMessage;

FSOAPClient.HTTPClient := HTTPSClient;
FSOAPClient.URL := 'https://blagajne-test.fu.gov.si:9002/v1/cash_registers';
FSOAPClient.SOAPAction := '/invoices';

FSOAPClient.XMLDocument.LoadFromFile('C:\Users\Tadej\Documents\RAD Studio\Projects\Windows\XML\Test.xml');
FSOAPClient.SOAPMessage.LoadFromXML(FSOAPClient.XMLDocument);

FSOAPClient.SendMessage;

btnExploreRequestXML.Enabled := true;
btnExploreResponseXML.Enabled := (FSOAPClient.ResponseType = srtXMLDocument) or (FSOAPClient.ResponseType = srtSOAPMessage);
UpdateResponse;
except
on E : Exception do
begin
  MessageDlg('Failed to send SOAP message: ' + E.Message, mtError, [mbOk], 0);
end;
end;
#34621
Posted: 10/07/2015 07:58:32
by Dmytro Bogatskyy (EldoS Corp.)

As your problem has a specific nature, I welcome you to continue in HelpDesk ( https://www.eldos.com/helpdesk/ ). I have created a new support ticket based on your above message. You will see your (and only your) support tickets by following this URL. You will also get e-mail notifications about updates related to your support ticket.
#34982
Posted: 11/11/2015 08:40:36
by Tomaž Tušar (Standard support level)
Joined: 11/11/2015
Posts: 3

Was the upper problem solved?
I'm having problems with the same service.
I've also tried the upper code but I get a different error....
(Connection failed due to error (75784))
#34983
Posted: 11/11/2015 08:51:21
by Vsevolod Ievgiienko (EldoS Corp.)

Hello.

75784 error code means that server certificate was not validated for some reason. Please check next article for details why this can happen: https://www.eldos.com/security/articles/7545.php

You can disable validation for testing purposes. In this case you should modify your TElHTTPSClient.OnCertificateValidate event handler to set its Validate parameter to 'true' without any checks.
#34986
Posted: 11/12/2015 04:55:15
by Tomaž Tušar (Standard support level)
Joined: 11/11/2015
Posts: 3

I still haven't found the problem...

I've set the validate on true and it triggered 2 times, first it wanted to validate the root cert, and the second time the server cert.
After that it jumped in HTTPSClientCertificateNeededEx where I set the cert , but it called HTTPSClientCertificateNeededEx again and again...

Code
procedure TForm20.HTTPSClientCertificateValidate(Sender: TObject;
  X509Certificate: TElX509Certificate; var Validate: Boolean);
begin
  Validate := X509Certificate.Validate;
  //Validate := true;
end;


Later I've tried the upper code and noticed that the second certificate validation was unsuccessful. Later on an error 100353 appeared.

So I've tried to validate it with CertValidator sample and the result was:

12.11.2015 10:47:55 BeforeCertificateValidation:
CN=blagajne-test.fu.gov.si, storage=MY
12.11.2015 10:47:55 BeforeCRLRetrieverUse:
CN=blagajne-test.fu.gov.si, storage=MY, location=C=si,O=state-institutions,OU=sitest-ca,CN=CRL4
12.11.2015 10:47:55 BeforeCRLRetrieverUse:
CN=blagajne-test.fu.gov.si, storage=MY, location=ldap://x500.gov.si/cn=WinCombined1,ou=sitest-ca,o=state-institutions,c=si?certificateRevocationList?base
12.11.2015 10:47:56 CRLRetrieved:
CN=blagajne-test.fu.gov.si, storage=MY, location=ldap://x500.gov.si/cn=WinCombined1,ou=sitest-ca,o=state-institutions,c=si?certificateRevocationList?base, retrieved successfully
12.11.2015 10:47:56 AfterCRLUse:
CN=blagajne-test.fu.gov.si, storage=MY, root CN=, validity=0
12.11.2015 10:47:56 AfterCertificateValidation:
CN=blagajne-test.fu.gov.si, storage=MY, root CN=, validity=valid
12.11.2015 10:47:56 BeforeCertificateValidation:
CN=, storage=Root
12.11.2015 10:47:56 AfterCRLUse:
CN=, storage=Root, root CN=, validity=0
12.11.2015 10:47:56 AfterCertificateValidation:
CN=, storage=Root, root CN=, validity=valid

12.11.2015 10:47:56 RESULT:
CN=blagajne-test.fu.gov.si, validity=valid

That looks fine to me.

At that point i'm stuck. Do you have any idea what's wrong?
#34987
Posted: 11/12/2015 05:00:25
by Vsevolod Ievgiienko (EldoS Corp.)

Quote
After that it jumped in HTTPSClientCertificateNeededEx where I set the cert , but it called HTTPSClientCertificateNeededEx again and again...

Please check event description here: https://www.eldos.com/documentation/sb...dedex.html

Quote
So I've tried to validate it with CertValidator sample and the result was:

You can get a validation log using TElX509CertificateValidator.InternalLogger.Log property for both cases and compare them to understand the reason.
Also by EldoS: CallbackFilter
A component to monitor and control disk activity, track file and directory operations (create, read, write, rename etc.), alter file data, encrypt files, create virtual files.

Reply

Statistics

Topic viewed 2621 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!