SoapConnection:
SetOptions method
Description
Sets connection options for SoapConnection class.
Syntax
1 |
<span>conn</span>.<span>SetOptions</span> (string <span>options</span>) |
Argument |
Description |
---|---|
conn |
The name of the SoapConnection object |
options |
Options you want to set for your connection.
|
Return Values
Long. Valid values are 0
for
success, and 50
for failure.
If multiple options are specified and the return value is 50
,
options specified before the failure are still valid.
Examples
In this example, the application enables the logging
function and attempts to connect to an endpoint for which no user
ID, password, or timeout has been set.
1 |
lOpt=Conn.SetOptions("SoapLog=~"airportweather.log~"") |
To avoid using escape characters before a second pair of quotation
marks, use single quotation marks instead, or you can start an exterior
string with single quotation marks and use double quotation marks
around an interior string:
1 |
lOpt=Conn.SetOptions('SoapLog="airportweather.log"') |
Usage
User ID and password values can be set in an endpoint used
by the SoapConnection class or by including these values as arguments
to the SetOptions method.
Priority is given to values set in an endpoint (port) that
is passed as an argument to the CreateInstance method
of the SoapConnection class. However, a default endpoint is used
when an endpoint is not set in the CreateInstance method.
In this case, priority is given to user ID and password values defined
in the SetOptions method.
If the endpoint used by the SoapConnection class does not
have user ID and password values, and you do not set a user ID or
password with the SetOptions method, the SoapConnection
class connects to a SOAP server without giving a user ID or password.
If a user ID is defined in either the endpoint or the SetOptions method
but is not a password, the password value is taken to be an empty
string.
When you set a timeout other than the default, an exception
is thrown after the Web service connection times out. Even if you
do not set a timeout value from the client, the Web server can cause
the request to time out on the server side.
If you include ConnectionCache as an argument in a SetOptions call,
you must not use quotation marks to enclose the value that you set
for this option.
Although SetOptions takes a single string
argument for all available options, you can set each of the options
with more specific methods. You can use the following methods to
replace SetOptions:
For .NET Web services |
For EasySoap Web services |
---|---|