SOAP Connect . . .
string[] outputs = SoapConnect.InvokeMethod(
"http://www.alethea.net/webservices/LocalTime.asmx?WSDL",
// Specify WSDL
"LocalTimeByZipCode", // Specify method
new string[] {"98052"});
// Specify set of inputs
System.Diagnostics.Debug.WriteLine(outputs[0]); // Check the set of outputs
In addition to simple Web service invocations, SoapConnect also supports:· Network credentials and password based authentication schemes such as as basic, digest, NTLM, and Kerberos authentication.
· Web proxies
· Sessions
· Timeouts
· Custom SOAP requests, SOAP Action and Location
Requirements
SoapConnect
is built using
Microsoft .NET platform. Only the following
platforms with .NET Framework installed are supported:
· Microsoft® Windows® 98
· Microsoft® Windows NT® 4.0 (SP 6a required)
· Microsoft® Windows Millennium Edition (Windows Me)
· Microsoft® Windows® 2000 (SP2 Recommended)
· Microsoft® Windows XP Professional
· Microsoft® Windows XP Home Edition
You can add a reference to SoapConnect from within Visual Studio.NET in all .NET languages (i.e., C#, Managed C++, VB.NET etc).
SoapConnect Members
Public Constructors
|
SoapConnect |
Initializes a new instance of SoapConnect class with a specified WSDL |
Public Properties
|
Request {get;} |
Gets SOAP Request message generated by SoapConnect |
|
Response {get;} |
Gets SOAP Response message returned by the Web service invocation |
|
Session {get; set;} |
Gets or Sets Sessions. true if Sessions are enabled (applies only to Web services that support sessions) |
|
Timeout {get; set;} |
Gets or Sets the number of milliseconds to wait before the request to the Web service times out |
|
Location {get; set;} |
Gets or Sets the Location of the Web service |
|
SoapAction {get; set;} |
Gets or Sets the SOAP Action of the Web service |
Public Static Methods
|
static InvokeMethod |
Static method used to invoke simple Web services |
|
static SetWebProxy |
Static method used to set proxy server information |
Public Methods
|
Invokes a method in the Web service with the specified inputs |
|
|
Creates a SOAP request for the specified method and inputs |
|
|
Sets the network credentials and password authentication information |
|
|
Invokes a method in the Web service with the user-specified SOAP request, Location, SOAP Action and time outs. |
SoapConnect.InvokeMethod
public string[] InvokeMethod(
string strMethod,
string[] astrInputs)
Parameters
strMethod - Name of the Web service method that is being invoked
astrInputs - Array of strings specifying the input values
Return value
Returns an array of strings that contain the array of output valuesExample:
using System;
using SoapConnect;
class LocalTimeTestClass
{
public static void
Main()
{
SoapConnect sc = new SoapConnect("http://www.alethea.net/webservices/LocalTime.asmx?WSDL");
string[] outputs = sc.InvokeMethod("LocalTimeByZipCode", new
string[] {"98052"});
System.Diagnostics.Debug.WriteLine(outputs[0]);
}
}
SoapConnect.CreateRequest
public string CreateRequest(
string strMethod,
string[] astrInputs)
Parameters
strMethod - Name of the Web service method
astrInputs - Array of strings specifying the input values
Return value
Returns the SOAP Request messageExample:
using System;
using SoapConnect;
class LocalTimeTestClass
{
public static void Main()
{
SoapConnect sc = new SoapConnect("http://www.alethea.net/webservices/LocalTime.asmx?WSDL");
string strRequest = sc.CreateRequest("LocalTimeByZipCode",
new string[] {"98052"});
if (sc.InvokeMethodDirect(strRequest, sc.Location, sc.SoapAction,
100000))
{
System.Diagnostics.Debug.WriteLine("The SOAP response
returned is:");
System.Diagnostics.Debug.WriteLine(sc.Response);
}
}
}
SoapConnect.SetAuthentication
public void SetAuthentication(
string strUsername,
string strPassword,
string strDomain,
bool bPreAuthenticate)
Parameters
strUsername - Name of the Web service method
strPassword - Name of the Web service method
strDomain - Name of the Web service method
bPreAuthenticate - Name of the Web service method
Return value
This method has no return value.Example:
using System;
using SoapConnect;
class MappointTestClass
{
public static void Main()
{
// Invoke a Mappoint web service
SoapConnect sc = new SoapConnect("http://staging.mappoint.net/standard-30/mappoint.wsdl");
sc.SetAuthentication ("user", "pass", null, true); // Set authentication
string[] outputs = sc.InvokeMethod("GetMap", new string[] {... GetMap input ...});
}
}
SoapConnect.InvokeMethodDirect
public bool InvokeMethodDirect(
string strRequest,
string strLocation,
string strSoapAction,
int nTimeOut)
Parameters
strRequest - SOAP request specified by the user
strLocation - Location of the Web service
strSoapAction - SOAP Action of the Web service
nTimeout - Timeout of the Web service request
Return value
Returns true if the method succeeds; else false.Example:
using System;
using SoapConnect;
class LocalTimeTestClass
{
public static void Main()
{
SoapConnect sc = new SoapConnect("http://www.alethea.net/webservices/LocalTime.asmx?WSDL");
string strRequest = sc.CreateRequest("LocalTimeByZipCode", new string[] {"98052"});
if (sc.InvokeMethodDirect(strRequest,
sc.Location, sc.SoapAction, 100000))
{
System.Diagnostics.Debug.WriteLine("The SOAP response returned is:");
System.Diagnostics.Debug.WriteLine(sc.Response);
}
}
}