Home > Archive > BizTalk > microsoft.public.biztalk.general > 2004-06   Shop / Science   Privacy   

Re: Error on creating a receive port programatically

From: Monah Khalil [MSFT] (monahk_at_online.microsoft.com)
Date: 06/08/04


Date: Tue, 8 Jun 2021 15:40:48 -0700

You should set the "TransportTypeData" property on the receive location. See
the example below (You could replace CUSTOM with your adapter type):

public void CreateCUSTOMReceiveLocation()
  {
   ReceivePort rp = bceExplorer.AddNewReceivePort(false);
   rp.Name = "My CUSTOM Receive Port";

   ReceiveLocation rl = null;

   rl = bceExplorer.ReceivePorts["My CUSTOM Receive
Port"].AddNewReceiveLocation();
   rl.Name= "My CUSTOM Receive Location";

   foreach(ReceiveHandler handler in bceExplorer.ReceiveHandlers)
   {
    if(handler.TransportType.Name == "CUSTOM")
    {
     rl.ReceiveHandler = handler;
     break;
    }
   }

   foreach (ProtocolType protocol in bceExplorer.ProtocolTypes)
   {
    if(protocol.Name == "CUSTOM")
    {
     rl.TransportType = protocol;
     break;
    }
   }

   foreach(Pipeline pipeline in bceExplorer.Pipelines)
   {
    if(pipeline.FullName ==
"Microsoft.BizTalk.DefaultPipelines.PassThruReceive")
    {
     rl.ReceivePipeline = pipeline;
     break;
    }
   }

   string sTransportTypeData = @"<CustomProps>
 <AdapterConfig vt=\"8\">
  <Receive xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">
    <customProperty1>cp1</customProperty1>
    <customProperty2>cp2</customProperty1>
    <customProperty3>cp3</customProperty1>
  </Receive>
 </AdapterConfig>
</CustomProps>";

   rl.TransportTypeData=sTransportTypeData.Replace("\r\n",""); //To flatten
out the string without any break lines.

   rl.Address = "CUSTOM://WhateverAddress";

   rl.Enable = true;

   bceExplorer.SaveChanges();
  }

-- 
Thanks,
Monah
Microsoft Corporation
http://www.microsoft.com
--
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use.
 2003 Microsoft Corporation. All rights reserved.
"Please do not send email directly to this alias. This is our online account
name for newsgroup participation only."
"Abani" <abanikg@aditi.com> wrote in message 
news:eaFdOsLTEHA.2720@TK2MSFTNGP12.phx.gbl...
> Hi,
>
>    I receive the following 2 errors in the Event log as soon as I create a
> Receive Port with a receive location programatically using ExplorerOM.
>
> The transport type I am configuring in it is a custom recieve adapter just
> equivalent to the sample MSMQC adapter provided in the SDK samples.
>
> Here is the Errors:
> 1. The Messaging Engine failed to add a receive URL "CheckB" to the 
> adapter
> "MyCustomAdapter". Reason: "No adapter configuration XML was found on the
> configuration when one was expected.".
>
> 2. The receive location "DIRECT=OS:.\private$\CheckB" is shutting down.
> Details:"The Messaging Engine failed while notifying an adapter of its
> configuration. ".
>
>
> On looking into the recieve location configuration in BizTalk Explorer, I
> found that the Address (URI) was set in the ReceiveLocation Properties
> window as I gave it in the code e.g.,
>
>    myReceiveLocation.Address = @DIRECT=OS:.\private$\CheckB;
>
> But when I click the elipsis button beside the value of the Address, I see
> that the End-Point configuration's respective property does not hold the
> required value which is a part of the Address (URI) in the RecieveLocation
> Properties window and its blank.
>
> I have to configure it manually and copy the required value to the 
> End-Point
> configuration's respective property after which the receive location works
> fine.
>
> Is there any way to do this manual operation programatically, may be a
> change in the CustomAdapter code or any other code block to be executed to
> achieve this using ExplorerOM? Any ideas or am I wrong?
>
> Thanks and Regards,
> Abani
>
> 

Home > Archive > BizTalk > microsoft.public.biztalk.general > 2004-06   Shop / Science   Privacy   
This document was last modified: 06/09/04 12:52 CEST
We are proud to be hosted by
9 Net Avenue Deutschland