Midrange News for the IBM i Community


Posted by: Tad Mitchell
Monett MO
Web Service and iSockets and CGIDEV2
has no ratings.
Published: 22 Sep 2011
Revised: 23 Jan 2013 - 4082 days ago
Last viewed on: 28 Mar 2024 (7177 views) 

Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.

Web Service and iSockets and CGIDEV2 Published by: Tad Mitchell on 22 Sep 2011 view comments(6)

I am consuming a Web Service from the iSeries. I have created a mock up to verify I could do it, and it works. A few problems but not with the iSeries or Isockets. What I need to do now is build XML that contains multiple records. It will contain parts and cut lengths and other fields. I wanted to use CGIDEV2 to accomplish this. I am not sure how to marry the two together. How to build the XML and then send it to the Web Service. I have read many papers on how to do one or the other but not both.

Has anyone ever done this? Am I approaching it incorrectly?

 

P.S. I am an OLD green screen programmer, but am excited about learning something new. I KNOW my iSeries can do anything.

Return to midrangenews.com home page.
Sort Ascend | Descend

COMMENTS

(Sign in to Post a Comment)
Posted by: bobcozzi
Site Admin ****
Chicagoland
Comment on: Web Service and iSockets and CGIDEV2
Posted: 12 years 6 months 6 days 15 hours 7 minutes ago
iSockets bias everything you need. You don't need cgidev2 but you can use it as well. Once you generate the XML cgidev2 has a procedure you call to get the resulting XML or whatever data. You pass that to your iSockets routine to send it. I'm out of the office today but I can post more on Monday.
Posted by: Tmitchell
Premium member *
Monett MO
Comment on: Web Service and iSockets and CGIDEV2
Posted: 12 years 6 months 6 days 6 hours 12 minutes ago

Chris I have read the article you directed me to.

 

Bob, I would prefer to use just one piece ie: iSockets. I hoped it would be able to do it all but don't know how. I look forward to more information from you on Monday.

Thanks

 

Tad

Posted by: Tmitchell
Premium member *
Monett MO
Comment on: Web Service and iSockets and CGIDEV2
Posted: 12 years 6 months 3 days 3 hours 4 minutes ago

I assume the part of iSockets that does this is the sendURLData. I don't know how the data is created and the help only shows the sendURLText not the sendURLData. Do I use the CGIDEV2 to create the data? Is there a way in iSockets?

Posted by: bobcozzi
Site Admin ****
Chicagoland
Comment on: Web Service and iSockets and CGIDEV2
Posted: 12 years 6 months 2 days 18 hours 59 minutes ago

iSockets has a couple "HTTP" procedures:

 

initHttpVar

getHttpVar

It does not have the scan/replace engine that's in RPG xTools or CGIDEV2, however.

Meaning you can read from a web page but you don't have the scan/replace ability to generate the HTML or XML. 

if you already generated it, then you can read that file into a variable and simply send it using the sendURLData or another iSocket "send" procedure.

Posted by: LarryTaylor
Premium member *
Comment on: Web Service and iSockets and CGIDEV2
Posted: 12 years 3 months 9 days 2 hours 25 minutes ago

We have been using iSockets for sometime, without issues. Today we started getting

"Message . . . . :   Length or start position is out of range for the string
  operation.                                                               
                                                                           
Cause . . . . . :   One of the following has occurred in RPG procedure     
  parseHTTPR in program ISOCKETS/ISOCKETS: "   AND,                             

 "File QISOCKETS in library ISOCKETS with member ISOCKETS not found".

We are at V6.1 latest ptf's.  In debug on the nRtnLen = postUrlData(url : service : reqData : %addr(rtnXML) : %size(rtnXML): 0 : 819 ); line the nRtnLen is 143662.

nRtnLen is 10i.

We are consuming a inhouse created web service that returns A/P invoices. The issue seems to be with the date range request returning a large number of invoices.

Thank you in advance for your hlep/suggestions on resolving this issue

Larry Taylor

Hobby Lobby Stores

 

Posted by: bobcozzi
Site Admin ****
Chicagoland
Comment on: Web Service and iSockets and CGIDEV2
Posted: 12 years 3 months 9 days 1 hours 53 minutes ago

I believe RPG does not support beyond 64k on that release. They upped it to 1MB in v7r1 (but check to make sure it wasn't in v6r1).

If you have the line number, I can look at the source code.

Also, try to start a new thread when posting new questions. thanks.