Web API - Requesting data from services

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
Joerg Hamacher
Posts: 124
Joined: Thu Feb 11, 2016 12:01 am

Web API - Requesting data from services

Post 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
Joerg Hamacher
Posts: 124
Joined: Thu Feb 11, 2016 12:01 am

Re: Web API - Requesting data from services

Post 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
adale
Posts: 212
Joined: Wed Apr 08, 2020 9:18 pm
Location: Poplarville, MS

Re: Web API - Requesting data from services

Post 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.
Arlyn Dale
Servias LLC
atostaine
Posts: 696
Joined: Wed Jan 20, 2016 7:38 am

Re: Web API - Requesting data from services

Post 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
Art Tostaine
Joerg Hamacher
Posts: 124
Joined: Thu Feb 11, 2016 12:01 am

Re: Web API - Requesting data from services

Post by Joerg Hamacher »

Hi Art,

Release is V7R3M0.

Kind regards,
Joerg
atostaine
Posts: 696
Joined: Wed Jan 20, 2016 7:38 am

Re: Web API - Requesting data from services

Post 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
Art Tostaine
Post Reply