This question comes up quite often that it deserves its own post. Is there a way to configure one send port to send a message to a variable destination based on a parameter? For instance when using WSS adapter, can you send a message to a different document library based on the message that's being processed?

The answer is yes, it's possible to do this in two ways:

  • using dynamic send ports, the destination URI and the configuration of the send port can be set programatically in the orchestration for every outgoing message. This method has the advantage that no ports have to be pre-created.
  • using role-links and parties. For each party you need to pre-create and configure a pyshical send port. You will have pretty much a party per destination. You enlist the parties in the appropriate role. Then, in the orchestration the only thing that you need to do is set the party associated with the role-link. The physical send port of the party associated with the role-link will be used to process the outgoing message.

I included below more information on how to do this using dynamic send ports which is the more simple & frequent approach.

The URL for a WSS adapter dynamic send port will be something like this:
     'wss://ServerName/sites/MySite/MyDocumentLibrary/'  if you installed the web service on an HTTP site
     'wsss://ServerName/sites/MySite/MyDocumentLibrary/' if you installed the web service on an HTTPS site (notice the additional s in wsss://).
and you can set it programatically from the orchestration (like below) every time you sent out a message
     dynamicSendPortName(Microsoft.XLANGs.BaseTypes.Address) = "wss://ServerName/sites/MySite/" + lookedupDocLibName;
The rest of the send port configuration information must be set on the outgoing message using the Config* context properties documented here

For instance:
    outgoingMsg(WSS.Filename) = "file1.xml";
    outgoingMsg(WSS.ConfigOverwrite) = "yes";
Video 04-WSSAdapter-PropsInOrchestration.wmv shared here includes one such dynamic send port example