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

RE: Re: Help on http_url_post() procedure



Your test POST appears to show that a POST will work. Just have to get it right in HTTPAPI. But the format of web service appears to prefer GET? It is possible that both will work. 

You coded the size of XML to be 1024. Is that the maximum size? Your "target" should be somewhat larger. Encoding can really add characters (the encoded characters will be 3 times as big as unencoded characters -- not all characters get encoded).

There is a practical limit (although not in the RFC) on the size of the GET request (using URL with parameters). HTTPAPI limits this to 32K if you are using http_url_get. Your web service provider might also have a limit (depends on the server they are using) and should be aware of the number.  If the XML could be large, use POST instead.

Encoding into a string has a practical limit (32k of encoded data in current beta). Encoding using pointer allows much larger XML. Again a design decision and how you are going to be using the data.

As far as making your HTTPAPI POST example work, try Scott's suggestion to include a content type. It would appear you can use EXAMPLE4 in the current beta as an example. Depending on the real length of your xml you may want to just encode it yourself instead of using the webform. Use an appropriate type in the seventh parameter of the post. "text/xml" maybe?

Maybe you could wireshark your post request and see what was being sent or find out what is different between httpAPI and your post example.

>Can I process directly a stmf? (I thought I could use
> http_url_post_stmf(),
> but now I know I've to use GET method)

I believe EXAMPLE7 in current beta will be your ticket. Look it over and you see various forms of IFS handling being used.  

Good luck,
Mike Krebs


> -----Original Message-----
> From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-
> bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of edlp1950@xxxxxxxxx
> Sent: Monday, August 16, 2010 4:56 AM
> To: ftpapi@xxxxxxxxxxxxxxxxxxxxxx
> Subject: R: Re: Help on http_url_post() procedure
> 
> Hi Scott,
> first of all I want to thank you for your answer and for your help.
> 
> I tried to get more information from the web server administrators, but
> I
> don't succeded in that.
> They said I've only to do a POST request like this:
> http://xxx.xxx.xxx.xxx:8080/axis2/WebService?data=xml message
> 
> However I modified my sorce as you suggested, sending my document by
> GET
> instead of POST.
> 
> D/copy qrpgcopy,httpapi_h
> 
> D cmd             pr                  extpgm('QCMDEXC')
> D  command                     200A   const
> D  length                       15P 5 const
> 
> D enc             s                   like(HTTP_URL_ENCODER)
> D xml             s           1024a   varying
> D target          s           1024a   varying
> 
> D RESPONSE        c                   const('/tmp/response.xml')
> D TRACE           c                   const('/tmp/trace.txt')
> D CRLF            c                   const(x'0D25')
> D HYP             c                   const(x'7D')
> D URL             c
> const('http://xxx.xxx.xxx.xxx:8080/+
> D                                            axis2/WebService?')
> D OK              c                   const(1)
> 
>  /free
> 
>   xml = . . . ;
>   http_debug(*ON:TRACE);
> 
>   enc = http_url_encoder_new();
>   http_url_encoder_addvar(enc : 'data' : %addr(xml)+2 :
> %len(%trimr(xml)));
>   target = URL + %trim(http_url_encoder_getstr(enc));
> 
>   if http_url_get(%trim(target) : RESPONSE) = OK;
>      cmd('DSPF ' + HYP + RESPONSE + HYP : 200);
>   endif;
> 
>   *inlr = *on;
>   return;
> 
>  /end-free
> 
> Great! Now WebService returns the response I expect!
> Thanks a lot Scott!
> 
> But now I have some questions.
> 
> 1. why they said I had to send XML document by POST method?
> In my "HTML simulator" I wrote "<form action="http://xxx.xxx.xxx.xxx:
> 8080/axis2/WebService" method=post>"
> 
> 2. in some example you say http_url_encoder_getstr() is slower than
> http_url_encoder_getptr().
> Is it possible to use the second one? Do you suggest to do that?
> 
> 3. In the application we're developing, I'm required to store xml
> document
> (sent and received) in IFS.
> I think I have to compose xml as a string, store it as IFS stmf and
> send it
> after encoding.
> In this way i'm sure that what I send and what I store are two
> different
> things.
> There is a better way to do that?
> Can I process directly a stmf? (I thought I could use
> http_url_post_stmf(),
> but now I know I've to use GET method)
> 
> Any other suggestion is welcome.
> Thanks a lot again.
> Eugenio
> 
-------------------------
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------