PostNetText

From Director Online Wiki
Jump to: navigation, search

Syntax

from MX 2004 Documentation

postNetText(url, propertyList {,serverOSString} {,serverCharSetString})
postNetText(url, postText {,serverOSString} {,serverCharSetString})

Undocumented Syntax

Director 10.1: The propList might also contain the property #mimetype

postNetText(url, postText {,serverOSString} {,characterSet} {,mimeType})

mimeType Optional. The mimeType parameter can be used to specify a mime type for the request. When postNetText is called with a propertylist for encoding of CGI queries, the mime type is set to "application/x-www-form-urlencoded". When a program uses the alternate form, a string instead of property list, the postText string is sent to the server as an HTTP POST request. You can override the default MIME type of "text/plain" with a string passed in as this optional parameter.

Example from the updated Director 10.1 docs

This example function assumes you have a SOAP [Simple Object Access Protocol] string ready to post and you need a custom mime type for it.

on startSoapRequest
  url      = "http://www.markme.com/mxna/webservices/mxna.cfc"
  postText = member("SoapRequest").text
  mime     = "text/xml; charset=utf-8\r\nSOAPAction: " & QUOTE & QUOTE
  return postNetText(url, postText, "Unix", "ASCII", mime)
end

Here is this example in JavaScript syntax.

function startSoapRequest() {
  var url;
  var mime;
  url      = "http://www.markme.com/mxna/webservices/mxna.cfc";
  posttext = member("SoapRequest").text;
  mime     = "text/xml; charset=utf-8\r\nSOAPAction: \"\"";
  return postNetText(url, posttext, "Unix", "ASCII", mime);
}

External links

DevNet: Using webservices with Director