Page 1 of 1

Web API - Requesting data from services

Posted: Mon Aug 29, 2022 6:46 pm
by Joerg Hamacher
Hi,

thanks to Dino I have a nice example to test if our IBMi is connected to the net and can request something from URLs.

Function Options(*DIRECT)
Define_Com Class(#XPRIM_HttpRequest) Name(#Request) Scope(*Application)
#Request.DoPost Url('https://www.google.com')
If (#Request.Response.IsSuccessfulRequest)
Message Msgtxt(allgood)
Else
Message Msgtxt(notgood)
Endif


When using 'https://www.google.com' the response is "allgood".
But when I replace 'https://www.google.com' with 'https://www.lansa.com' or our web page 'https://www.smhsoftware.de' I always get response "notgood".

Why is this so?
What has to be done to get "allgood" when using other URLs than 'https://www.google.com'?

Kind regards,
Joerg

Re: Web API - Requesting data from services

Posted: Tue Aug 30, 2022 2:15 am
by Joerg Hamacher
Hi,
I found that calls with http instead of https work.
So I suppose that it is a matter of certificates.
I know how to retrieve certificates with LANSA Integrator.
But how do I have to import these certificates on our IBMi so that LANSA functions , reusable Parts and Web APIs find them and use them?

Kind regards,
Jörg

Re: Web API - Requesting data from services

Posted: Tue Aug 30, 2022 10:46 pm
by adale
Joerg,
I am not sure your issue is the same as what I was dealing with, but when I started using Lansa resources with web requests two issues I had to deal with were the IBM i DCM (Digital Certificate Manager) and object authorities. The object authority issue never fully got explained to my satisfaction, but it worked and I had to move on.
Look at the forum post:
viewtopic.php?f=3&t=2552

And here is a link to an IBM doc that might help with a link to setting up certs in the DCM:
https://www.ibm.com/support/pages/node/685565

Hope this help.

Re: Web API - Requesting data from services

Posted: Thu Sep 01, 2022 3:30 am
by atostaine
Digital Certificate Manager is a hoot.

What IBM i version are you on? There was a PTF that fixed a certificate issue that popped up a few Monday's ago.

Art

Re: Web API - Requesting data from services

Posted: Thu Sep 01, 2022 5:41 pm
by Joerg Hamacher
Hi Art,

Release is V7R3M0.

Kind regards,
Joerg

Re: Web API - Requesting data from services

Posted: Thu Sep 01, 2022 9:17 pm
by atostaine
I followed this article. Brad is top notch on cipher and all sorts of issues.

It asks you to remove some ciphers from a sysval (that did not solve our problem) and then apply a PTF. I applied the PDF during production and we were back up.

https://fieldexit.com/forum/display?threadid=618