Using the Interface Object

We can use the methods of the Interface object to exchange a business document between an application and BizTalk Server 2000 directly.The Interchange object is supported by the IInterchange interface.There are two methods of the Interface object, Submit and SubmitSync. Both of these methods accept a string buffer or a file path as the business document or interchange. Dynamically calling Submit or SubmitSync at runtime can give us much more control over the submission process. Rather than having to hard code the channel properties as part of the definition of the receive function, or make sure that the document itself contains the required information, we can supply the data we want during runtime as the parameters we send to the methods.

Submit Method

The Submit method is used to submit documents in an asynchronous fashion without waiting for a receipt document. BizTalk Server places this document in a message queue until a server is available to process it. An asynchronous submission can also be delivered to multiple destinations.

If you would like to receive a document via HTTP, you could create an .ASP page that receives the data posted to the Web site, and then submits that to BizTalk Server using the Submit method.

This following code example uses the ADO type library to create a Stream object.This Stream object then opens the data posted to the ASP page.The data is then converted from binary format into text format.This data is then submitted using the Submit method of the Interchange object.To see all the available options, please refer to Table 3.1.

<% Dim objInterface

Dim SubmittedDocumentResult

Dim streamADO

Set streamADO=CreateObject("ADODB.Stream") streamADO.Open streamADO.Type = = adTypeBinary streamADO.Write Request BinaryRead(Request.TotalBytes)

streamADO.Position=0

streamADO.Type=adTypeText

Set objInterface=Server.CreateObject ("BizTalk.Interchange") SubmittedDocumentResult=objInterface.Submit (1,streamADO.ReadText,

"Source Org", ,"Destination Org") Set objInterface=Nothing %>

Table 3.1 Parameters of the Submit and SubmitSync Methods

Parameters

Description

IOpenness

Document

DocName SourceQualifier

SourceID

DestQualifier DestID

This will be a number that indicates the openness property of the source organization or application, and the openness property of the destination organization or application. 1 = Not Open, 2 = Source is Open, 4 = Destination is Open.

This string contains the submitted document instance. It accepts only a string buffer as the document. This is an optional parameter; however, either the Document or the FilePath parameter must be set—do not set both.

This string contains the name of the submitted document. Optional parameter.

A string that is used to identify the type of SourceID that is being supplied—a name, DUNS number, and so forth. Optional parameter.

A string that contains the value of the qualifier of the source organization. For example, if the SourceQualifier is DUNS number, then this is the actual DUNS number of the source. Optional parameter.

A string that is used to identify the type of DestID that is being supplied—a name, DUNS number, and so forth. Optional parameter.

A string that contains the value of the qualifier of the destination organization. For example, if the DestQualifier is DUNS number, then this is the actual DUNS number of the source. Optional parameter.

Continued

Table 3.1 Continued

Parameters

Description

ChannelName

FilePath

EnvelopeName

PassThrough

SubmissionHandle

ResponseDocument

The string that identifies the BizTalkChannel object that is executed for this document. This is optional unless the PassThrough parameter is to TRUE.

The string that identifies the fully qualified path that contains the document to be submitted. This is instead of directly supplying the document as a string. You can provide URLs, UNCs, and local drive letter paths.

This string identifies the name of the envelope. When submitting a flat file, you must create an envelope for this flat file and specify the name of the envelope. Optional parameter.

This is a long data type value that indicates how the server processes the document. If this parameter is set to TRUE, no decryption, decoding, or signature verification is performed, and you must define the parameters as discussed in the following note. If set to FALSE, decryption, decoding, and signature verification are performed.

SubmitSync only. This is a variant data type value that contains a unique identifier for the submitted document. You could use this to query the status of the submitted document.

SubmitSync only. This is a variant data type value that contains an optional response document.

Note_

If the PassThrough property is set to TRUE, the IOpenness property must have a value of 1, and the channel name must be specified. Additionally, you cannot set a value for the DocName, SourceQualifier, SourceID, DestQualifier, DestID, and FilePath parameters.

SubmitSync Method

This method is used to submit documents to BizTalk Server synchronously. Documents submitted using this method are able to receive a receipt document;

in other words, the method returns a document and submits one. Make sure that you submit just one document at a time, and that you have an exact match on the channel name; otherwise, BizTalk Server will return an error.

Was this article helpful?

0 0

Post a comment