[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: HTTPAPI / call webservice in base64binary-code



Hi Marcus,

I suggest that you follow these steps:

a) Create a temporary stream file in the IFS.  The http_tempfile() API 
in HTTPAPI will give you a unique, temporary, IFS filename.

b) Write the top of your SOAP message to the file.

c) Open the file you want to base64 encode in binary mode, read it 54 
bytes at a time.  Feed it into a base64 encoder to produce 74 bytes of
encoded data.  Write that to the temp stream file.

d) Repeat step c until you've sent the whole file to the IFS document.

e) Write the bottom of your SOAP message to the file.

f) Close the temporary stream file.

g) Call http_url_post_stmf() to send the temporary stream file to the 
web service.  Download the response into a second temporary stream file.

h) Delete the original temporary stream file.

i) Call http_parse_xml_Stmf() API to parse the newly downloaded XML 
stream file to get the response from the web service.

j) Once you're done, delete the 2nd stream file.

There are some base64 encode/decode routines at the following link:
http://www.scottklement.com/base64/

Let us know how it works out, or if you have any questions.


Marcus Schmidtke (Besitec IT DEBRE) wrote:
> Hello to all,
> 
> I'm not really used not to call webservices direct on our AS/400.  
> 
> But now we have to implement the call of a webservice of our client. I
> have to insert a streamfile from ifs in base64binary-code in a soap like
> this example:
> 
> <?xml version="1.0"?>
> <SOAP-ENV:Envelope
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";
> xmlns:xsd="http://www.w3.org/2001/XMLSchema";
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";><SOAP-ENV:Body><Ch
> eck xmlns="http://.../";>
> <fileName>file.txt</fileName>
> <fileContent> !!!here stream-file convert in base64binary!!!
> </fileContent>
> </Check></SOAP-ENV:Body></SOAP-ENV:Envelope>
> 
> Answer will also be a xml-file with base64binary-code included. 
> 
> Could you give a tip which example in LIBHTTP is the best to solve this
> request? 
> 
> Thanks and best regards
> Marcus 

-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------