↑
Main Page
SOAPHeaderBlock
?
The operation name (such as “getTemp”)
?
The target namespace.
?
The number of header blocks provided for the request
?
An array of
SOAPHeaderBlock
objects (not required for most Web services)
?
The number of parameters being passed
?
Any array of
SOAPParameter
objects
Lastly, use the
asyncInvoke()
method to make the call to the server. This method takes only one argu-
ment, a function that is called when the Web service returns a result. If you have a function named
onWebServiceResult
, the code looks like this:
oSoapCall.asyncInvoke(onWebServiceResult);
The callback function itself has the following format:
function onWebServiceResult(oResponse, oSoapCall, iError) {
//...
}
Callback functions accept three arguments: a
SOAPResponse
object, the
SOAPCall
object, and an error
code. The
SOAPResponse
object contains all the information about a successful request. The properties
are listed in the following table.
Property
Description
actionURI
The
SOAPAction
header string (may be an empty string)
body
The
<Body/>
element of the SOAP response
encoding
A
SOAPEncoding
object indicating the encoding of the response
envelope
The
<Envelope/>
element of the SOAP response
fault
A
SOAPFault
object if a fault occurs;
null
otherwise
header
The
<Header/>
element of the SOAP response or
null
if it doesn’t exist
message
A DOM document for the SOAP response
methodName
The name of the method invoked. Most of the time, this is the tag name
of the element represented by the
body
property (typically
“Body”
).
targetObjectURI
The target namespace of the response
version
The SOAP version number (if it can be obtained from the envelope). One
of the following constants: 0 for version 1.1, 1 for version 1.2, and 65535
if the version is unknown.
The second argument of the callback function is the same instance of
SOAPCall
that was used to make the
request. The third argument is an error code that indicates a problem with the client-server communication;
519
Web Services
20_579088 ch17.qxd 3/28/05 11:42 AM Page 519
Free JavaScript Editor
Ajax Editor
©
→