Ayman’s BizTalk Lab

November 22, 2007

Creating New MOSS 2007 Task Using BizTalk WSS Adapter

Filed under: Uncategorized — Admin @ 12:31 pm
Tags: , , ,

Hello,

Yesterday I was trying BizTalk WSS (Windows SharePoint Services) adapter to create a new task in my site’s Tasks List dynamically, I mean that I don’t want to configure the adapter in runtime, instead I want to configure it using dynamic data sent to the orchestration.

Basic Configuration

In my development environment I have a stand alone SharePoint server and I have BizTalk 2006 on my machine. so to access the remote SharePoint machine i had to do some configurations first.

  1. Install BizTalk on the SharePoint machine. I don’t have to install all BizTalk components, I only need to install Windows SharePoint Services Adapter which will install the WSS Adapter web service to SharePoint.
  2. Create a windows group on the SharePoint machine called SharePoint Enabled Hosts.
  3. Configure BizTalk SharePoint Adapter as shown in the figure:
    WSSBTS2-013
  4. Create a user in the SharePoint machine with the same name and password of the user on the development machine which BizTalk host Instance runs under it.
  5. Add the user we’ve just created on the SharePoint machine to the SharePoint Enabled Hosts windows group we created earlier.

That’s it. this all we have to do to can successfully use WSS Adapter on the remote SharePoint machine.

you can check Adrian Hamza Blog Post, it has four interesting Webcasts about WSS Adapter.

The Solution

So, I thought I can follow the Walkthrough: Module 3 – Accessing SharePoint Properties from an Orchestration in MSDN. and I did a sample solution like the one described in the walkthrough. basically it has a schema file as in the figure:

WSS_BTS1-001

The important thing it to set the POAmount field to int and making it distinguished as we will use it from the orchestration.

And we will build the following orchestration:

WSS_BTS1-000

it consists of the following :

  • we will create two messages :

    • Message_PO (

    • Message_Task
      Both message has a message type of our schema we created earlier.

  • receive port.

  • receive shape that accept a Message_PO message.

  • decision shape that checks on the following condition:
    Message_PO(PurchaseOrderTrial.POAmount) > 1000

  • dynamic send port called SendToTasksList.

  • message assignment shape that constructs a Message_Task message and has the following code:

    Message_Task = Message_PO;
    Message_Task(WSS.ConfigOverwrite) = “no”;
    Message_Task(WSS.ConfigNamespaceAliases)= “orchns=’http://PurchaseOrderTrial.PurchaseProductOrchestration'”;
    Message_Task(WSS.ConfigPropertiesXml)= “<ConfigPropertiesXml><PropertyName1>Title</PropertyName1><PropertySource1>Purchase order trial Task</PropertySource1>
    <PropertyName2>AssignedTo</PropertyName2><PropertySource2>1;#domain\\\\administrator</PropertySource2>
    <PropertyName3>Status</PropertyName3><PropertySource3>Not Started</PropertySource3>
    <PropertyName4>Priority</PropertyName4><PropertySource4>High</PropertySource4></ConfigPropertiesXml>”;

Note: the AssignedTo has the value “1;#domain\\\\administrator”
this is because the assigned to field in the Task List requires a value with the format ID;#User_Display_Name where ID the the users ID on the SharePoint site. and I had to hard coded it here (witch is not what I wanted to do).

  • expression shape has the following code:
    SendToTasksList(Microsoft.XLANGs.BaseTypes.Address) = “wss://mysite:5555/Lists/Tasks/”;
    to set the address of the dynamic port to the Task List.
  • a send shape that send a Message_Task message.

After building and deploying the solution, we have to create the receive port that will map to our physical port, for simplicity we will use the file adapter.

To test the solution we create a sample file of our schema and drop it in the folder which out receive port listens to and voila .. the task created successfully.

The problem here is that we needed to hard code the user ID and Name for the Assigned To field. and the user ID is not an obvious information that anybody know. so this solution will be good if we are trying to insert in a document library or any other list that doesn’t require a User.

In the next post I’ll provide another solution that is basically a workaround this problem.

see you in the next post.
Ayman

Advertisements

4 Comments »

  1. Hi Ayman,

    Thanks a lot for your blog.
    I am trying to sent a message from BizTalk (2006 R2) to SharePoint using SharePoint Services Adapter.
    I’ve got BizTalk and SharePoint on two servers of the same domain, and I did exactly what you suggested (two local accounts with the same name and password), but it still doesn’t work for me. When I pass the message from BizTalk to SharePoint the message is suspended with the following error:

    The Windows SharePoint Services adapter runtime does not have permissions to invoke the adapter Web service. In order to fix this issue, you have to add the BTSERVER16\Biztalk_User Windows account to the “SharePoint Enabled Hosts” Windows group on the Windows SharePoint Services machine. This operation will allow BizTalk host instances running under BTSERVER16\Biztalk_User Windows account to invoke the adapter Web service in order to send and receive messages to or from SharePoint sites. The group membership will not take effect until you restart the BizTalk host instance.

    This error was triggered by the Windows SharePoint Services receive location or send port with URI wss://ssps026:2011/Lists/ReD Task.

    Do you have any idea why it is happening in my case?
    Thank you.
    Jim.

    Comment by Jim — March 12, 2008 @ 7:21 am | Reply

  2. Hi Ayman,

    I was able to fix the previously specified error, but there is a new one:

    If I write my variant of your “wss://mysite:5555/Lists/Tasks/”, I get HTML error “File Not Found”.
    If instead of wss:// I write http:// I get “(401) Unauthorized” Error.

    Do you have any suggestions?
    Thank you.

    Comment by Jim — March 13, 2008 @ 7:53 am | Reply

  3. Hello Jim,

    I’m glad you find some useful info here.

    from you first comment I understood you have a site at (http://ssps026:2011)and a task List at (http://ssps026:2011/Lists/ReD Task) location. If you try to access the task List with this URl (http://ssps026:2011/Lists/ReD Task/AllItems.aspx) from the browser, does it works?

    If it does work, then I suppose you can use (wss://ssps026:2011/Lists/ReD Task) in you code successfully.
    If it doesn’t work. then you has something wrong with your Task List. try create another one without spaces in it’s name (like RedTask) for example. this might work.

    Comment by Ayman Abdel-Salam — March 17, 2008 @ 3:59 pm | Reply

  4. […] Creating New MOSS 2007 Task Using BizTalk WSS Adapter […]

    Pingback by Sharepoint/MOSS Deployment, Installation Links « More Soma Please… — November 18, 2008 @ 2:06 pm | Reply


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: