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

Re: Post vs Post_raw



Here is an update on our situation and one question (see bottom):
- the java program was created to execute a post to the java servlet.  When it ran it got back a HTTP 500 error, just like the RPG program did.  After some trial and error, the java program worked sending the message to the parent company database.  One of the things that the java program had to do was change the "content-type" and "user-agent" HTTP property values. The "content-type" value was changed to 'application/x-www-form-urlencoded' and the "user-agent" value was changed to 'Mozilla/4.0'.  This proved that a program post to the java servlet works, ergo the RPG HTTP API post should work.
- we saw that the "content-type" and "user-agent" values in the CONFIG_H source member did not match these values.
- we changed the CONFIG_H source so that the HTTP_USERAGENT and HTTP_CONTTYPE constants matched the java program values. We recompiled the HTTPAPIR4 program (as this seems to be the one that does the actual post) so that it will use the new values
- called the http_url_post_raw RPG program and got the same results - DSPLY  recvdoc: saveproc: Not all data was written! in the joblog.
- we then tried to force these HTTP property values, via the http_url_post_raw parameters:
   C                   Eval      rc = http_url_post_raw(
   C                             'HTTP://10.254.20.184/cs/' +
   C                             'DataToDw/DataToDwServlet':
   C                             %addr(data):
   C                             %len(%trimr(data)):
   C                             1:
   C                             %pAddr('incoming'):
   C                             10:
   C                              'Mozilla/4.0':
   C                              'application/x-www-form-url! enco' +< BR>   C                              'ded')
and got the same job log error message.
- we are now trying to get a web sniffer on the parent company server to see what it is receiving from the iSeries
 
If anyone can provide any more HTTP API utility support/suggestions it would be most helpful, we are running out of project time and need to resolve this soon.
 
Question:
What does the 4th parameter in the http_url_post_raw (comment says "peFD  = FD to pass back to peProc") do?
We used the value "1" since the example did.
 
-------------- Original message --------------
Yes, you are correct, we do not need the data returned.  Thanks for simplifying the procedure for us.  We reran the changed program and got the same results
DSPLY  recvdoc: saveproc: Not all data was written!                           
in the joblog.
 
Right now, I'm not sure which side (iSeries or Web) is causing the problem. 
 
Thanks
 
-------------- Original message --------------

> Sender: Scott Klement
>
>
> Hi,
>
> I thought you said you didn't need the data that's returned by the server?
> (I think you said that in a previous message... I could be thinking of
> someone else, though)
>
> If you don't need it, why are you saving it into a variable?
>
>
> That's what this code does:
>
> > C* Make sure we don't overflow the string:
> > c eval retlen = (nextpos + datalen) - 1
> > c if retlen > %size(retdata)
> > c eval datalen=datalen-(retlen-%size(retdata))
> > c endif
> >
> > C* If there is nothing to write, return THAT...
> > c if datalen < 1
> > c return 0
> > c endif
> >
> ! > C* Here we add any data sent to the end of our 'retdata' string:
> > c eval %subst(retdata: nextpos) =
> > c %subst(data:1:datalen)
> > c eval nextpos = nextpos + datalen
>
> It basically concatenates the data to the end of a variable. (You could
> do this much easier with a VARYING field.)
>
> If you really don't need the results, (and you're just copying an old
> routine that I wrote in 1842,) maybe you should try changing it to this:
>
> P Incoming B
> D Incoming PI 10I 0
> D Descriptor 10I 0
> D Data 8192 Options(*VarSize)
> D DataLen 10I 0 Value
> c return datalen
> P Incoming E
>
> This basically just discards any data that HTTPAPI sends it. (Obviously,
> you'll want to remove the code that translates the result to EBCDIC, since
> you no longer have anything to translate.)
> ----------------------------! -------------------------------------------
> This ! is t! he FTPAP I mailing list. To unsubsribe from the list send mail
> to majordomo@xxxxxxxxxxxxx with the body: unsubscribe ftpapi mymailaddr
> -----------------------------------------------------------------------