SetError() Ñ73: CCSID conversion failed
Re: SetError() Ñ73: CCSID conversion failed
So, if I understand correctly, if I use in my current programs http_url_post_xml instead of http_string, I would get the response without http_xlatedyn running and returning -1 and not getting the response. Correct?
I need to receive the response and manage it so that the program shows the information on the screen.
Thanks
I need to receive the response and manage it so that the program shows the information on the screen.
Thanks
-
- Site Admin
- Posts: 872
- Joined: Sun Jul 04, 2021 5:12 am
Re: SetError() Ñ73: CCSID conversion failed
http_url_post_xml serves a completely different purpose... it runs the result through the Expat XML parser.
It still uses http_xlatedyn... everything in HTTPAPI does. You need to determine why http_xlatedyn is failing, or you need to tell me how to reproduce the problem if you want me to look into it.
http_xlatedyn is simply a wrapper around the operating system's ability to convert data between character sets. The problem here is that the OS cannot convert your data... you need to determine why that is.
It still uses http_xlatedyn... everything in HTTPAPI does. You need to determine why http_xlatedyn is failing, or you need to tell me how to reproduce the problem if you want me to look into it.
http_xlatedyn is simply a wrapper around the operating system's ability to convert data between character sets. The problem here is that the OS cannot convert your data... you need to determine why that is.
Re: SetError() Ñ73: CCSID conversion failed
I don't know if by reading the LOG that I am attaching again, it is possible to detect the problem.
I insert the current source in case it helps, but to run it you need to install a certificate.
This program needs two parameters: p_ejemplo and p_version. If p_ejemplo = '1' and p_version = '4' I get a response in the current version of the web service, but if p_ejemplo = '1' and p_version = '5' (new future version that adds new fields in the response), I don't get response to show in the process, although looking at the LOG I don't see anything strange in the response shown there.
For the p_ejemplo = '2' and p_version = '4' or p_version = '5', the response is received without any problem and I can display it in my process. I repeat that it happens in a few cases, and the provider tells me that it is a problem with my software.
I have made comparisons of the XML received in LOG's of both examples and I have not seen problems in TAG or values either.
If it was necessary to test it, perhaps you could export and send the certificate.
Any ideas you can give me will be very useful.
Thank you so much.
I insert the current source in case it helps, but to run it you need to install a certificate.
This program needs two parameters: p_ejemplo and p_version. If p_ejemplo = '1' and p_version = '4' I get a response in the current version of the web service, but if p_ejemplo = '1' and p_version = '5' (new future version that adds new fields in the response), I don't get response to show in the process, although looking at the LOG I don't see anything strange in the response shown there.
For the p_ejemplo = '2' and p_version = '4' or p_version = '5', the response is received without any problem and I can display it in my process. I repeat that it happens in a few cases, and the provider tells me that it is a problem with my software.
I have made comparisons of the XML received in LOG's of both examples and I have not seen problems in TAG or values either.
If it was necessary to test it, perhaps you could export and send the certificate.
Any ideas you can give me will be very useful.
Thank you so much.
Code: Select all
ctl-opt DftActGrp(*NO) bnddir('HTTPAPI');
dcl-pr NMVSWS_SP extpgm('NMVSWS_PV5');
p_ejemplo char(1);
p_version char(1);
end-pr;
dcl-pi NMVSWS_SP;
p_ejemplo char(1);
p_version char(1);
end-pi;
/copy QRPGLESRC,HTTPAPI_H
dcl-s SOAP varchar(65000);
dcl-s rc int(10);
dcl-s response varchar(65000);
dcl-s app_id char(25);
dcl-s url char(100);
dcl-s url1 char(100);
dcl-s ClientLoginId char(20);
dcl-s UserId char(20);
dcl-s w_Res6 char(80);
dcl-s w_Res7 char(80);
dcl-s pgmerror char(1);
dcl-s p_App char(25);
dcl-s p_Tes char(50);
dcl-s p_Cod char(4);
dcl-s p_Oper char(20);
dcl-s p_Gtin char(14);
dcl-s p_Id char(20);
dcl-s p_ExpDate char(6);
dcl-s p_Pack char(20);
dcl-s p_Res char(2);
dcl-s p_Res1 char(60);
dcl-s p_Res2 char(200);
dcl-s p_Res3 char(60);
dcl-s p_Res4 char(60);
dcl-s p_Res5 char(60);
dcl-s p_Res6 char(100);
dcl-s p_Res7 char(100);
dcl-s p_Res8 char(5);
dcl-s p_Res9 char(5);
dcl-s p_Trx char(32);
dcl-s p_Tim char(30);
dcl-s p_CN char(20);
dcl-s ver1 char(50);
dcl-s ver6 char(50);
dcl-ds hospit Dim(30) Qualified;
Cod char(25);
Txt char(60);
End-ds;
dcl-pr ExtraeValor varchar(200);
p_txt varchar(65000) const;
p_ini varchar(100) const;
p_fin varchar(100) const;
end-pr;
p_Res1 = '';
p_Res2 = '';
p_Res3 = '';
p_Res4 = '';
p_Res5 = '';
p_Res6 = '';
p_Res7 = '';
p_Res8 = '';
p_Res9 = '';
w_Res6 = '';
p_Trx = '';
p_Tim = '';
app_id = 'NMVS_NISA9OCTUBRE';
ClientLoginId = '7GRHOSVALENCIANA';
UserId = '7USHOS789208541';
p_tes = 'Vithas Nisa';
p_Cod = 'G110';
p_Oper = 'Verify';
// Ejemplo = 1 NO recibe respuesta
// Ejemplo = 2 SI recibe respuesta
if p_ejemplo = '1';
p_Gtin = '08470008174454';
p_Id = '73JY';
p_ExpDate = '251031';
p_Pack = '10971185015196';
p_CN = '8174454';
else;
p_Gtin = '08470007309024';
p_Id = '2300830A';
p_ExpDate = '250228';
p_Pack = 'DV7TCSW7G4YM';
p_CN = '7309024';
endif;
http_debug(*ON: '/tmp/httpapi_log_NEW.txt');
http_XmlStripCRLF(*ON);
// Para que acepte Ñ y otros caracteres
HTTP_SetCCSIDs(1208 : 0);
https_cleanup();
rc = https_init(%Trim(app_id));
if rc = -1;
http_comp(http_error());
https_cleanup();
return;
endif;
if p_version = '5';
SOAP = '<soap:Envelope'
+ ' xmlns:soap="http://www.w3.org/2003/05/soap-envelope"'
+ ' xmlns:urn="urn:wsdltypes.nmvs.eu:v5.0"'
+ ' xmlns:urn1="urn:types.nmvs.eu:v5.0">'
+ '<soap:Header/>'
+ '<soap:Body>'
+ '<urn:'+ %Trim(p_Cod) + 'Request>'
+ '<urn1:Header>'
+ '<urn1:Auth>'
+ '<urn1:ClientLoginId>' + %Trim(ClientLoginId) + '</urn1:ClientLoginId>'
+ '<urn1:UserId>' + %Trim(UserId) + '</urn1:UserId>'
+ '<urn1:Password>AsinNmvs?24</urn1:Password>'
+ '</urn1:Auth>'
+ '<urn1:UserSoftware urn1:name="' + %Trim(p_Tes)
+ '" urn1:supplier="Vithas Nisa" urn1:version="3.2.0?"/>'
+ '<urn1:Transaction>'
+ '<urn1:ClientTrxId>Transaction</urn1:ClientTrxId>'
+ '<urn1:Language>spa</urn1:Language>'
+ '</urn1:Transaction>'
+ '</urn1:Header>'
+ '<urn1:Body>'
+ '<urn1:Product>'
+ '<urn1:ProductCode urn1:scheme="GTIN">' + %Trim(P_Gtin)
+ '</urn1:ProductCode>'
+ '<urn1:NHRN>' + %Trim(p_CN) + '</urn1:NHRN>'
+ '<urn1:Batch>'
+ '<urn1:Id>' + %Trim(P_Pack) + '</urn1:Id>'
+ '<urn1:ExpDate>' + %Trim(P_ExpDate) + '</urn1:ExpDate>'
+ '</urn1:Batch>'
+ '</urn1:Product>'
+ '<urn1:Pack urn1:sn="' + %Trim(P_Id) + '"></urn1:Pack>'
+ '</urn1:Body>'
+ '</urn:' + %Trim(p_Cod) + 'Request>'
+ '</soap:Body>'
+ '</soap:Envelope>';
else;
SOAP = '<soap:Envelope'
+ ' xmlns:soap="http://www.w3.org/2003/05/soap-envelope"'
+ ' xmlns:urn="urn:wsdltypes.nmvs.eu:v4.0"'
+ ' xmlns:urn1="urn:types.nmvs.eu:v4.0">'
+ '<soap:Header/>'
+ '<soap:Body>'
+ '<urn:'+ %Trim(p_Cod) + 'Request>'
+ '<urn1:Header>'
+ '<urn1:Auth>'
+ '<urn1:ClientLoginId>' + %Trim(ClientLoginId) + '</urn1:ClientLoginId>'
+ '<urn1:UserId>' + %Trim(UserId) + '</urn1:UserId>'
+ '<urn1:Password>AsinNmvs?24</urn1:Password>'
+ '</urn1:Auth>'
+ '<urn1:UserSoftware urn1:name="' + %Trim(p_Tes)
+ '" urn1:supplier="Vithas Nisa" urn1:version="3.2.0?"/>'
+ '<urn1:Transaction>'
+ '<urn1:ClientTrxId>Transaction</urn1:ClientTrxId>'
+ '<urn1:Language>spa</urn1:Language>'
+ '</urn1:Transaction>'
+ '</urn1:Header>'
+ '<urn1:Body>'
+ '<urn1:Product>'
+ '<urn1:ProductCode urn1:scheme="GTIN">' + %Trim(P_Gtin)
+ '</urn1:ProductCode>'
+ '<urn1:NHRN>' + %Trim(p_CN) + '</urn1:NHRN>'
+ '<urn1:Batch>'
+ '<urn1:Id>' + %Trim(P_Pack) + '</urn1:Id>'
+ '<urn1:ExpDate>' + %Trim(P_ExpDate) + '</urn1:ExpDate>'
+ '</urn1:Batch>'
+ '</urn1:Product>'
+ '<urn1:Pack urn1:sn="' + %Trim(P_Id) + '"></urn1:Pack>'
+ '</urn1:Body>'
+ '</urn:' + %Trim(p_Cod) + 'Request>'
+ '</soap:Body>'
+ '</soap:Envelope>';
endif;
http_debug(*ON);
if p_version = '5';
// Versión Producción V5
url = 'https://ws-single-transactions-prod-es.nmvs.eu:8443/' +
'WS_SINGLE_TRANSACTIONS_V1/SinglePackServiceV50';
else;
// Versión Producción V4
url = 'https://ws-single-transactions-prod-es.nmvs.eu:8443/' +
'WS_SINGLE_TRANSACTIONS_V1/SinglePackServiceV40';
endif;
http_setOption('SoapAction': '"' + %Trim(p_Cod) + %Trim(p_Oper) + '"');
monitor;
response = http_string( 'POST': URL: SOAP: 'text/xml');
on-error;
pgmerror = 'S';
endmon;
p_Res1 = ExtraeValor(response:'ns1:code="':'"');
p_Res2 = ExtraeValor(response:'ns1:desc="':'"');
p_Res3 = ExtraeValor(response:'ns1:sn="':'"');
p_Res4 = ExtraeValor(response:'ns1:state="':'"');
p_Res5 = ExtraeValor(response:'<ns1:Reason>':'</');
w_Res6 = ExtraeValor(response:'ns1:alertId="':'"');
p_Trx = ExtraeValor(response:'<ns1:NMVSTrxId>':'</');
p_Tim = ExtraeValor(response:'<ns1:Timestamp>':'</');
p_Res2 = %Trim(p_Res2) + ' ' + %Trim(w_Res6);
p_Res6 = ExtraeValor(response:'<ns1:Name>':'</');
p_Res7 = ExtraeValor(response:'<ns1:CommonName>':'</');
p_Res8 = ExtraeValor(response:'ns1:userMatches="':'"');
p_Res9 = ExtraeValor(response:'ns1:undoPossible="':'"');
ver1 = P_res1;
ver6 = P_res6;
dsply ver1;
dsply ver6;
*inlr = *on;
Dcl-Proc ExtraeValor;
dcl-pi ExtraeValor varchar(200);
p_txt varchar(65000) const;
p_ini varchar(100) const;
p_fin varchar(100) const;
end-pi;
dcl-s Res varchar(200);
dcl-s pos1 int(5);
dcl-s pos2 int(5);
dcl-s len int(5);
Res = '';
len = %len(%trim(p_ini));
pos1 = 0;
pos2 = 0;
pos1 = %Scan(%Trim(p_ini) : p_txt);
If Pos1 > 0;
pos2 = %Scan(%Trim(p_fin) : p_txt : pos1+len);
If Pos2 > 0;
Res = %Trim(%Subst(p_txt : pos1+len : pos2-pos1-len));
endif;
endif;
Return Res;
End-Proc;
- Attachments
-
- httpapi_log_NEW.7z
- (4.74 KiB) Downloaded 2206 times
Re: SetError() Ñ73: CCSID conversion failed
Sorry. I forgot to add the DSPJOBLOG of the various calls, where you can see that the second call fails (MCH1210) and the DSPLYs show nothing due to the error.
With VIEW MESSAGE DETAILS this error occurs in:
Module :HTTPAPIR4
Procedure :HTTP_REQ
Sentence:8720
With VIEW MESSAGE DETAILS this error occurs in:
Module :HTTPAPIR4
Procedure :HTTP_REQ
Sentence:8720
- Attachments
-
- DSPJOBLOG.png (22.29 KiB) Viewed 22162 times
Re: SetError() Ñ73: CCSID conversion failed
Hi,
For contributing something else. I have carried out tests with SOAPUI software, to see if the answers had any common ground. Indeed, seeing the response as RAW, in the cases that this error occurs, it coincides that there is a word with accents (see images). I don't know if it could be the reason for this error, and the program would have to be parameterized in some way when using the API.
Thanks
For contributing something else. I have carried out tests with SOAPUI software, to see if the answers had any common ground. Indeed, seeing the response as RAW, in the cases that this error occurs, it coincides that there is a word with accents (see images). I don't know if it could be the reason for this error, and the program would have to be parameterized in some way when using the API.
Thanks
- Attachments
-
- Example2 SOAPUI .png (81.66 KiB) Viewed 22130 times
-
- Example1 SOAPUI .png (106.82 KiB) Viewed 22130 times
-
- Site Admin
- Posts: 872
- Joined: Sun Jul 04, 2021 5:12 am
Re: SetError() Ñ73: CCSID conversion failed
As you can see, these characters aren't represented correctly in SoapUI -- it is showing as several garbage characters rather than a single proper (accented) character. So something is wrong with the way the data is encoded.
Re: SetError() Ñ73: CCSID conversion failed
However, it does display correctly in SOAPUI in XML format.
Based on your experience, should I contact the entity that provides those WS?
Tks
Based on your experience, should I contact the entity that provides those WS?
Tks
Re: SetError() Ñ73: CCSID conversion failed
I have contacted the entity, and for their part they see correct, and without incidents, the answers with accents, as can be seen in XML format.
I don't know how to proceed to fix it.
Tks
I don't know how to proceed to fix it.
Tks
-
- Site Admin
- Posts: 872
- Joined: Sun Jul 04, 2021 5:12 am
Re: SetError() Ñ73: CCSID conversion failed
Is there an XML processing instruction at the start of the document? what encoding does it list in the content-type in SoapUI?
-
- Site Admin
- Posts: 872
- Joined: Sun Jul 04, 2021 5:12 am
Re: SetError() Ñ73: CCSID conversion failed
I see this in your HTTPAPI log
Notice this says the data is in the ISO-8859-1 format (rather than the standard UTF-8 format). Could that be the problem?
You told me that you are coding this:
This means that you are telling HTTPAPI that the data is UTF-8. But the customer seems to be saying its ISO-8859-1. Why are you forcing HTTPAPI to use UTF-8?
ISO-8859-1 is HTTPAPI's default. But you can set it explicitly like this:
Code: Select all
Content-Type: application/soap+xml;charset=ISO-8859-1
You told me that you are coding this:
Code: Select all
HTTP_SetCCSIDs(1208 : 0);
ISO-8859-1 is HTTPAPI's default. But you can set it explicitly like this:
Code: Select all
HTTP_SetCCSIDs(819 : 0);