IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to access web services/website?


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
elixir1986

New User


Joined: 10 Nov 2015
Posts: 45
Location: USA

PostPosted: Wed Jan 17, 2024 9:33 am
Reply with quote

Was asked how to access web services/website from mainframes?
I mentioned about accessing using z/OS connect for webservices but interviewer was interested to know other avenues. I searched forum and tried executing some REXX to get to a webservice/website but no success.

Accessing web
Code:

cmd = "curl -k https://jsonplaceholder.typicode.com/posts/1 2>/dev/null"
address USS                                                             
"USSCMD COMMAND('"cmd"') STEM(RESPONSE)"                               
if RESPONSE.0 > 0 then do                                               
  do i = 1 to RESPONSE.0                                               
      say " " RESPONSE.i                                               
  end                                                                   
end                                                                     

                         

response is below,

Code:



response:
4 *-* "USSCMD COMMAND('"cmd"') STEM(RESPONSE)"
  +++ RC(-3) +++   


Connect to website
Code:

 ===>                                                  Scroll ===> CSR
/*  rexx  */                                                         
/*Make a connection to an http server, read the result and exit. */   
Host = 'www.ibm.com'                                                 
Port = '8080'                                                         
                                                                     
srv = Socket('Initialize', 'httpd')                                   
srv= Socket('Socket')                                                 
parse var srv src sockid                                             
srv = Socket('Ioctl',sockid,'FIONBIO','OFF' )                         
srv = Socket('Gethostbyname',Host)                                   
parse var srv src hostip                                             
srv = Socket('Setsockopt',sockid,'SOL_SOCKET','SO_REUSEADDR','ON')   
srv = Socket('Setsockopt',sockid,'SOL_SOCKET','SO_LINGER','OFF')     
srv = Socket('Setsockopt',sockid,'SOL_SOCKET','TCP_NODELAY','OFF')   
srv = Socket('Connect',sockid,'AF_INET' Port hostip)                 
parse var srv src .                                                   
If src > 0                                                           
  then do                                                             
     Say 'Unable to connect to' host':'port                           
     Say 'Socket connect error:' srv                                 
     exit src                                                         
End                                                                   
Exit 0                                                               




response
Code:

 Unable to connect to [url=https://your_URL.com]www.ibm.com:8080[/url]                     
 Socket connect error: 60 ETIMEDOUT Connection timed out   



Any constructive feedback is welcome!
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3076
Location: NYC,USA

PostPosted: Wed Jan 17, 2024 5:32 pm
Reply with quote

REST APIs , Db2 JDBC , CICS Transaction Gateway (CTG) and CICS HTTP WEB requests .. there are other if you host on Linux but overall it depends on requirements..
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2593
Location: Silicon Valley

PostPosted: Thu Jan 18, 2024 12:58 am
Reply with quote

If you are trying to get your code to work... can you manually PING those sites? That is, try to make sure it is a network problem, rather than a rexx problem.
Back to top
View user's profile Send private message
elixir1986

New User


Joined: 10 Nov 2015
Posts: 45
Location: USA

PostPosted: Thu Jan 18, 2024 3:45 am
Reply with quote

Pedro wrote:
If you are trying to get your code to work... can you manually PING those sites? That is, try to make sure it is a network problem, rather than a rexx problem.


I'm able to manually ping...
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1744
Location: Tirupur, India

PostPosted: Thu Jan 18, 2024 5:52 pm
Reply with quote

Quote:
I'm able to manually ping...

By ping you mean from command prompt or from Mainframe.

Does
Code:
TSO PING wwwdotwebsitedotcom

work?
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> Mainframe Interview Questions

 


Similar Topics
Topic Forum Replies
No new posts Access to macro definitions PL/I & Assembler 4
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts access the last host command CLIST & REXX 2
No new posts CICS Access to RACF CICS 2
No new posts Access library name in REXX CLIST & REXX 6
Search our Forums:

Back to Top