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

Re: HTTPAPI - Post ends up NULL



Thanks Mike,

I did just try that content type but the post still failed.

Snippet from log:

User-Agent: application/x-www-form-urlencoded Content-Type: text/xml Content-Length: 14 Cookie: $Version=0; JSESSIONID=6608F4420AC8259390F7C8429EB0FC37.jvm1; $Path=/restful;




senddoc(): entered status=test123 recvresp(): entered HTTP/1.1 200 OK Server: Apache-Coyote/1.1 Content-Type: application/json Transfer-Encoding: chunked Date: Wed, 09 Oct 2013 15:47:52 GMT

On 10/9/2013 11:25 AM, Mike Krebs wrote:
You are creating the data correctly. As you can see, the data is being sent. What content-type are you sending? Maybe your REST service is not recognizing the content as what it expects?

Other comments that might be helpful...

For most of us with simple services, there is no need to setCCSID. If you are getting garbage sent, you might need it but it begs the question of how your system and job CCSID are set.

The addvar is a valid way to create formdata but the webForm support is a little more intuitive - even though it does the same thing. It just makes it a little easier to read. From EXAMPLE10 (V1.24):

     form = WEBFORM_open();
     WEBFORM_setVar(form: 'status': newstatus );
     WEBFORM_postData(form: postData: postDataSize );

     rc = http_post_xml( 'http://twitter.com/statuses/update.xml'
                       : postData
                       : postDataSize
                       : *null
                       : %paddr(xmlReply)
                       : %addr(tweet)
                       : HTTP_TIMEOUT
                       : HTTP_USERAGENT
                       : 'application/x-www-form-urlencoded' ); // <==this is the content-type
     WEBFORM_close(form);


-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Brian
Sent: Wednesday, October 09, 2013 9:32 AM
To: HTTPAPI and FTPAPI Projects
Subject: HTTPAPI - Post ends up NULL

Hi all,

I am trying to use HTTPAPI to post data.  Ultimately the data will be
JSON, but for now, any data will do.  The data is being posted to a
Linux server.

Here is a simple HTML form that works perfectly.  Whatever I put in the
"status" field lands on the service no problem.

<FORM action="http://server.domain.com/restful/"; method="post">
      <P>
      <INPUT type="text" name="status" value=""><BR>
      <INPUT type="submit" value="Send"> <INPUT type="reset">
      </P>
   </FORM>

However, if I do the same thing from HTTPAPI, the value for "status"
ends up NULL.

I've tried using the following code as a simple test, without any success:

HTTP_setCCSIDs(1208: 0: 1208: 0);
enc = http_url_encoder_new();
http_url_encoder_addvar_s( Enc
                           : 'status'
                           : 'test123');
callp     http_url_encoder_getptr( Enc
                                   : myPointer
                                   : dataSize );
rc = http_url_post(url
                   : myPointer
                   : dataSize
                   : ResultFile);
http_url_encoder_free(Enc);


  From the debug log, I can see this:
senddoc(): entered
status=test123
recvresp(): entered
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1

But, the server reports no data from the post.

I've tried lots of combinations of HTTP_setCCSIDs and even without it at
all, but those result in failed posts and garbled data in the log so I
think I have the right settings, but I'm not 100% sold on that.

I can post or send more of the debug log if that would help as well.

Any ideas are greatly appreciated!

Thank you.
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------


-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------