[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Question about http_url_post_raw2()
If you write a simple piece of RPG that contains something like this,
(I'll let you pad it out and make it compile) this will basically read
the data from stdin and store the raw data in variable request. You
probably want to look at varying field sizes nut you get the basic
idea.
D QtmhRdStin PR extproc('QtmhRdStin')
D RcvVar 65535a options(*varsize)
D RcvVarLen 10I 0 const
D LenAvail 10I 0
D ErrorCode 8000A options(*varsize)
D request_t S 100000 Template
D request S Like(request_t)
Monitor;
// Get the request data
QtmhRdStin( request:%Size(request) : rtnLen: err);
Clear msgReq;
On-Error *All;
EndMon;
Once you've got the program to compile you need to register it on your
apache server, if you log in to httpadmin
(http://xxx.xxx.xxx.xxx:2001/HTTPAdmin) and go to your instance
On the bottom left there is an edit configuration file, click on this
add something like this
ScriptAlias /HostFacade /qsys.lib/my.lib/mypgm.pgm
<Directory /qsys.lib/my.lib>
Order Allow,Deny
Allow From All
</Directory>
<Location /HostFacade>
SetEnv QIBM_CGI_LIBRARY_LIST "QGPL;QTEMP"
</Location>
Stop and start your server,
Any data that is then sent to xxx.xxx.xxx.xxx/HostFacade then invokes
your RPG which will capture the raw data so you can view it.
Hope that helps
John
-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
[mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Mario
Martoriello
Sent: 17 October 2016 14:15
To: HTTPAPI and FTPAPI Projects <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: Question about http_url_post_raw2()
Hi John
thank you for your answer. What do you mean when write "register the
RPG with the apache server via the apache config file by Adding an
alias"?
Can you share an example?
best regards
Mario
-----Messaggio originale-----
From: John Long
Sent: Monday, October 17, 2016 1:37 PM
To: HTTPAPI and FTPAPI Projects
Subject: RE: Question about http_url_post_raw2()
Hi,
I do this by reading directly from STDIN using QtmhRdStin, then
register the RPG with the apache server via the apache config file by
Adding an alias
John
-----Original Message-----
From: [1]ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
[[2]mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Mario
Martoriello
Sent: 17 October 2016 12:23
To: HTTPAPI and FTPAPI Projects <[3]ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: Question about http_url_post_raw2()
Hi Paul
thank you for your answer. What I am trying to do is to write the
incoming data as is without any translation from the server, because I
want to see exactly what I receive. I know that if I open a ifs file
and specify the CCsid/codepage parameter the sysstem translate to that
ccsid/codepage, it is not what I want becuase the problem is that my
webservice provider told that some characters are encoded in utf-8 fine
and it seems that when I read them they are not exactly encoded (see
my prevoius post). I liked your idea to use TRCCNN and when I start I
selected the IP address of my server IBM i but in the printer output
that I had I don't find any message that I sent or received maybe
because they are in ASCII encoding. I am talking with a windows or unix
server maybe.
Any tips about?
Best regards
mario
-----Messaggio originale-----
From: Paul Roy
Sent: Saturday, October 15, 2016 11:11 AM
To: HTTPAPI and FTPAPI Projects
Subject: Re: AW: SV: SV: Question about http_url_post_raw2()
if you want the file in the IFS being coded in UTF-8 , you can say it
at open time... it is a parameter of the open() function
fd2 = open('/tmp/logmm.log'
: O_CREAT + O_TRUNC + O_WRONLY
: S_IRWXU + S_IRWXG + S_IRWXO:1208);
this will cause the data to be translated from memory (ebcdic ? or what
you asked in http api) to UTF-8 when it is written to the stream
file....
if you want to see the raw data sent/received to the communication
line, use
TRCCNN select the from and to IP adresses and you should capture the
trafic
and be able to print it in HEX format.
Paul
From: "Mario Martoriello" <[4]martoriello@xxxxxxxxxxxxxxx>
To: "HTTPAPI and FTPAPI Projects"
<[5]ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
Date: 14/10/2016 18:58
Subject: Re: AW: SV: SV: Question about http_url_post_raw2()
Sent by: [6]ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
Hi all
I try to use TRCCNN but , maybe I have not the enough knowlegde , I
didn't
find any useful information. Maybe the data goes in ASCII but the
output was
unuseful both I try to end TRCCNN typing *EBCDIC or *ASCII in the CCSID
parameter.
So can anyone suggest me the way to save the answer that I receive as
is in
utf-8?
I used these instructions with no results:
> fd2 = open('/tmp/logmm.log'
> : O_CREAT + O_TRUNC + O_WRONLY
> : S_IRWXU + S_IRWXG + S_IRWXO); dou (not
> HttpResponse_isAuthenticationError(http_rc));
> // Get document from server and handle http redirects
> // See also: WSDL2R88.HttpResponse_isRedirect()
> dou (not HttpResponse_isRedirect(http_rc));
> http_DebugLog_appendText(
> '** ' + %char(%timestamp()) + ': Sending request to server');
>
> http_rc =
> http_url_post_raw2(
> url
> : hInpStream
> : %paddr('WSDL2R85_MessageContext_InputStream_read')
> : MessageContext_getSize(hMsgCtx)
> : fd2
> : %paddr('write')
> : getTimeout()
> : getUserAgent()
> : '');
>
> callp close(fd2);
> leave;
> Enddo ;
it seems that when write is done IBM i translate in EBCDIC because the
Ifs
file CCSID is 280 (italian)
Any help would be very useful because I am trying to solve this problem
since a month without any important result.
Best regards
Mario
-----Messaggio originale-----
From: Thomas Raddatz
Sent: Friday, October 14, 2016 10:44 AM
To: HTTPAPI and FTPAPI Projects
Subject: AW: SV: SV: Question about http_url_post_raw2()
Great stuff. Thanks!
Thomas.
-----Ursprüngliche Nachricht-----
Von: [7]ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
[[8]mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] Im Auftrag von Paul
Roy
Gesendet: Freitag, 14. Oktober 2016 00:01
An: HTTPAPI and FTPAPI Projects
Betreff: Re: SV: SV: Question about http_url_post_raw2()
xxCMNTRC has been usefull for years but will not work for network at
speed
> 100Mb...
instead of STRCMNTRC... use TRCCNN (and optionnaly output to
wireshark
as explained in this article
[9]http://www.itjungle.com/fhg/fhg030514-story02.html)
Paul
From: "Mario Martoriello" <[10]martoriello@xxxxxxxxxxxxxxx>
To: "HTTPAPI and FTPAPI Projects"
<[11]ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
Date: 13/10/2016 18:18
Subject: Re: SV: SV: Question about http_url_post_raw2()
Sent by: [12]ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
No not yet, I 'll try it .
Thank you for the link
Bets regards
mario
-----Messaggio originale-----
From: Julius Kaj
Sent: Thursday, October 13, 2016 5:28 PM
To: 'HTTPAPI and FTPAPI Projects'
Subject: SV: SV: Question about http_url_post_raw2()
Have you considered using the built-in communication trace facilities
to see
what is being sent and received at the TCP layer?
STRCMNTRC
ENDCMNTRC
PRTCMNTRC
DLTCMNTRC
[13]http://www.mcpressonline.com/operating-systems/ibm-i-os400-i5os/pro
blems-communicating.html
[14]http://www.ibmsystemsmag.com/ibmi/administrator/systemsmanagement/M
anaging-TCP-IP/?page=3
-----Oprindelig meddelelse-----
Fra: [15]ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
[[16]mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] På vegne af Mario
Martoriello
Sendt: 13. oktober 2016 16:30
Til: HTTPAPI and FTPAPI Projects
Emne: Re: SV: Question about http_url_post_raw2()
Yes in the log of SoapUi there is the content type and it is
"Content-Type:
text/xml;charset=UTF-8[\r][\n]"
and I see the german char coded in utf-8 like
<ns2:cognNome>SCH[0xc3][0x96]NEGGER where x'c396' is Ö The problem is
that
when I use SoapUi I am, of course, on my PC and I would like see the
same on
IBM i to compare the answers and understand if the end-point is the
same and
react in the same way.
best regards
Mario
-----Messaggio originale-----
From: Julius Kaj
Sent: Thursday, October 13, 2016 1:39 PM
To: HTTPAPI and FTPAPI Projects
Subject: SV: Question about http_url_post_raw2()
Question:
If you look at the data in the Raw tab of SoapUI's response view, does
it
contain a ContentType http header with charset information? - like for
example:
Content-Type: application/soap+xml; charset=utf-8
I think SoapUI use the charset information to ensure that it interprets
what's sent correctly.
HTTP 1.1 says that the default charset is ISO-8859-1 (CCSID = 819)
-----Oprindelig meddelelse-----
Fra: [17]ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
[[18]mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] På vegne af Mario
Martoriello
Sendt: 13. oktober 2016 10:21
Til: HTTPAPI and FTPAPI Projects
Emne: Re: Question about http_url_post_raw2()
Hi Thomas
I can agree with you but my service provider told me, as you know, that
he
send data in utf-8 encoding, and I would like see also on IBM i, such
data
without any interference to demostrate, if they are in ansi, to my
service
provider that is wrong otherwise the answer from my webservice provider
is
always the same: I am the only that have such problem because I am on
IBM
i.
Best regards
Mario
-----Messaggio originale-----
From: Thomas Raddatz
Sent: Wednesday, October 12, 2016 10:57 PM
To: HTTPAPI and FTPAPI Projects
Subject: Re: Question about http_url_post_raw2()
Hi Mario,
I think that Scott confirmed what I already strongly assumed.
http_url_post_raw2() does not translate the data. Of course Scott is
right,
that the CCSID of the file is EBCDIC rather than utf-8. But that
actually
does not matter, since we did not want to do anything with the file on
the
IBM i, but FTP (as binary data) it to a PC. So the main key is that you
correctly saved the untranslated (raw) data to the file.
At the end I think that we can be sure that you received the special
German
characters in Ansi and not UTF-8. Therefore I still believe, that the
problem is on the server side. Since you apparently received the
correct
data with soapUI, I have to assume, that soapUI used a different web
service
endpoint. Remember the slightly different ordering of the
namespaces:
HTTPAPI received:
<soap:Body>
<ns2:VisualizzaErogatoRicevuta
xmlns:ns3="[19]http://tipodati.xsd.dem.sanita.finanze.it"
mlns:ns2="[20]http://visualizzaerogatoricevuta.xsd.dem.sanita.finanze.i
t"
xmlns="[21]http://visualizzaerogatorichiesta.xsd.dem.sanita.finanze.it"
>
...
soapUI received:
<soap:Body>
<ns2:VisualizzaErogatoRicevuta
xmlns="[22]http://visualizzaerogatorichiesta.xsd.dem.sanita.finanze.it"
mlns:ns2="[23]http://visualizzaerogatoricevuta.xsd.dem.sanita.finanze.i
t"
xmlns:ns3="[24]http://tipodati.xsd.dem.sanita.finanze.it">
...
I have never seen a web service that changes the ordering of the
namespaces
from call to call. On the other hand, there are millions of things I
have
not yet seen.
It was great if we had a client that we could run unchanged on your PC
and
the IBM i. If it produced different results, we could safely assume
that it
called different endpoints on the server.
Thomas.
Am 12.10.2016 um 10:30 schrieb Mario Martoriello:
> Hi Scott
> thank you for your answer. I try to explain my problem better. I have
> some problem reading a web service response that contains German
> characters, see my prevoius post. In this project I use both Httpapi
> and WSDL2RPG. When my program read the webservice response that
> contains german characters it ends abnormally saying that there was a
> wrong encoding character. The web service provider tells that the
> encoding was correct. So, according with Thomas Raddatz, I modified
> the program where I read the answer and using the
http_url_post_raw2()
> I wrote the answer into a ifs file. The code snippet is:
> fd2 = open('/tmp/logmm.log'
> : O_CREAT + O_TRUNC + O_WRONLY
> : S_IRWXU + S_IRWXG + S_IRWXO); dou (not
> HttpResponse_isAuthenticationError(http_rc));
> // Get document from server and handle http redirects
> // See also: WSDL2R88.HttpResponse_isRedirect()
> dou (not HttpResponse_isRedirect(http_rc));
> http_DebugLog_appendText(
> '** ' + %char(%timestamp()) + ': Sending request to server');
>
> http_rc =
> http_url_post_raw2(
> url
> : hInpStream
> : %paddr('WSDL2R85_MessageContext_InputStream_read')
> : MessageContext_getSize(hMsgCtx)
> : fd2
> : %paddr('write')
> : getTimeout()
> : getUserAgent()
> : '');
>
> callp close(fd2);
> leave;
> Enddo ;
> What I would like to have in the 'tmp/logmm.log' file is the
> webservice answer as is alias in utf-8 but when I saw with
Notepad++
> it was in ANSI. Where is my mistake? And what is your opinion about
> this error for the german char that I receive from EXPAT?
> Best regards
> Mario
>
> -----Messaggio originale----- From: Scott Klement
> Sent: Wednesday, October 12, 2016 12:21 AM
> To: HTTPAPI and FTPAPI Projects
> Subject: Re: Question about http_url_post_raw2()
>
> Mario,
>
> You are telling the open() API to create the file in EBCDIC, but you
> are telling me that the data is UTF-8. I don't understand why you
are
> doing that?
>
> http_url_post_raw2() never translates data. So if you tell the
open()
> data that it should use EBCDIC, but the data is UTF-8, the file will
> be marked with the wrong CCSID, and that will confuse any program
that
> relies on the CCSID.
>
> -SK
>
>
> On 10/11/2016 5:50 AM, Mario Martoriello wrote:
>> Hi all
>> is possible that http_url_post_raw2() does some traslantion for
the
>> received data? If I use this function and then write the
incoming
>> data(that should be encoding in utf-8) to a stream file, opened
with
>> these instruction
>> fd2 = open('/tmp/logmm.log'
>> : O_CREAT + O_TRUNC + O_WRONLY
>> : S_IRWXU + S_IRWXG + S_IRWXO);
>> how are they written in utf-8 or ansi?
>> Thanks in advance
>> Mario Martoriello
>>
>>
>
>
----------------------------------------------------------------------
> - This is the FTPAPI mailing list. To unsubscribe, please go to:
> [25]http://www.scottklement.com/mailman/listinfo/ftpapi
>
----------------------------------------------------------------------
> -
>
----------------------------------------------------------------------
> - This is the FTPAPI mailing list. To unsubscribe, please go to:
> [26]http://www.scottklement.com/mailman/listinfo/ftpapi
>
----------------------------------------------------------------------
> -
>
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
[27]http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
[28]http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------
______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud
service.
For more information please visit [29]http://www.symanteccloud.com
______________________________________________________________________
______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud
service.
For more information please visit [30]http://www.symanteccloud.com
______________________________________________________________________
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
[31]http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
[32]http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------
______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud
service.
For more information please visit [33]http://www.symanteccloud.com
______________________________________________________________________
______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud
service.
For more information please visit [34]http://www.symanteccloud.com
______________________________________________________________________
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
[35]http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
[36]http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------
--
IMPORTANT NOTICE:
This email is confidential, may be legally privileged, and is for the
intended recipient only. Access, disclosure, copying, distribution, or
reliance on any of it by anyone else is prohibited and may be a
criminal
offence. Please delete if obtained in error and email confirmation to
the
sender.
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
[37]http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
[38]http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
[39]http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
[40]http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------
_____________________________________________________________ T.J.
MORRIS
LTD-CONFIDENTIALITY NOTICE This e-mail and its contents, together with
any
attachments, are confidential to the sender and the intended
recipient(s).
If you are not the intended recipient or agent responsible for delivery
to
the intended recipient any unauthorised storage, use, disclosure,
copying,
distribution or dissemination of this e-mail or any part thereof is
strictly
prohibited and may be illegal. If you receive this e-mail in error
please
advise us by telephone on +44(0)151 530 2920 and delete and destroy
this
e-mail and any attachments and any copies thereof from your system
immediately. Any views or opinions expressed in this e-mail are solely
those
of the sender and do not necessarily represent those of T J Morris Ltd.
Although any attachments to this e-mail have been checked for viruses
we
make no representation and give no warranty as to the absence of
viruses and
you should scan this e-mail and attachments for viruses.
___________________________________________________________
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
[41]http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
[42]http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------
_____________________________________________________________ T.J.
MORRIS LTD-CONFIDENTIALITY NOTICE This e-mail and its contents,
together with any attachments, are confidential to the sender and the
intended recipient(s). If you are not the intended recipient or agent
responsible for delivery to the intended recipient any unauthorised
storage, use, disclosure, copying, distribution or dissemination of
this e-mail or any part thereof is strictly prohibited and may be
illegal. If you receive this e-mail in error please advise us by
telephone on +44(0)151 530 2920 and delete and destroy this e-mail and
any attachments and any copies thereof from your system immediately.
Any views or opinions expressed in this e-mail are solely those of the
sender and do not necessarily represent those of T J Morris Ltd.
Although any attachments to this e-mail have been checked for viruses
we make no representation and give no warranty as to the absence of
viruses and you should scan this e-mail and attachments for viruses.
___________________________________________________________
References
1. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
2. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
3. mailto:ftpapi@xxxxxxxxxxxxxxxxxxxxxx
4. mailto:martoriello@xxxxxxxxxxxxxxx
5. mailto:ftpapi@xxxxxxxxxxxxxxxxxxxxxx
6. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
7. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
8. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
9. http://www.itjungle.com/fhg/fhg030514-story02.html
10. mailto:martoriello@xxxxxxxxxxxxxxx
11. mailto:ftpapi@xxxxxxxxxxxxxxxxxxxxxx
12. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
13. http://www.mcpressonline.com/operating-systems/ibm-i-os400-i5os/problems-communicating.html
14. http://www.ibmsystemsmag.com/ibmi/administrator/systemsmanagement/Managing-TCP-IP/?page=3
15. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
16. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
17. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
18. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
19. http://tipodati.xsd.dem.sanita.finanze.it/
20. http://visualizzaerogatoricevuta.xsd.dem.sanita.finanze.it/
21. http://visualizzaerogatorichiesta.xsd.dem.sanita.finanze.it/
22. http://visualizzaerogatorichiesta.xsd.dem.sanita.finanze.it/
23. http://visualizzaerogatoricevuta.xsd.dem.sanita.finanze.it/
24. http://tipodati.xsd.dem.sanita.finanze.it/
25. http://www.scottklement.com/mailman/listinfo/ftpapi
26. http://www.scottklement.com/mailman/listinfo/ftpapi
27. http://www.scottklement.com/mailman/listinfo/ftpapi
28. http://www.scottklement.com/mailman/listinfo/ftpapi
29. http://www.symanteccloud.com/
30. http://www.symanteccloud.com/
31. http://www.scottklement.com/mailman/listinfo/ftpapi
32. http://www.scottklement.com/mailman/listinfo/ftpapi
33. http://www.symanteccloud.com/
34. http://www.symanteccloud.com/
35. http://www.scottklement.com/mailman/listinfo/ftpapi
36. http://www.scottklement.com/mailman/listinfo/ftpapi
37. http://www.scottklement.com/mailman/listinfo/ftpapi
38. http://www.scottklement.com/mailman/listinfo/ftpapi
39. http://www.scottklement.com/mailman/listinfo/ftpapi
40. http://www.scottklement.com/mailman/listinfo/ftpapi
41. http://www.scottklement.com/mailman/listinfo/ftpapi
42. http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------