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

Re: HTTPAPI - Post ends up NULL



Awesome!  That worked!  Man, I've been fighting with this for some time.

Thanks so much guys for your quick and accurate responses. It's really appreciated!

On 10/9/2013 3:47 PM, Scott Klement wrote:
Brian,

Please try passing 'application/x-www-form-urlencoded' -- that's what
your data appears to be.   (Like Mike Krebs said in his e-mail.)

-SK

On 10/9/2013 10:30 AM, Brian wrote:
Hi Scott,

I've tried not passing the parameter at all, which I believe ends up
sending "xml/text".  The only other value I have tried is
"application/json".

Thanks again for your help!

On 10/9/2013 11:11 AM, Scott Klement wrote:
What are you sending in the content-type parameter of http_url_post()?

For this to work, you'll probably need to specify that this is a
URL-encoded form.  By default (if you specify nothing, and have not
changed the HTTPAPI config) the content-type will be text/xml. In that
case, the server won't be expecting form data -- which might explain why
you're getting 'null' on the server side.

-SK

On 10/9/2013 9:32 AM, Brian wrote:
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
-----------------------------------------------------------------------


-----------------------------------------------------------------------
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
-----------------------------------------------------------------------