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

Re: Using http post and Rest



Rick,

422 Unprocessable Entity: This means that your XML was well-formed, but it did not understand some or all of it. Perhaps you had an incorrect tag or attribute name? I would compare your XML document carefully against the documentation for the web service.

415 Unsupported Media Type: This refers to the peContentType parameter passed to HTTPAPI from your program, it is the 6th parameter to http_post_stmf(). The default that HTTPAPI ships with is text/xml for all "post" procedures, so it sends the same value for http_post and http_post_stmf. I would check that you're specifying the parameters correctly and that you didn't accidentally add an extra parameter or forget a parameter or something like that -- this is an easy mistake to make. And, of course, check the value of the peContentType parameter if you are specifying it.

Please understand that HTTPAPI is an HTTP tool. It has no code in it whatsoever that is specific to web services -- it only implements the HTTP network protocol. If your web service uses the HTTP functionality for userid/password, then http_setAuth() should work nicely for setting the userid/password. But if it uses some method that is specific to the web service rather than HTTP, you will need to code that yourself.

Also it's important to know that every web service is different. REST is not a standard or a protocol, it is only a paradigm. So you will need to be familiar with exactly what the web service requires. If you can tell us that, then we can tell you how HTTPAPI can be used to provide that requirement. But, simply knowing that it is "post and rest" doesn't tell us very much.

If you are still unable to figure things out after the above information, then you should provide a debug/trace file. This will give us far more information about what is happening.

-SK


On 9/22/2016 9:39 AM, Rick Holm wrote:
    I� need to post an XML file to a Web Service using REST and supplying a
    user id and password.
    I have tried several approaches. Using the HTTPAPI command, it looks
    like the file is being validated by the Web Service, but I end with a
    HTTP 422 Unprocessable Entity.�
    I tried the http_SetAuth for the user id and password and
    http_post_stmf api. The program appears to contact the Web Service but
    I end up with a HTTP 415 Unsupported Media Type.
    Thanks for you help
    Rick Holm



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