How To Exchange Catalogs Between Commerce Server 2000 Sites Through Microsoft BizTalk Server (301106)



The information in this article applies to:

  • Microsoft BizTalk Server 2000
  • Microsoft Commerce Server 2000

This article was previously published under Q301106

SUMMARY

The "More Information" section of this article describes the steps to configure Commerce Server 2000 sites to send and receive catalogs through BizTalk Server 2000. Note that the information in this article is for users who have BizTalk Server and Commerce Server 2000 installed on the same computer.

MORE INFORMATION

How to Install Two Sample Commerce Server 2000 Sites

  1. Download and install Microsoft Commerce Server Solution Sites from:
  2. Double-click the Retail.pup file in the Program Files\Microsoft Commerce Server\PuP Packages folder to unpack the Retail site that is available after you install the Commerce Server Solution Sites. When you double-click this file, the Commerce Server Site Packager Wizard starts.
  3. When you are prompted, set the Custom unpack option to the site name Retailer.
  4. In the Unpack Method dialog box, click Create a new site, and then click Next.
  5. Enter the site name Retailer, and then click Next.
  6. In the Select Resources dialog box, click Next.
  7. In the Global Resource Pointers dialog box, click Next.
  8. In the Database Connection Strings dialog box, click Next.
  9. In the Select Applications dialog box, make sure that Retail and RetailbizDesk are selected (checked), and then click Next.
  10. In the Select IIS Web Sites and Virtual Directories dialog box, change the IIS virtual directory for the Retail application from Retail to Retailer, change the IIS virtual directory for the RetailBizDesk application from Retailbizdesk to Retailerbizdesk, and then click Next.
  11. When the Data Warehouse dialog box is displayed, change the name of the Data Warehouse to Data Warehouse Retailer, and then click OK.
  12. In the Profiling dialog box, keep the default settings, click Next, and then click OK.
  13. When the Unpacking is complete! dialog box is displayed, click Finish.
  14. Repeat the previous steps, but substitute the names Wholesaler and Wholesalerbizdesk for Retailer and Retailerbizdesk.
  15. You should now be able to access your Retailerbizdesk and Wholesalerbizdesk applications through http://localhost/Retailerbizdesk or http://localhost/Wholesalerbizdesk.

Modifying the Site Options for the Wholesaler Site

  1. Start the Commerce Server Manager.
  2. Navigate to the Wholesaler App Default Config settings by expanding Commerce Sites, expanding Wholesaler, expanding Site Resources, and then expanding App Default Config.
  3. Right-click App Default Config, and then click Properties to configure the site options as follows:

    OptionValue
    Biztalk Options1
    Biztalk Catalog Doc TypeCatalog
    Biztalk Source Org QualifierCatalog
    Biztalk Source Org Qualifier ValueWholesaler
    Biztalk Submit Type1

Copying Catalogxmlschema.xml to the BizTalk Server Repository

  1. Start the BizTalk Editor.
  2. Click Tools, import and select XDR Schema, and then click OK.
  3. In the Program Files\Microsoft Commerce Server folder, open the CatalogXMLSchema.xml file.
  4. You will receive several warnings that refer to various properties being blank. You can disregard these warnings.
  5. In the top left pane of the BizTalk Editor, expand MSCommerceCatalogCollection, expand CatalogSchema, and then expand AttributeDefinition. Click Edit, click Insert Field, and then insert a field named MaxLength with a data type of Number.
  6. On the File menu, click Store to WebDAV. When the BizTalk Editor prompts you to save this specification, click Yes.
  7. Open the Microsoft folder and save the schema as Catalogxmlschema.xml.

Creating the Catalog Document Definition in the BizTalk Messaging Manager

  1. Start the BizTalk Messaging Manager.
  2. On the File menu, click New, and then click Document Definition.
  3. Enter Catalog as the document definition name, click the check box for document specification, and then open the Catalogxmlschema.xml file in the WebDAV repository that you imported previously. Click OK.

Configuring the Receivestandard.asp File to Receive the Catalog

Receivestandard.asp is a file that receives XML documents and calls the BizTalk interchange.submit method. You need to modify this file to call a specific channel. This is done in the Retailer site because it is the site that is receiving the catalog. In this example, the site is named "Catalog Import Channel." Modify line 89 of the Receivestandard.asp file in the physical directory that contains the \Retailer virtual directory by changing:
SubmissionHandle = interchange.submit( 1, PostedDocument )
				
to:
SubmissionHandle = interchange.submit(1, PostedDocument,,,,,,"Catalog Import Channel")
				
This takes the PostedDocument, which is the exported catalog, and submits it to the Catalog Import Channel, which you will create by following the steps in the "Creating the Catalog Import Channel" section of this article.

Modifying the Home Organization

  1. In the BizTalk Messaging Manager, click Organizations, and then click Search Now.
  2. Double-click Home Organization, and then change the Organization name from Home to Wholesaler.
  3. Click the Identifiers tab, and then add the name Catalog as a new Custom identifier with a qualifier of Catalog and a value of Wholesaler.
  4. Click the Applications tab, add a new Application with the name CatalogApplication, and then click OK.

Creating the Retailer Organization

  1. In the BizTalk Messaging Manager, click File, click New, and then click Organization.
  2. Enter an Organization name of Retailer, and then click the Identifiers tab.
  3. Add the name Catalog as a new Custom identifier with a qualifier of Catalog and a value of Retailer.
  4. Click to check the Set as default check box, and then click OK.

Creating the Wholesaler Port to Retailer

  1. In the BizTalk Messaging Manager, click File, click New, click Messaging Port, and then click To an Organization.
  2. Enter the name CatalogPort, and then click Next.
  3. Select the Organization name Retailer, and then click OK.
  4. For the Primary transport Transport type:, select HTTP and for Address:, select http://localhost/retailer/receivestandard.asp. Click Next.
  5. In the Envelope Information dialog box, make sure that the Organization identifier is set to Catalog/Retailer, and then click Next.
  6. In the Security Information dialog box, click to check the Create a channel for this messaging port option, select From an application for the Channel type:, and then click Finish.

Creating the Channel to Retailer

  1. In the first dialog box of the New Channel Wizard, enter Channel to Retailer for Name of:, and then click Next.
  2. In the Source Application dialog box, select the Application radio button and make sure that Name of: CatalogApplication is selected.
  3. Set the Organization identifier to Organization/Wholesaler, and then click Next.
  4. For the Inbound document definition name:, select Catalog, and then click Next.
  5. For the Outbound document definition name:, select Catalog, and then click Finish.

Creating the Retailer Receive Port

  1. In the BizTalk Messaging Manager, click File, click New, click Messaging Port, and then click To an Organization.
  2. Enter the name Retailer Receive, and then click Next.
  3. For the Organization name, select Retailer, and then click OK.
  4. For the Primary transport Transport type:, select Application Integration Component and for Component name:, select BizTalk Scriptor. Click OK twice, and then click Next.
  5. In the Envelope Information dialog box, make sure that the Organization identifier is set to Catalog/Retailer, and then click Next.
  6. In the Security Information dialog box, click to check the Create a channel for this messaging port check box. For Channel type:,select From an organization, and then click Finish.

Creating the Catalog Import Channel

  1. In the first dialog box of the New Channel Wizard, for Name:, enter Catalog Import Channel, and then click Next.
  2. In the Source Organization dialog box, select Retailer for the Organization Name:, select Catalog/Retailer for the Organization identifier, and then click Next.
  3. For the Inbound document definition name:, select Catalog, and the click Next.
  4. For the Outbound document definition name:, select Catalog, and the click Next twice.
  5. In the Advanced Configuration dialog box, click Advanced, and then click Properties on the Primary Transport tab.
  6. Replace the existing default script with the following script, click OK twice, and then click Finish:
    function MSCSExecute(config, orderform, context, flags)
    
    soutput = orderform.Value("working_data")
    
    Dim fso, MyFile
    Set fso = CreateObject("Scripting.FileSystemObject")
    Mydrive = "c:\commercecatalogs\"
    MyDate = cstr(Date)
    MyTime = cstr(Time)
    Filename = MyDate & MyTime & ".xml"
    FileName = Replace(FileName, "/", "")
    FileName = Replace(FileName, ":", "")
    Filename = Mydrive & FileName
    Filename = Replace(Filename, " ", "")
    Set MyFile = fso.CreateTextFile(Filename, True, True)
    MyFile.WriteLine(soutput)
    MyFile.Close
    set appcfg = createobject("commerce.appconfig")
    set catalogmanager = createobject("commerce.catalogmanager")
    appcfg.initialize("retailer")
    set optdict = appcfg.getoptionsdictionary("")
    connstr = optdict.s_CatalogConnectionString
    catalogmanager.initialize connstr, true
    catalogmanager.importxml Filename, TRUE, FALSE
        
    	MSCSExecute = 1   'set function return value to 1 
    end function
    
    sub MSCSOpen(config)
    	'optional open routine
    end sub
    
    sub MSCSClose()
    	'optional close routine
    end sub
    						
  7. On the computer running BizTalk Server, create a c:\commmercecatalogs folder.
In the previous BizTalk scriptor, the orderform is used to pass in the contents of the XML document. When you grab the working_data node, you have the XML document. In this case, you grab the XML document and use the scripting.filesystemobject to write out the XML document to a file.

Testing to Ensure that Catalogs Sent from the Wholesaler Site Are Automatically Imported into the Retailer Site

  1. If you do not already have catalogs imported into the Wholesaler site, import a catalog into the Wholesaler site:

    1. Open the Wholesaler BizDesk, use the Import Catalog key combination ALT+I, and then press the ENTER key.
    2. Make sure that the Import XML option is selected, and then press the ENTER key.
    3. In the Import XML Catalog dialog box, type \Program Files\Microsoft Commerce Server\SDK\Samples\Sitelets\Auction\booksfull.xml for the file name, and then click OK.
    4. After the catalog import is successful, you should have the Books catalog available in your Wholesaler site.
  2. Select the Books catalog that you imported.
  3. Type the Send Catalog key combination ALT+ S. In the Select Vendor dialog box, select Retailer, and then click OK.
When you select the Books catalog in the Wholesaler site and send it to the Retailer site, the following actions occur:
  1. The Process_Send() subroutine in the Wwwroot\Wholesalerbizdesk\Catalogs\Editor\List_Catalogs.asp folder runs and performs the following tasks:

    • Calls the ExportXML method of the Commerce Server 2000 CatalogManager object and exports the Books catalog to the root of the Wholesalerbizdesk virtual directory.
    • Loads an instance of the Microsoft XML DOM Object and loads the exported file into the XML DOM.
    • Calls the BizTalk Interchange.Submit method, which submits the XML contained in the DOM to the BizTalk Channel to Retailer.
    • Deletes the Books catalog from the root of the Wholesalerbizdesk virtual directory.
  2. The BizTalk Channel to Retailer validates the catalog that has been submitted against the Catalog schema, and then passes the catalog to the CatalogPort.
  3. The BizTalk CatalogPort passes the catalog to the specified transport address http://localhost/retailer/receivestandard.asp.
  4. Receivestandard.asp performs another BizTalk Interchange.Submit of the catalog to the Catalog Import Channel.
  5. The Catalog Import Channel validates the submitted catalog against the Catalog schema (again), and then passes the catalog to the Retailer Receive port.
  6. The Retailer Receive port passes the catalog to the specified transport address of BizTalk Scriptor.
  7. The BizTalk Scriptor writes a copy of the catalog to the Commercecatalogs folder on the computer running BizTalk Server, and then calls the ImportXML method of the Commerce Server 2000 CatalogManager object to import the catalog into the Retailer site.

Modification Type:MinorLast Reviewed:8/5/2004
Keywords:kbdownload kbhowto KB301106