3

I configured a receive port using c#. Below is the code and every thing is fine. But i need to configure the authentication tab and give the details of USERNAME and PASSWORD. Could any one guide me on this.

ReceivePort myreceivePort = app.AddNewReceivePort(false);

        //Note that if you dont set the name property for the receieve port, 
        //it will create a new receive location and add it to the receive       //port.
        myreceivePort.Name = "MyPort";


        //Create a new receive location and add it to the receive port
        ReceiveLocation myreceiveLocation = myreceivePort.AddNewReceiveLocation();


        foreach(ReceiveHandler handler in root.ReceiveHandlers)
        {
           if(handler.TransportType.Name == "FILE")
           {
              myreceiveLocation.ReceiveHandler = handler;
              break;
           }
        }

        //Associate a transport protocol and URI with the receive location.
        foreach (ProtocolType protocol in root.ProtocolTypes)
        {
           if(protocol.Name == "FILE")
           {
              myreceiveLocation.TransportType =  protocol;

              break;
           }
        }
        myreceiveLocation.CustomData
        // new BizTalk application

        myreceiveLocation.Address = "C:\\test\\*.txt";
        //Assign the first receive pipeline found to process the message.
        foreach(Pipeline pipeline in root.Pipelines)
        {
           if(pipeline.Type == PipelineType.Receive)
           {
              myreceiveLocation.ReceivePipeline = pipeline;
              break;
           }
        }

        //Enable the receive location.
        myreceiveLocation.Enable = true;
        myreceiveLocation.FragmentMessages = Fragmentation.Yes;//optional property
        myreceiveLocation.ServiceWindowEnabled = false; //optional pr
user2979719
  • 59
  • 1
  • 1
  • 8

1 Answers1

1

The authentication is held in the property Data which contains XML CustomProps, which contains two elements Username and Password.

Note: 1) password will have to be changed too

<Password vt=\"8\">PASSWORD</Password>

2) Added line breaks for readability.

<CustomProps>
   <FileMask vt=\"8\">*.xml</FileMask>
   <RemoveReceivedFileMaxInterval vt=\"19\">300000</RemoveReceivedFileMaxInterval>
    <Username vt=\"8\">USER</Username>
    <RemoveReceivedFileRetryCount vt=\"19\">5</RemoveReceivedFileRetryCount>
    <RenameReceivedFiles vt=\"11\">0</RenameReceivedFiles>
    <RemoveReceivedFileDelay vt=\"19\">10</RemoveReceivedFileDelay>
    <FileNetFailRetryCount vt=\"19\">5</FileNetFailRetryCount>
    <Password vt=\"1\" />
    <PollingInterval vt=\"19\">60000</PollingInterval>
    <BatchSize vt=\"19\">20</BatchSize>
    <FileNetFailRetryInt vt=\"19\">5</FileNetFailRetryInt>
    <BatchSizeInBytes vt=\"19\">102400</BatchSizeInBytes>
</CustomProps>
Dijkgraaf
  • 11,049
  • 17
  • 42
  • 54