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

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="http://tipodati.xsd.dem.sanita.finanze.it";
  mlns:ns2="http://visualizzaerogatoricevuta.xsd.dem.sanita.finanze.it";
  xmlns="http://visualizzaerogatorichiesta.xsd.dem.sanita.finanze.it";>
  ...

soapUI received:
<soap:Body>
 <ns2:VisualizzaErogatoRicevuta
  xmlns="http://visualizzaerogatorichiesta.xsd.dem.sanita.finanze.it";
  mlns:ns2="http://visualizzaerogatoricevuta.xsd.dem.sanita.finanze.it";
  xmlns:ns3="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:
> 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
> -----------------------------------------------------------------------
> 
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------