PxPlus User Forum

Twitter Twitter Twitter

Author Topic: *web\request  (Read 523 times)

Jeffrey Ferreira

  • Gold Member
  • ****
  • Posts: 82
    • View Profile
*web\request
« on: July 31, 2019, 01:07:44 PM »
Hello List,

I'm using *web\request to communicate with a web\service. I'm quite new to the whole posting to a web service....
I'm having trouble with one of the POST's.

Someone has shown me a tool call post-man to show me what the code looks like in other languages  (like python, node, javascript, etc)
and all of them do this thing where they wrap the POST_BODY in this webkitformboundary

my post fails...
i'm just curious...do i have to do this webkitformboundary or does *web\request do this for me...

payload = "------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"filename\"; filename=\"DiscountUpdate.xml\"\r\nContent-Type: application/xml\r\n\r\n\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--"

headers = {
    'content-type': "multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW",
    'Content-Type': "application/x-www-form-urlencoded",

Mike King

  • Administrator
  • Diamond Member
  • *****
  • Posts: 3361
  • Mike King
    • View Profile
    • PVX Plus Technologies
Re: *web\request
« Reply #1 on: July 31, 2019, 04:40:35 PM »
If the post requires multi-part form data then you would need to create the boundary headers yourself, but I have rarely seen any 'Application-to-Application' transmissions that use multi-part form data transmissions. 

Generally for a post of XML you simply need to provide the XML as the posting data and set the transmission Content type to either "text/xml" or if binary data is involved  "application/xml".

A mutli-part form data transmission is generally only used when you have a web page that includes an attached file comes from a browser.  The web page form data (input fields) will be in one portion of the post, with the attachment(s) -- each separated by boundary lines and each with their our content-type specification.


Jeffrey Ferreira

  • Gold Member
  • ****
  • Posts: 82
    • View Profile
Re: *web\request
« Reply #2 on: August 01, 2019, 11:02:21 AM »
Thank you Mike...including the boundary got me a lot further.