tags:

views:

41

answers:

1

Is it "application/x-www-form-urlencoded", "multipart/form-data", "application/xml", "text/xml" or something else? And more importantly, how do I know when to use which?

This is a very old article which says to use "multipart/form-data" and that "application/x-www-form-urlencoded" is bad. Is that still valid advice? http://skew.org/xml/misc/xml_vs_http/#post

I'm not really using a framework - I want to hand-code this as much as possible.

Cheers!

+1  A: 

It depends how you are encoding the data. You could use any of those (under the right circumstances).

If you are serving up XML as the message body without doing any other encoding on it, then you probably want application/xml.

The article has an example and mentions (with some almost decade old examples) that this is problematic if the server side processor doesn't support it.

If you are writing said processor, then you just have to make sure that you write it so that it does.

David Dorward
Thanks for the reply. My goal is to make requests and receive responses from this service, so how do I know if it supports it? https://testweb.commidea.com/commideagateway/commideagateway.asmx?op=ProcessMsg
Brian Fenton
@Brian - You read its documentation. It has a big example for you to crib from! The things to note are that (1) It uses SOAP, not plain XML (so use a SOAP library) and (2) It uses a text/xml header.
David Dorward
Thanks David, I don't really have access to a SOAP library - hence wanting to handcode the XML requests. I'm struggling as (1) I'm using ancient software and (2) I don't really know what I'm doing! :-)I missed that it expects a "text/xml header, so does that make my original question redundant?
Brian Fenton
(1) I'd fix the underlying system rather then trying to build on a shaky foundation (2) Pretty much
David Dorward
Sound advice but certain things are out of my control. Thanks for the education!
Brian Fenton