Net.HTTP methods

request

request

8.0

 

S 

F 

The request method asynchronously invokes an HTTP Web Service. This method allows connecting to a wider set of web services than the Net.SOAP.request (SOAP.request) method and with finer control over the HTTP method, headers and / or body. This method allows the creation of more complicated networking protocols such as WebDAV or the Atom Publishing Protocol.

Note:This method can only be made outside the context of a document (for example, in a folder level JavaScript).

Parameters

cVerb 

A string that specifies the HTTP verb to use. The verb must be one of the following:

JS_API_AcroJS00101.jpg

 

cURL 

A string that specifies the network endpoint location of the web service to connect to. The scheme of the URL must be either HTTP or HTTPS.

aHeaders 

(optional) An array that specifies HTTP headers to be sent with the request. Some headers such as Content-length cannot be set explicitly. Each element in the array is an object describing the header with the following properties:

JS_API_AcroJS00104.jpg

 

oRequest 

(optional) A Stream object that specifies the request body of the method. No encoding of the message body is done prior to sending it.

oHandler 

(optional) An object that handles the response from the service. The oHandler object will have the response method invoked with the following parameters:

JS_API_AcroJS00107.jpg

 

oAuthenticate 

(optional) An object that specifies how to handle HTTP authentication or specifies credentials to use. The default is to present a user interface to the user to handle HTTP authentication challenges for BASIC and DIGEST authentication modes. The oAuthenticate object can have the following properties:

JS_API_AcroJS00110.jpg

 

Exceptions

The method throws an exception if the URL is invalid or the same, origin requirement is not satisfied.

Example

Create a collection at the URL specified.

CreateWebDAVCollection = function(cURL)

{

   var params =

   {

      cVerb: "MKCOL",

      cURL: cURL,

      oHandler:

      {

         response: function(msg, uri, e)

            {

               // HTTP 405 - Can't MKCOL if it exists!

               if(e != undefined && e.error != 405) {

                  app.alert("Failed to MKCOL: "+ e);

               } else app.alert("Created collection");

            }

         }

      };

      Net.HTTP.request(params);

} // CreateWebDAVCollection