Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
3
Erster Beitrag:
vor 2 Jahren
Letzter Beitrag:
vor 1 Jahr, 11 Monaten
Beteiligte Autoren:
Ola

[WD19] Problems with Web Services, part 2.

Startbeitrag von Ola am 22.02.2016 22:06

Hi all!

I'm now back at the same problem project, trying to develop a communication system with banks using SOAP based Web Services, as referenced in earlier messages on this same subject:
http://27130.foren.mysnip.de/read.php?27131,217746

WLanguage has developed in WD19 a bit since 2014 when I last kept banging my head against a brick wall. Now one problem is solved with the new CertificateLoad () function, which makes it possible to to load a certificate programmatically from a file, instead of selecting it every time manually with CertificateSelect().

But as far a signing the ApplicationRequest (and also the final SOAP message) is concerned, I am still stuck. I do realise that CertificateSignString and/or CertificateSignFile are supposed to be my friends here, but they do not want to play with me.

The problem to me is the different format of the actual XML file, which is a text file (or string, when it is being built in memory), and the signature, which is a buffer when returned from CertificateSignXXX function. And string and buffer do not seem to be compatible with each other.

So, how do I combine the signature buffer to a string or a text file? Or am I not even on the correct playground here?

Any help, hints and tips are highly appreciated.

Best regards
Ola

Antworten:

Hi all!

It seems I finally found a solution to the XML file signing problem.

I found a free software called "XML Signer" by SC Secure Soft SRL in Romania.
It can be called from the command line with the necessary parameters, so it can also be called automatically from a WD program.

This isn't quite ideal, as the certificate file needs to be renamed and the configuration file needs to be built, but it seems to work, or at least it seems to produce nice looking signed XML files from unsigned ones. The final test will be when I get to the point of actually sending files to the bank.

"XML Signer" seems to be a good no-nonsense program which does what it promises. No help document though, so I had to figure out the command line usage myself.

SC Secure Soft SRL has also other signing software, for instance "PDF Signer".

So, giddy-up Widowmaker, let's ride toward new adventures in the amazing world of Bank Web Services...

best regards
Ola

von Ola - am 24.02.2016 16:50
Hi all

Well, it seems "XML Signer" is not the answer, after all.
The signature's "auxiliary" fields are partly different from the samples supplied by the bank.

Also the CertificateSignXXX functions seems not to be an answer. Obviously they are used for some other purpose than signing an xml file.

I have been trying to cut corners by creating the XML files using a model file + tagged insert points, like this:

sUploadModelFile is string = wModelDir + "AppReqUpload.mdl"
sAppReq = Replace(sAppReq,"@customerid",wCustomerId) //"11111111" for testing
sAppReq = Replace(sAppReq,"@timestamp",wTimeStamp) //ISO DateTime
sAppReq = Replace(sAppReq,"@command",sCommand) //- Not mandatory, filetype indicates command
sAppReq = Replace(sAppReq,"@environment",wEnvironment) //"TEST" or "PRODUCTION"
sAppReq = Replace(sAppReq,"@targetid",wTargetId) //storage folder of customer's files in the bank, "11111111A1" for testing
sAppReq = Replace(sAppReq,"@compression","false")
sAppReq = Replace(sAppReq,"@amounttotal",C_Sum)
sAppReq = Replace(sAppReq,"@transactioncount",C_Counter)
sAppReq = Replace(sAppReq,"@softwareid",wSoftwareId)
sAppReq = Replace(sAppReq,"@filetype","pain.001.001.02") //NDCORPAYS - SEPA payment orders

It might have worked, if there were no need for an XML signature, but there is. I did this, because for some reasons my attempts to import the web service wsdl had failed miserably.

Obviously I will have to build the application request xml file using Windev's xml functions, in order to be also able to sign it using Windev's xml signing function, which seems to be SOAPAddXMLSignature.

Strangely and luckily, I suddenly managed to import the wsdl file and the xsd files for the application request and response. This happened after I had re-arranged all my Bank WS document and sample files from a sub-directory under the project directory to a separate directory outside the project!

So, it's back to square one for me. I hope you will bear with me when I start a new set of questions on how to build an xml file and how to send it to the bank with web services.

Best regards
Ola

von Ola - am 06.03.2016 21:24
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.