AnsweredAssumed Answered

HTTP Post Content Type

Question asked by mikethecreative on Sep 23, 2016
Latest reply on Sep 23, 2016 by mikethecreative

I'm trying to POST to an API that requires the Content Type to be "application/xml." The only solution I'm finding online is to use the Base Elements plug in.

 

The Custom Headers I'm needing to send over are:

user: XXXXXX

pwd: XXXXXX

lan: en

Content Type: application/xml

 

 

------

 

 

With the base elements plugin, I did the following:

 

Set Variable $$xmlHeaders ;

BE_HTTP_Set_Custom_Header ( "Content-Type" ; "application/xml" ) &

 

 

BE_HTTP_Set_Custom_Header ( "user" ; "XXXXXX" ) &

 

 

BE_HTTP_Set_Custom_Header ( "pwd" ; "XXXXXX" ) &

 

 

BE_HTTP_Set_Custom_Header ( "lan" ; "en" )

Set Variable $$xmlPost ;

BE_HTTP_POST ( "http://api.website.com/order-api/orderService?" ; "xml=" & $$xmlMaster )

 

 

------

 

 

In the Data Viewer, I'm getting the following:

 

$$xmlHeaders ;

HTTP/1.1 100 Continue

 

 

HTTP/1.1 400 Bad Request

Server: nginx/1.4.4

Date: Fri, 23 Sep 2016 07:25:48 GMT

Content-Type: text/html

Content-Length: 158

Connection: keep-alive

 

$$xmlPost ;

javax.xml.bind.UnmarshalException

- with linked exception:

[org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.]

 

 

 

For BE_HTTP_Response_Code I'm getting:

400

 

For BE_HTTP_Response_Headers I'm getting:

HTTP/1.1 100 Continue

 

 

HTTP/1.1 400 Bad Request

Server: nginx/1.4.4

Date: Fri, 23 Sep 2016 07:25:48 GMT

Content-Type: text/html

Content-Length: 158

Connection: keep-alive

 

 

Any help would be appreciated. Maybe I don't need this plugin? I'm really not too sure. I know it's not the XML that Filemaker is generating because I"m able to use a Firefox Extension to POST and it works fine. But I really want to be able to Post via Filemaker and not have to use an additional app.

Outcomes