Soap.InvokeRegistry.TSOAPAttachment

From RAD Studio API Documentation
Jump to: navigation, search

Soap.InvokeRegistry.TRemotableSystem.TObjectTSOAPAttachment

Delphi

TSOAPAttachment = class(TRemotable)

C++

class PASCALIMPLEMENTATION TSOAPAttachment : public TRemotable

Properties

Type Visibility Source Unit Parent
class public
Soap.InvokeRegistry.pas
Soap.InvokeRegistry.hpp
Soap.InvokeRegistry Soap.InvokeRegistry

Description

TSOAPAttachment represents an attachment that is included with SOAP messages that represent method calls in a Web Service application.

Use TSOAPAttachment to receive or send an attachment as a parameter or return value of a method on an invokable interface. When a SOAP method call requires an attachment, it is marshaled as a MIME multipart form, where any attachments are included as additional parts.

Warning: Some Web Services (such as .Net) use DIME multipart forms rather than MIME multipart forms for attachments. TSOAPAttachment will not work with such services.

Note: Only use TSOAPAttachment and its descendants as the type for parameters or the return value of a method of an invokable interface. TSOAPAttachment can't be used as part of a more complex type, such as the type of a published property on a remotable object.

When sending an attachment, use the SourceString property or the SetSourceFile or SetSourceStream method to supply the attachment data. Use the ContentType property to indicate the type (encoding) of the attachment data.

When receiving an attachment, the attachment is automatically stored in a temporary file, whose name is given by the CacheFile property. You can copy the contents of this temporary file using the SaveToFile or SaveToStream method. To determine the format of the data, read the ContentType property. You can read any of the other headers for the part of the multipart form that contained the attachment using the Headers property. By default, when the TSOAPAttachment object is freed, it deletes the temporary file that contains the attachment data that was received. You can use the CacheFilePersist property to prevent this file from being deleted.

Note: If you use TSOAPAttachment as a base class for a customized attachment class, it is marshaled as a TSOAPAttachment value. That is, the application that receives the attachment sees it only as a TSOAPAttachment instance, not as an instance of the descendant class.

The application must register TSOAPAttachment with the remotable class registry before it can use this class. To register TSOAPAttachment or one of its descendants, use the RegisterXSClass method of the object that the global RemTypeRegistry function returns. When you import a WSDL document, the call to register TSOAPAttachment is automatically added if any of the interfaces use attachments.

The caller of an invokable interface (client) is responsible for creating any TSOAPAttachment instances that it passes as input parameters, and for freeing any TSOAPAttachment instances it creates or that are returned as output parameters or method results.

In Web Service applications (servers), any TSOAPAttachment instances that represent parameters or return values are added to the data context, which frees them as necessary.

See Also