If the Web Service application you are calling expects your client to include any headers in its requests or if its response messages include special headers, your client application needs the definitions of the header classes that correspond to these headers. When you import a WSDL document that describes the Web Service application, the importer automatically generates code to declare these header classes and register them with the remotable type registry. If the server is written in Delphi, you can use the same units that the server application uses to define and register these header classes instead of the files generated by importing a WSDL file. Be sure that the unit uses the same namespace URI and SOAPAction header when it registers invokable interfaces. These values can be explicitly specified in the code that registers the interfaces, or it can be automatically generated. If it is automatically generated, the unit that defines the interfaces must have the same name in both client and server, and both client and server must define the global AppSpacePrefix variable to have the same value.
var Service: IMyService; Hdr: TAuthHeader; Val: Double; begin Service := HTTPRIO1 as IService; Hdr := TAUthHeader.Create; try Hdr.Name := "Frank Borland"; Hdr.Password := "SuperDelphi"; (Service as ISOAPHeaders).Send(Hdr); { add the header to outgoing message } Val := Service.GetQuote("BORL"); { invoke the service } finally Hdr.Free; end; end;
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|