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

RE: Conversion using Iconv to ASCII



   Mike/Scott/Group,


   Sorry, I thought that this would be a common issue.


   Yes Mike, I am not able to read the ascii though I able to view it. I
   see the data getting written to the debug log file.


   I have attached the code and debug log. Please see the
   Code_Response_Expected Response.txt before reading further.


   After trying the default CCSIDs, I tried CCSID of 500, 1252 because
   when I was discussing with my boss, he was saying that our AS400
   systems use CCSID of 500 and servers in US where the web service is
   running, use 1252. Check logs - httpapi_DefaultCCSID.txt,
   httpapi_CCSID500to1252.txt. Please note that tilda is appearing
   properly in the notepad. But it did not in my AS400 L.


   I also noticed that my system default for CCSID is 65535 and `Country
   or region identifier' as NL(Netherlands). I tried changing these to
   500 and US too. Anything to do with this?


   We also have a table created Q500TO1252 and Q1252TO500 in our systems.
   I tried defining the HTTP_USE_TABLES in Config_h (recompiled HTTPAPI
   completely), and called my program with default tables (QTCPEBC,
   QTCPASC) and also HTTP_setTables(`Q500TO1252','Q1252TO500'). But I got
   internal server error. I have attached the debug log
   (httpapi_debug_UsingTables.txt) for this too.


   The output which I get here is one of the input for my next
   consumption of web service. Where I include another parameter which is
   "invLoc:L~deliveryCd:D~catalogId:100". When this goes to the server,
   where the web service is running, both the parameters gets changed and
   have junk characters instead of tilda.


   I don't know if I am confused or I am confusing everybody.


   Regards,

   Sakthivel
[] Code
=======
h dftactgrp(*no) bnddir('HTTPAPI')                      
/copy HTTPAPI_H                                        
                                                        
d ODP2            PR                  ExtPgm('ODP2')    
d   UserId                      15a   const             
d   Password                    15a   const             
d   brand                       15a   const             
d   localeString                15a   const             
d ODP2            PI                                    
d   UserId                      15a   const             
d   Password                    15a   const             
d   brand                       15a   const             
d   localeString                15a   const             
                                                        
D MapXmlData      PR                                    
D   CDAPTok                     52a   varying           
D   depth                       10I 0 value                      
D   name                      1024A   varying const              
D   path                     24576A   varying const              
D   value                    65535A   varying const              
D   attrs                         *   dim(32767)                 
D                                     const options(*varsize)    
                                                                 
d VARYINGDATAOFFSET...                                           
d                 c                   const(2)                   
d SOAP            s           1024a   varying                    
d CDAPToken       s             50a   varying                    
d wait            s              1a                              
d rc              s             10i 0                            
 /free                                                           

http_debug(*ON);      


SOAP = '<soapenv:Envelope +                                           
           xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"; +
           xmlns:web="http://webServices.global.officedepot.com";> +   
          <soapenv:Header/> +                                         
          <soapenv:Body> +                                            
            <web:testGetCdapStrings> +                                
            <tempUserId>' + %trim(UserId) + '</tempUserId> +          
            <tempPassword>' + %trim(Password) + '</tempPassword> +    
            <brandChar>' + %trim(brand) + '</brandChar> +             
            <localeString>' + %trim(localeString) + '</localeString> +
            </web:testGetCdapStrings> +                               
          </soapenv:Body> +                                           
        </soapenv:Envelope>';                                         

********** 
In this part of the code, I tried inserting various combinations of CCSID, 
like http_setCCSIDs(1208:0), http_setCCSIDs(1252:500), http_setCCSIDs(1252:0), http_setCCSIDs(1252:500:1252:500), etc. All gave me the same response.

I also used tables instead of CCSID, by defining the HTTP_setTables in CONFIG_H and recompiling everything. But I get an Internal server error.
***********

rc = http_post_xml( 'http://10.95.197.153:9080/ODWebServicesWeb' +   
                      '/services/ODWebServices'                      
                  : %addr(SOAP) + VARYINGDATAOFFSET                  
                  : %len(SOAP)                                       
                  : *NULL                                            
                  : %paddr(MapXmlData)                               
                  : %addr(CDAPToken)                                 
                  : HTTP_TIMEOUT                                     
                  : HTTP_USERAGENT                                   
                  : 'text/xml; charset=UTF-8'                        
                  : '"http://webServices.global.officedepot.com";' ); 
if (rc<>1);                                                          
   http_crash();                                                     
endif;                                                               

dsply CDAPToken   ' ' wait;       
*inlr = *on;                      

/end-free                                                    
                                                              
P MapXmlData      B                                           
D MapXmlData      PI                                          
D   country                     52a   varying                 
D   depth                       10I 0 value                   
D   name                      1024A   varying const           
D   path                     24576A   varying const           
D   value                    65535A   varying const           
D   attrs                         *   dim(32767)              
D                                     const options(*varsize) 
 /free                                           
      if (name = 'testGetCdapStringsReturn');    
         country = value;                        
      endif;                                     
 /end-free                                       
P                 E    


[] Call Command
===============
CALL ODP2 PARM('user' 'pwd' '' '')


[] Response
===========
sessionId:0000485¯signatureId:06d5h

[] Should have been
===================
This should ideally be sessionId:0000485~signatureId:06d5h. Tilda is the problem here.
**Please note  - the response (testGetCdapStringsReturn) shown here (after downloading to windows notepad) is having the tilda properly. But when I view it in my AS400, it shows the response as sessionId:0000498¯signatureId:06d5n.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

HTTPAPI Ver 1.23 released 2008-04-24
OS/400 Ver V5R3M0

New iconv() objects set, PostRem=819. PostLoc=0. ProtRem=819. ProtLoc=0
http_persist_open(): entered
http_long_ParseURL(): entered
DNS resolver retrans: 2
DNS resolver retry  : 2
DNS resolver options: x'00000136'
DNS default domain: ODEUROPE.COM
DNS server found: 10.136.22.36
DNS server found: 10.136.22.35
http_persist_post(): entered
http_long_ParseURL(): entered
do_post(): entered
POST /ODWebServicesWeb/services/ODWebServices HTTP/1.1
Host: 10.95.197.153:9080
User-Agent: http-api/1.23
Content-Type: text/xml; charset=UTF-8
SOAPAction: "http://webServices.global.officedepot.com";
Expect: 100-continue
Content-Length: 370


recvresp(): entered
HTTP/1.1 100 Continue
Content-Length: 0
Date: Fri, 23 Jan 2009 12:40:16 GMT
Server: WebSphere Application Server/6.1


SetError() #13: HTTP/1.1 100 Continue
senddoc(): entered
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"; xmlns:web="http://webServices.global.officedepot.com";> <soapenv:Header/> <soapenv:Body> <web:testGetCdapStrings> <tempUserId>user</tempUserId> <tempPassword>pwd</tempPassword> <brandChar></brandChar> <localeString></localeString> </web:testGetCdapStrings> </soapenv:Body> </soapenv:Envelope>
recvresp(): entered
HTTP/1.1 200 OK
Date: Fri, 23 Jan 2009 12:40:16 GMT
Server: WebSphere Application Server/6.1
Content-Type: text/xml; charset=utf-8
Content-Language: en-US
Content-Length: 508


SetError() #13: HTTP/1.1 200 OK
recvdoc parms: identity 508
header_load_cookies() entered
recvdoc(): entered
SetError() #0:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"; xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"; xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";><soapenv:Header/><soapenv:Body><p982:testGetCdapStringsResponse xmlns:p982="http://webServices.global.officedepot.com";><testGetCdapStringsReturn>sessionId:0000498~signatureId:06d5n</testGetCdapStringsReturn></p982:testGetCdapStringsResponse></soapenv:Body></soapenv:Envelope>
http_close(): entered
**Please note  - the response (testGetCdapStringsReturn) shown here (after downloading to windows notepad) is having the tilda properly. But when I view it in my AS400, it shows the response as sessionId:0000539¯signatureId:06d5x.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


HTTPAPI Ver 1.23 released 2008-04-24
OS/400 Ver V5R3M0

New iconv() objects set, PostRem=1252. PostLoc=500. ProtRem=1252. ProtLoc=500
http_persist_open(): entered
http_long_ParseURL(): entered
DNS resolver retrans: 2
DNS resolver retry  : 2
DNS resolver options: x'00000136'
DNS default domain: ODEUROPE.COM
DNS server found: 10.136.22.36
DNS server found: 10.136.22.35
http_persist_post(): entered
http_long_ParseURL(): entered
do_post(): entered
POST /ODWebServicesWeb/services/ODWebServices HTTP/1.1
Host: 10.95.197.153:9080
User-Agent: http-api/1.23
Content-Type: text/xml; charset=UTF-8
SOAPAction: "http://webServices.global.officedepot.com";
Expect: 100-continue
Content-Length: 370


recvresp(): entered
HTTP/1.1 100 Continue
Content-Length: 0
Date: Fri, 23 Jan 2009 13:03:54 GMT
Server: WebSphere Application Server/6.1


SetError() #13: HTTP/1.1 100 Continue
senddoc(): entered
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"; xmlns:web="http://webServices.global.officedepot.com";> <soapenv:Header/> <soapenv:Body> <web:testGetCdapStrings> <tempUserId>user</tempUserId> <tempPassword>pwd</tempPassword> <brandChar></brandChar> <localeString></localeString> </web:testGetCdapStrings> </soapenv:Body> </soapenv:Envelope>
recvresp(): entered
HTTP/1.1 200 OK
Date: Fri, 23 Jan 2009 13:03:54 GMT
Server: WebSphere Application Server/6.1
Content-Type: text/xml; charset=utf-8
Content-Language: en-US
Content-Length: 508


SetError() #13: HTTP/1.1 200 OK
recvdoc parms: identity 508
header_load_cookies() entered
recvdoc(): entered
SetError() #0:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"; xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"; xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";><soapenv:Header/><soapenv:Body><p982:testGetCdapStringsResponse xmlns:p982="http://webServices.global.officedepot.com";><testGetCdapStringsReturn>sessionId:0000539~signatureId:06d5x</testGetCdapStringsReturn></p982:testGetCdapStringsResponse></soapenv:Body></soapenv:Envelope>
http_close(): entered
HTTPAPI Ver 1.23 released 2008-04-24
OS/400 Ver V5R3M0

New tables set, ASCII=QTCPASC. EBCDIC=QTCPEBC
http_persist_open(): entered
http_long_ParseURL(): entered
DNS resolver retrans: 2
DNS resolver retry  : 2
DNS resolver options: x'00000136'
DNS default domain: ODEUROPE.COM
DNS server found: 10.136.22.36
DNS server found: 10.136.22.35
http_persist_post(): entered
http_long_ParseURL(): entered
do_post(): entered
POST /ODWebServicesWeb/services/ODWebServices HTTP/1.1
Host: 10.95.197.153:9080
User-Agent: http-api/1.23
Content-Type: text/xml; charset=UTF-8
SOAPAction: "http://webServices.global.officedepot.com";
Expect: 100-continue
Content-Length: 0


recvresp(): entered
HTTP/1.1 100 Continue
Content-Length: 0
Date: Fri, 23 Jan 2009 14:10:53 GMT
Server: WebSphere Application Server/6.1


SetError() #13: HTTP/1.1 100 Continue
senddoc(): entered
recvresp(): entered
HTTP/1.1 500 Internal Server Error
Date: Fri, 23 Jan 2009 14:10:53 GMT
Server: WebSphere Application Server/6.1
Content-Type: text/xml; charset=utf-8
Content-Language: en-US
Content-Length: 577
Connection: Close


SetError() #13: HTTP/1.1 500 Internal Server Error
recvdoc parms: identity 577
header_load_cookies() entered
recvdoc(): entered
SetError() #0:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"; xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"; xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";><soapenv:Header/><soapenv:Body><soapenv:Fault xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";><faultcode>soapenv:Server.generalException</faultcode><faultstring>org.xml.sax.SAXParseException: The root element is required in a well-formed document. Message being parsed: </faultstring></soapenv:Fault></soapenv:Body></soapenv:Envelope>
SetError() #13: HTTP/1.1 500 Internal Server Error
http_close(): entered
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------