Sponsored Links
Sponsored Link

sponsored links

Collapse

Announcement

Collapse
No announcement yet.

HTTPAPI http headers with mixed ccsid's and base64 encoding

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • HTTPAPI http headers with mixed ccsid's and base64 encoding

    I am hoping someone can point me in the right direction. I am using httpapi to communicate with eBay and am required to add base64 encoded tokens into the headers when refreshing user access tokens. The problem I am having is that I have a mix of CCSID's. My job is in CCSID 37, but in order to get the correct encoding, I need to convert the tokens into CCSID 1208 prior to encoding them in base64. Once they are encoded, I cannot append them to a CCSID 37 string. When I attempt to do that I get an error message telling me I cannot convert from CCSID 1208 to CCSID 37.

    I have registered a procedure with httpapi to set all my headers. But it is creating the headers in ccsid 37. I am sure others have had to deal with this as well. Is the solution to create all additional headers in a CCSID 1208 string or is there something in httpapi that will handle this for me? Also, if I need to create my headers in a CCSID 1208 string, is it enough to simply place the CCSID keyword onto the prototype for the registered procedure?

    Here is what my headers should look like:
    --header 'authorization: Basic XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=='
    --header 'content-type: application/x-www-form-urlencoded'

    The long string of X's is base64 encoded starting from CCSID 1208, but all the rest of the header in CCSID 37.

  • #2
    HTTPAPI has a built-in ability to set the authorization header... take a look at the HTTP_SetAuth() routine. It seems odd to me that you are trying to do this manually. Likewise, content-type is automatically set... if you set it manually, you'll end up with two content type headers.

    If you do need to do it manually (and I really don't understand why you would... unless there's something else besides authorization?) then... well, I don't understand the problem. Yes, you have to encode the data when it's already converted to 1208. But, why would you have to convert it back to 37?

    Comment

    sponsored links

    Collapse

    Working...
    X