SOAP and Web Services
Using SOAP and Web Services
15
Authentication
You may use the
request
method’s
oAuthenticate
parameter to specify how to
handle HTTP authentication or provide credentials used in Web Service Security (WS-
Security). Normally, if authentication is required, an interface will handle HTTP
authentication challenges for BASIC and DIGEST authentication using the SOAP header,
thus making it possible to engage in encrypted or authenticated communication with the
web service. This parameter helps to automate the authentication process.
The
oAuthenticate
parameter contains two properties:
●
●
Username
: A string containing the username
Password
: A string containing the authentication credential
Its usage is shown in the following example:
// Create the oAuthenticate object:
var myAuthentication = {
Username: "myUsername",
Password: "myPassword"
};
// Invoke the web service using the username and password:
var response = SOAP.request ({
cURL: myURL,
oRequest: echoStringRequest,
cAction: mySOAPAction
oAuthenticate: myAuthentication
});
Error Handling
The
SOAP
object provides extensive error handling capabilities within its methods. In
addition to the standard Acrobat JavaScript exceptions, the
SOAP
object also provides
SOAPError
and
NetworkError
exceptions.
A
SOAPError
exception is thrown when the SOAP endpoint returns a SOAPFault. The
SOAPError
exception object will include information about the SOAP Fault code, the
SOAP Actor, and the details associated with the fault. The
SOAP
object’s
connect
and
request
methods support this exception type.
A
NetworkError
exception is thrown when there is a problem with the underlying HTTP
transport layer or in obtaining a network connection. The
NetworkError
exception
object will contain a status code indicating the nature of the problem. The
SOAP
object’s
connect
,
request
, and
response
methods support this exception type.
Acrobat JavaScript Scripting Guide
255