Base_Elements (or other plugin) is the way to go if you need to set headers - you can't do it in FileMaker natively.
Looking at your responses, it looks like there is something wrong with the XML you are posting. Try to check if it is well-formed. If you have xsd, try to validate it.
Agreed with nicolai, the problem seems to be in the payload you are sending. The BE plugin has a trace function that will give you a lot more output, might be useful.
Another thing that could be useful is to use a tool like POSTMAN or SOAPUI to test the request.
If I copy the $$xmlMaster content from the data viewer, I'm able to use a Firefox Posting Extension (called Poster) to post the data. so the XML data that is being generated by FileMaker works fine. It has to be the way this plugin is trying to post it or somewhere where I don't have something set correctly.
Notice the error shows "Content-Type: text/html." That should be "application/xml."
How do I know if I'm resetting my header somewhere in the script? Does my current $$xmlHeaders look correct? I'm stumped.
1 of 1 people found this helpful
I think the clue is in $$xmlPOST but also use BE_trace in your data viewer to see if it yields more clues.
The service does not like your XML as it is formed by FM while the other tools may do subtle substitutions as you copy and paste the XML into the tools to try it there.
You may have to specify the charset as part of setting the content type:
also: are you sure it needs to be 'application/xml' and not 'text/xml'?
Yes, I'm positive it has to be "application/xml." If I leave it as "text/xml" in the Firefox Extension, it won't post.
You can reset headers by running another "BE_Set_Custom_Header ( content-type" in your script
I am not sure if after posting the headers are being reset back to the default, so I usually set headers every time before I post or put.
How do you set your $$xmlHeaders?
since folks are saying the xml isn't well formed, it occurred to me that there might be funky characters within the data. I use this to format single elements (but in a custom function) ...
"<" & $tag & ">" &
Substitute ( $data;
"</" & $tag & ">"
I'm on Windows. When I want to verify xml, I paste it into Notepad and save it as test.xml. Then I open test.xml in Internet Explorer.
Hey all, thank you so much for the help. I am adding some screenshots to better explain what's happening.
Screenshots of an extension called "Poster" that I use in Firefox. I set a few parameters and copy my XML content from the data viewer in Filemaker and I'm able to POST to our API.
Screen 01 (content to send) contains: URL, Content Type, XML Content
Screen 02 (headers) contains: URL, User, Password and Language
I'm wanting to do this in Filemaker but I can't figure out how. This is the script I wrote using the Base Elements plugin. The errors I'm getting are at the top of this thread.
Maybe I'm not setting the headers or something correctly. I'm not too sure.
YAAAASSS I JUST FIGURED IT OUT. I don't need the "xml=" before the $$xmlMaster on the BE_HTTP_POST. I noticed that it was getting sent over as plain text before the XML when I used the BE_Curl_Trace function.
Ughhh, I'm such a newb.
Thanks so much for the help everyone!!
P.S. If you see something that needs improvement in my script, please share.