Web Services, Part IV: WebService Behavior's Objects, Properties, and Events: The Call Object (2) - Doc JavaScript | WebReference

Web Services, Part IV: WebService Behavior's Objects, Properties, and Events: The Call Object (2) - Doc JavaScript


Web Services, Part IV: WebService Behavior's Objects, Properties, and Events

The Call Object (2)

The password property specifies a password for Web services that requires user authentication. This property is case-sensitive and must match the userName property the very same call object. For this password to be in effect, remember to pass the call object as one of the parameters of callService().

The portName property specifies a port name through which you can access resources provided by a Web service. Here is an example for a port definition in a WSDL format:


<port name="TemperaturePort"
  binding="tns:TemperatureBinding">
  <soap:address location=
    "https://services.xmethods.net:80/soap/
      servlet/rpcrouter"/>
</port>

Usually, specifying the Web service port name is not needed. When you specify the Web service method, it determines the port name uniquely. The WSDL's binding attribute selects the right port for the specified Web service method. This property does not have a default, and you must pass the call object in callService() if you want to set it.

The SOAPHeader property specifies a SOAP header that will overwrite the default SOAP header normally generated by the WebService behavior. This property can be of three data structures:

Here is an example that shows how to assemble a SOAP header:

callObj.SOAPHeader = "<SOAP-ENV:Header>";
callObj.SOAPHeader += "<t:Transaction xmlns:t=
             'some-URI' SOAP-ENV:mustUnderstand='1'>";
callObj.SOAPHeader += 5;
callObj.SOAPHeader += "</t:Transaction>";
callObj.SOAPHeader += "</SOAP-ENV:Header>";  

The timeout property specifies a timeout period for a remote method invocation. Set it to the number of seconds you want the WebService behavior to wait for an answer from the remote Web service. To quit after two minutes, you will specify:

callObj.timeout = 120; 

The userName property specifies a user name for those Web services that require authentication. This property is case-sensitive and must correspond to the password property of the very same call object. The following two lines set both:

callObj.userName = "anonymous"
callObj.password = "none"

Next: How to use the WebService Behavior

Next: What are the result object's properties

https://www.internet.com


Produced by Yehuda Shiran and Tomer Shiran
All Rights Reserved. Legal Notices.
Created: December 17, 2001
Revised: December 17, 2001

URL: https://www.webreference.com/js/column99/3.html