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

Re: HTTPAPI - character set utf-8



German,
 
Here is a snippet of code that worked for a project that I was working on, but was tabled. I have forgot quite a bit about it. Hope it helps.
 
Jay
 
 /free 
       
 data = '' + CRLF +                                
       '<soap:Envelope '                                              + 
       'xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" '      + 
       'xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" '   + 
       'xmlns:tns="http://com/iix/soap/SoapAuth.wsdl" '               + 
       'xmlns:types="http://com/iix/soap/SoapAuth.wsdl/encodedTypes" '+ 
       'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" '       + 
       'xmlns:xsd="http://www.w3.org/2001/XMLSchema"> '+ CRLF +         
       '<soap:Body '+                                                   
     'soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> '+
       CRLF +                                                           
       '<q1:sendRequest xmlns:q1="auth">' + CRLF +                      
       '<message xsi:type="xsd:string">' +                              
       MvrDs                             +                              
       '</message>' + CRLF +                                            
       '</q1:sendRequest>' + CRLF +                                     
       '</soap:Body>' + CRLF +                                          
       '</soap:Envelope>';   
 /end-free  
                                                        
 
c                   eval      rc=http_url_post(                           
c                                 'https://expressnet.iix.com/'+          
c                                 'web-services/Auth':                    
c                                  %addr(data): %len(%trimr(data)):       
c                                  '/tmp/sendrequest-mvr.txt':9:          
c                                  'HTTP_USERAGENT':                      
c                                  'text/xml':                            
c                                  SoapAction)                            
c                   if        rc <> 1                                     
c                   eval      msg = http_error                            
c                   dsply                   msg                           
c                   return                                                
c                   endif                                                 
                                                                          
 **                                                                       
c                   callp     cmd('DSPF ''/tmp/sendrequest-mvr.txt''': 200)
c                   return                                                
----- Original Message -----
Sent: Thursday, February 09, 2006 10:45 PM
Subject: HTTPAPI - character set utf-8

Has anybody called a web service that is expecting a Content-Type of text/xml; charset=utf-8 using HTTPAPI and SOAP?

 

I just had a couple of questions if anybody has gotten this to work:

1) When I build the SOAP package, do I still need to convert this to UTF-8 (ccsid of 1208)?

            I am thinking that I definitely need to do some sort of conversion because the error I get from the httpapi_debug.txt file is:

SetError() #13: HTTP/1.1 500 Internal Server Error.

recvdoc parms: identity 53                        

recvdoc(): entered                                 

SetError() #0:                                    

Request format is invalid: text/xml; charset=utf-8.

 

I tried converting this with iconv() before the http_url_post_xml but still get the above message.

 

2) Here?s the SOAP package, does it need a CRLF (const(x?od25)) at the end of each line?

xml =                                                                   

'<?xml version="1.0" encoding="utf-8"?>' +  CRLF +          

'<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' +

' xmlns:xsd="http://www.w3.org/2001/XMLSchema" ' +                      

'xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">' +   CRLF +  

'  <soap:Body>' +                                         CRLF +

'    <LoadROList xmlns="http://rcis.com/">' +            CRLF +               

'      <sintCropYear>2005</sintCropYear>' +               CRLF +              

'      <sintStateId>27</sintStateId>' +                          CRLF +      

'      <sintInsuranceType>11</sintInsuranceType>' +   CRLF +                  

'    </LoadROList>' +           CRLF +                                        

'  </soap:Body>' +   CRLF +                                                    

'</soap:Envelope> + CRLF';                                                     

 

 

THANKS for all the help.