Specifying a Connection Using SOAP

From RAD Studio
Jump to: navigation, search

Go Up to Connecting to the Application Server


You can establish a connection to a SOAP application server using the Soap.SOAPConn.TSoapConnection component. TSoapConnection is very similar to TWebConnection, because it also uses HTTP as a transport protocol. Thus, you can use TSoapConnection from any machine that has a TCP/IP address, and it can take advantage of SSL security and to communicate with a server that is protected by a firewall.

The SOAP connection component establishes a connection to a Web Service provider that implements the IAppServerSOAP or IAppServer interface. (The UseSOAPAdapter property specifies which interface it expects the server to support.) If the server implements the IAppServerSOAP interface, TSoapConnection converts that interface to an IAppServer interface for client datasets. TSoapConnection locates the Web Server application using a Uniform Resource Locator (URL). The URL specifies the protocol (http or, if you are using SSL security, https), the host name for the machine that runs the Web server, the name of the Web Service application, and a path that matches the path name of the THTTPSoapDispatcher on the application server. Specify this value using the URL property.

By default, TSOAPConnection automatically looks for an IAppServerSOAP (or IAppServer) interface. If the server includes more than one remote data module, you must indicate the target data module's interface (an IAppServerSOAP descendant) so that TSOAPConnection can identify the remote data module you want to use. There are two ways to do this:

  • Set the SOAPServerIID property to indicate the interface of the target remote data module. This method works for any server that implements an IAppServerSOAP descendant. SOAPServerIID identifies the target interface by its GUID. At run time, you can use the interface name, and the compiler automatically extracts the GUID. However, at design time, in the Object Inspector, you must specify the GUID string.
  • If the server is written using the Delphi language, you can simply include the name of the SOAP data module's interface following a slash at the end of the path portion of the URL. Thus you can specify the interface by name rather than by GUID; this feature is only available when both client and server are written in Delphi.

Tip: The first approach, using the SOAPServerIID method, has the added advantage that it lets you call extensions to the remote data module's interface.

If you are using a proxy server, you must indicate the name of the proxy server using the Proxy property. If that proxy requires authentication, you must also set the values of the UserName and Password properties so that the connection component can log on.

Note: When using TSoapConnection, wininet.dll must be installed on the client machine. If you have IE3 or higher installed, wininet.dll can be found in the Windows system directory.

See Also