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

Re: [Ftpapi] Sending JSON Body in HTTP_POST



I was using http_post, with http_setCCSID. I tried 819 and 1208. The sequence:

Create File

http_setCCSIDs( 819 : 0 );

// http_setCCSIDs( 1208: 0 ); 

rc = http_post( URI

              : %addr(json)+2  // I also tried it without the +2

              : length

              : ifsPath);  

   

When I contacted the list, I hadn’t been able to see what the service was receiving. The service provider couldn’t even see it. He eventually started bouncing it back to me and it was pure garbage.

Eventually I changed to using http_post_stmf, creating the JSON file with with CCSID of 819, which is what the service provider requested. I got the same result.

Then, curiously, I sent the end-point developer a note explaining all that I’d done. He looked at the document, I’m guessing for the first time, and the next morning it was working. Hmmmm…

Anyway, thanks for the reply.

Tony


On April 21, 2018 at 2:24:01 PM, Scott Klement (sk@xxxxxxxxxxxxxxxx) wrote:

Tony,

Can you show us how you are calling HTTPAPI.

Also you mentioned something about using "UC2" fields (UCS2, perhaps?) can you elaborate on that?  Most importantly, what encoding is the data in at the time that it is passed to HTTPAPI, and what encoding settings you're using in HTTPAPI.  Showing the code (rather than a description) is most helpful.

-SK


On 4/18/18 8:20 AM, Tony Cate wrote:
The endpoint is Camel (Java) service. That service uses Jackson to parse JSON, and it's throwing illegal character errors.

The JSON is pretty straight forward, and validates as correct here: https://jsonformatter.curiousconcept.com/

It's pretty simple (dumbed down:
{  
   "item":"JF1GH7G6",
   "userID":"1658",
   "sellerID":"SELLER",
   "Year":2010,
   "Style":"SW4D",
   "flags":{  
      "salvage":"false",
      "biohazard":"false",
      "fire":"false",
      "flood":"false"
   },
   "damage":[  
      {  
         "damageCode":258,
         "severityCode":54
      }
   ]
} 

I've read through this thread at your site: https://www.scottklement.com/archives/ftpapi/201308/msg00061.html

I've used the hex and UC2 values for brackets, braces, and comma's. set the ccsid to 819 (which Java purportedly likes) and 1208 as noted in the referenced post. Nothing seems to help. I asked the endpoint owner (internal) to send me back what was recieved and its gibberish...which is probably a hint of some sort.

Tony Cate


--
Tony Cate | Senior Programmer/Analyst | 704.872.2458 x 126
Auction Edge, Inc.
AUCTION EDGE, INC. | Powering Independent Auctions
STATESVILLE, NC | 704.872.2458



--
_______________________________________________
Ftpapi mailing list
Ftpapi@xxxxxxxxxxxxxxxxxxxxxx
http://scottklement.com/mailman/listinfo/ftpapi
-- 
_______________________________________________
Ftpapi mailing list
Ftpapi@xxxxxxxxxxxxxxxxxxxxxx
http://scottklement.com/mailman/listinfo/ftpapi