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

Re: [Ftpapi] (no subject)



HTTP_xlate() is intended for translation the protocol data and not the
POST data. You need to call HTTP_xlatedyn() instead.

Background: http_setCcsids() sets the ccsids for translating the http
protocol data and the POST data. The first 2 parameters specify the
CCSIDs of the POST data, whereas the next 2 parameters are used for the
protocol data.

The first 2 parameters are used to create the pToEBCDIC and pToASCII
iconv() handles for translating POST data. The last 2 parameters are
used for creating the toEBCDIC and toASCII iconv() handles.

http_xlate() calls CCSIDxlate(), which uses ToASCII and ToEBCDIC, which
are the iconv() handles for translating protocol data.

HTTP_xlatedyn() calls CCSIDXLateDyn(), which uses pToAscii and pToEbcdic.

I wished the http_xlate* names would have been more meaningful.

Thomas.


Am 06.10.2017 um 12:00 schrieb Bala Kandasamy:
> Hi Scott,
> 
> I'm having problem with the message text (especially german characters u
> with double dot above) returned by the Rest service which is UTF-8.
> CCSID of my screen is 1141 (Euro german) and job CCSID is 273 (german).
> I went through some of the questions and answers posted at this forum
> and has been told to use the http_setCCSIDs which converts request from
> job ccsid and response back to the job ccsid as well, but it seems to no
> avail. Could someone enlighten me what should I do here :-
> 
> 
>     D*
>      DResponse       S         65535A Varying Inz
>    
>  *______________________________________________________________________
>      * Call the URI of Order Processing in order to get the
>      * result of the call
>    
>  *______________________________________________________________________
>      PSHARED_callExternalPostRestService...
>      P                B                  Export
>      D               Pi                LikeDs(SHARED_ResponseObject)
>      DRequestUri              65535A Options(*Varsize) Varying
>      DDebug_FileName          65535A Options(*Varsize) Varying
>      DRequestString            65535A Options(*Varsize) Varying
>      D*
>      DresponseObject DS                LikeDs(SHARED_ResponseObject)
>      DPointer        S              *
>      Drc             S            10I0
>      D*
>      /Free
>        ClearResponse;
> 
>        http_setCCSIDs(1208:0);
>        http_debug(*ON:Debug_FileName);
> 
>        pointer =http_persist_open(RequestUri);
> 
>        if(pointer =*null);
>            responseObject.Response =http_error;
>            responseObject.StatusCode =-1;
>            returnresponseObject;
>        endif;
> 
>        rc =http_persist_req('POST':pointer:RequestUri
>                               :0:*null:
>                               %addr(RequestString:*data):
>                               %len(RequestString):
>                                0:%paddr(saveResponse):60:'':
>                               'application/json');
> 
>        http_persist_close(Pointer);
> 
>        if(rc =1);
>           responseObject.Response =*Blanks;
>           responseObject.StatusCode =rc;
>           returnresponseObject;
>        EndIf;
> 
>        responseObject.Response =Response;
>        responseObject.StatusCode =rc;
>        returnresponseObject;
> 
>      /End-Free
>      P                E
>    
>  *______________________________________________________________________
>      *  saveResponse - This subprocedure reads the result returned by the
>      *  service
>    
>  *______________________________________________________________________
>      PsaveResponse   B
>      D               Pi           10i0
>      Dfd                         10i0value
>      Ddata                    65535A options(*varsize)
>      Dlength                     10i0value
>      C*
>      /Free
>            If(length >0);
>              HTTP_xlate(length :data :TO_EBCDIC);
>              response +=%subst(data :1:length);
>            ENDIF;
>            returnlength;
>      /End-Free
>      P                E
>    
>  *_________________________________________________________________________
>      *  Evaluate the Json Response message
>    
>  *_________________________________________________________________________
>      PSHARED_getJsonValue...
>      P                B                  Export
>      D               PI        65535A Varying
>      D Json_Message            65535A Varying value
>      D Key                       32A Varying Const
>      D
>      D*
>      D docNode       S                Like(yajl_val)
>      D node          S                Like(yajl_val)
>      D errMsg        S           500   Varying
>      D MessageReturn...
>      D               S         65535   Varying
>      C*
>      /Free
>         docNode =yajl_buf_load_tree(%addr(Json_Message:*data):
>                                       %len(Json_Message):
>                                        errMsg);
>         if(errMsg <>'');
>             returnerrMsg;
>         Endif;
> 
>         node =yajl_object_find(docNode:Key);
>         MessageReturn =yajl_get_string(node);
>         yajl_tree_free(docNode);
> 
>         ReturnMessageReturn;
>      /End-Free
>      C*
>      P                E
>                                                              
> 
> 
-- 
_______________________________________________
Ftpapi mailing list
Ftpapi@xxxxxxxxxxxxxxxxxxxxxx
http://scottklement.com/mailman/listinfo/ftpapi