Midrange News for the IBM i Community


Posted by: Ashok Kumar
Passing BLOB thru web service
has no ratings.
Published: 01 Jul 2015
Revised: 02 Jul 2015 - 815 days ago
Last viewed on: 23 Sep 2017 (1853 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.

Passing BLOB thru web service Published by: Ashok Kumar on 01 Jul 2015 view comments(5)

Can any one help please..

I have a requirement. Need to create a webservice that takes in a cusmoer number and an image (photo like .jpg etc etc) and store it in our IFS or database. So some mobile application will be calling this web service and send the image to our iSeries. We are in V7.1. How will I define a BLOB as a parm in an RPGLE and while deploying the webservice, will I get the BLOB type in IBM Web Administration for i.

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

COMMENTS

(Sign in to Post a Comment)
Posted by: bobcozzi
Site Admin ****
Chicagoland
Comment on: Passing BLOB thru web service
Posted: 2 years 2 months 26 days 11 hours 19 minutes ago
Edited: Wed, 01 Jul, 2015 at 16:25:56 (816 days ago)

You need something that can process Multipart-form encoded data passed to your RPG program.

When you say "Call this webserver" do you mean the mobile apps will be issuing a CGI POST action along with the text (i.e., customer number) and file (i.e., photo)? If so, then a multipart-form is what you need to handle.

Right now, unless you write it yoursef, you need to use something like our CGILIB (www.cozTools.com) which does this kind of thing easily. There may be some other packages that do this, but our product does it just fine.

Also, you may want to look at the IBM SQL Web Services. Perhaps working some kind of SQL query into it might do the job for you without writing RPG. I don't know for sure. But here is a link to the IBM site on web services with SQL.

http://www.ibm.com/developerworks/ibmi/library/i-incorporating-web-service/index.html

Posted by: akumarvk
Premium member *
Comment on: Passing BLOB thru web service
Posted: 2 years 2 months 25 days 16 hours 57 minutes ago

Yes Sir. Mobile apps will be doing a post from .NET framework/other third party mobile softwares. They will be consuming iSeries webservice that I'm planning to make. The data they will be posting is customer number / name etc and an image/photo.

They could come directly to our DB2 file and write the image to a BLOB field in a table, but due to security concerns, management wants to have a webservice serving this feature so writing is handled by an RPGLE program (that is used for most of the development here).

So does this mean that our IBM Web Administration for i do not take BLOB as a parm when we deploy a webservice? Sorry for asking if the answer is too obvious, I'm pretty new to this world.

Posted by: bobcozzi
Site Admin ****
Chicagoland
Comment on: Passing BLOB thru web service
Posted: 2 years 2 months 25 days 15 hours 53 minutes ago

Not sure what "IBM Web Administration for i" means.

The basic IBM RPG IV interface for web stuff is CGI. The CGI APIs shipped with the system include qzhbCgiParse. It is used to retrieve the contents of FORMs from a web page, Web apps, such as your .NET stuff, would simulate a web page form and send a POST to the web server. RPG would be called and you'd call the cgiParse API. That API does NOT support Multipart-forms which are required for File uploads to the IBM i system. You will need to use a 3rd party package. I have one in COZTOOLS called CGILIB that supports multipart-forms, but those web-based things like PHP and the rest probably have some kind of file upload capabilities, but I do not use those tools.

Posted by: Ringer
Premium member *
Comment on: Passing BLOB thru web service
Posted: 2 years 2 months 25 days 12 hours 15 minutes ago

If you make the target of your POST a php !--script--, it's fairly easy. The parms are in $_POST array and the file(s) in $_FILES array. Save the file to the IFS (move_uploaded_file) and then just pass the cust parm and IFS path to an RPG stored proc on the backend and do whatever.

But it depends too on what you mean by web service. WSDL? RESTFUL? POX? 

Chris Ringer 

Posted by: akumarvk
Premium member *
Comment on: Passing BLOB thru web service
Posted: 2 years 2 months 25 days 10 hours 47 minutes ago

Thanks Guys for your response..Let me clarify...

 

@ Chris - We are using WSDL. Unfortunately we are not using PHP. I don't think it's even in our iSeries.

 

@ Bob Cozzi - It's our HTTP Server Administration (IBM Web Administration for i). We can create webservice server and deploy web services thru that interface supplied by IBM. It'll take care of the wsdl etc etc behind the scenes.

 

Responses greatly appreciated.