Is there a way to configure one send port to send a message to a document library based on a parameter?


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
http://msdn2.microsoft.com/en-us/library/aa547920.aspx


For instance:
    outgoingMsg(WSS.Filename) = “file1.xml”;
    outgoingMsg(WSS.ConfigOverwrite) = “yes”;
    etc.
 
Video 04-WSSAdapter-PropsInOrchestration.wmv shared here includes one such dynamic send port example
http://blogs.msdn.com/ahamza/archive/2006/04/18/WssAdapterVideosWebcasts.aspx

Comments (11)

  1. Mark Perry says:

    Thanks for posting this information. My next question is this; I plan to drop an xml file into one of about 160 document libraries depending on what the Orchestration decides. I’ve found that in order for InfoPath 2003 to recognise the xml I have to create the InfoPath form first based on the schema, then publish to a document library on Share Point. Would I have to publish the same form 160 times, or is there a quicker way to do this?

  2. Adrian Hamza says:

    Do I have to publish the same form 160 times?

    No. You can use the ‘Yes’ option instead of ‘Yes (InfoPath Form Library)’, details below. You will still need some script to create the document libraries because the adapter does not create document libraries or folders.

    WSS adapter supports 2 models for integration with InfoPath:

    • the InfoPath integration built in WSS (Form Library) when ‘Microsoft Office Integration’ is set to ‘Yes (InfoPath Form Library)’
    • the adapter implemented integration with InfoPath (works with any document library not only with Form Libraries) when ‘Microsoft Office Integration’ is set to ‘Yes’.

    When using ‘Yes (InfoPath Form Library)’, there is one InfoPath solution per WSS form library and it’s stored in a hidden folder inside the form library. All the documents stored in the form library must have the same XSD schema and they all use the same InfoPath solution. These restrictions don’t apply to the next option.

    When using ‘Yes’ the documents in a document library can use any InfoPath solution and they don’t have to have the same XSD schema. All your solutions can be stored in a primary document library (and optionally fallback document library). You will have to create a document library (call it Solutions) that has a Namespace column (single line of text) and upload all your InfoPath solutions in this document library. For each InfoPath solution, edit the Namespace column to specify the target namespace (defined in XSD schema) of the documents that can be opened with that solution. When you create a send port, define the Microsoft Office Integration options so that the adapter will search into your Solutions document library for the appropriate InfoPath XSN solution that can be used to open your XML document.

  3. Mark Perry says:

    I’ve created an InfoPath form using the XSD from my Biztalk project and published it to a folder called ‘InfoPathSolutions’ under the following URL: http://servername/InfoPathSolutions/Expenses.xsn”>http://servername/InfoPathSolutions/Expenses.xsn. I want to use this as the template for the XML that comes in via Biztalk.

    Within Biztalk I’ve created a dynamic send port and configured it in an Expression shape. In there I’ve set the following:

    WSS.ConfigOfficeIntegration = yes

    WSS.Url = http://servername/

    WSS.ConfigTemplatesDocLib = http://servername/InfoPathSolutions

    WSS.ConfigTemplatesNamespaceCol = Namespace

    I’ve then created another site underneath my home site called http://servername/NewSite. Within this I’ve created a document library called ‘Expenses’ and I want to drop XML files here and use the InfoPath template to view them. But I keep getting an error in HAT saying that it can’t find the folder I’ve specified as storing the templates. I’ve tried different combinations of url / non – url but it’s almost as though I can’t store the templates on a different site to the xml files. Is this true?

    Mark.

  4. Adrian Hamza says:

    Yes it’s true. The templates must exist on the same site as the XML document.

    Also you need to specify the name of the document library and not the full/relative URL.

    When creating WSS adapter ports you need to pay attention to the field names, if they don’t mention URL then you are required to enter a name. Some fields require names others require relative or full URLs.

  5. Hi… I´m trying to communicate BizTalk – Sharepoint following the steps that you show in your video… the following problem appears when the receive location poll to sharepoint:

    The adapter "Windows SharePoint Services" raised an error message. Details "Client found response content type of ‘text/html; charset=utf-8’, but expected ‘text/xml’.

    any help?

    Thank you.

  6. Adrian Hamza says:

    This happens when the web service is not found or when it doesn’t run for some reason. Basically, BizTalk runtime received back an HTML page with the error instead of XML.

    Did you install and configure the web service? (in BizTalk Setup under Additional Software, in BizTalk Configuration under SharePoint Adapter).

    If yes, make sure that your receive location is using the same port number as the II site where you installed the web service.

    Open the web service web.config (to find it, in IIS select BTSharePointAdapterWS, right click and select open) and remove the <remove name="Documentation" /> line (or something like that) and then try browsing to the web service to see if it’s working.

  7. Praveen says:

    I am facing the same problem with sharepoint adapter.I tried to doing it above. It didn’t work. can anybody please help me out in this

  8. Adrian Hamza says:

    Did you install and configure the web service?

    Did you check your receive location is using the same port number as the II site where you installed the web service?

    Did you browse with IE to the web service and saw that it works?

    If all of these worked, what are the errors that you see in the event viewer or in BizTalk MMC console for the outgoing message?

    If some of the above didn’t work, what was the error that you got back?

  9. EricPopoff says:

    Hello Adrian!

    I’ve been trying to set the dynamic address for the WSS adapter, but at runtime the adapter can’t find the document library. Here is the URL for the document library:

    http://vpc:27298/sites/AIBErrorHandling/Shared%20Documents/Forms/AllItems.aspx

    In SharePoint, I have changed the Shared Documents document library name to AIBErrors. I have 6 "System Source" folders in the AIBErrors doc library, and 3 "Error type" folders under each of those. I am trying to dynamically direct files to the correct folder based on source and type. Here is the dynamic configuration for setting the destination:


    SendCbeErrorToSharepoint(Microsoft.XLANGs.BaseTypes.Address) = "wss://servername:27298/sites/AIBErrorHandling/AIBErrors/" + cbeError.errSystem + "/" + cbeError.errType;


    Here is the error I get when I run the application:


    [Microsoft.SharePoint.SPException] The virtual server that is referenced here is not in the config database.

    This error was triggered by the Windows SharePoint Services receive location or send port with URI wss://servername:27298/sites/AIBErrorHandling/AIBErrors/Agile/Application.

    Windows SharePoint Services adapter event ID: 12310


    I have tried hard-coding the wss uri, as well as trying to create a different top level document library as a destination. No success in either case…

    In your video you use the path:

    "wss://demobt/sites/WSSAdapterWalkthrough/Lists/Tasks"

    In all of the examples I’ve seen online for documents they say to use the format:

    "’wss://ServerName/sites/MySite/MyDocumentLibrary/"

    Is there a prefix like "Lists" that should preface the actual doc library name?

    TIA for your help!

  10. Ayman says:

    Hello Adrian-

    in the 04-WSSAdapter-PropsInOrchestration.wmv video you demonstrated how to create a task by filling its title, status and priority .

    I want to know how do i fill the "Assigned To" field for a new task dynamically from BizTalk.

    i used the following string but it gave me an error:

    Message_Task(WSS.ConfigPropertiesXml)="<ConfigPropertiesXml><PropertyName1>Title</PropertyName1><PropertySource1>Purchase order trial Task</PropertySource1><PropertyName2>Assigned To</PropertyName2><PropertySource2>MOL\Administrator</PropertySource2><PropertyName3>Status</PropertyName3><PropertySource3>Not Started</PropertySource3><PropertyName4>Priority</PropertyName4><PropertySource4>High</PropertySource4></ConfigPropertiesXml>";

    any suggestions ?

  11. Luke says:

    Take out the space in the column name