none
WCF-SQL Simple insert RRS feed

  • Question

  • I am trying the WCF-SQL adapter for the first time, and am doing a littel POC. However I cannot succeed in this simple scenario. I think there is somthing pretty basic I am missing.

    I have created a database ”SqlAdapterTest”, and a simple table:

    USE [SqlAdapterTest]

    GO

     

    /****** Object:  Table [dbo].[Test]    Script Date: 12/01/2010 15:56:41 ******/

    SET ANSI_NULLS ON

    GO

     

    SET QUOTED_IDENTIFIER ON

    GO

     

    CREATE TABLE [dbo].[Test](

               [ID] [int] NOT NULL,

               [Text] [nvarchar](255) NOT NULL,

     CONSTRAINT [PK_Test] PRIMARY KEY CLUSTERED

    (

               [ID] ASC

    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]

    ) ON [PRIMARY]

     

    GO

     

    I then created a test BT project, and generated schemas for inserting data in the table above through “Add Generated Items” -> “ConsumeAdapterService”.

    In the “Consume Adapter Service” I successfully connect to my database with the sqlBinding binding. I then select the Test table and add the Insert operation, and press OK.

    I then create a valid instance of the auto generated schema (TableOperation.dbo.Test.xsd):

    <ns0:Insert xmlns:ns0="http://schemas.microsoft.com/Sql/2008/05/TableOp/dbo/Test">

      <ns0:Rows>

        <ns1:Test xmlns:ns1="http://schemas.microsoft.com/Sql/2008/05/Types/Tables/dbo">

          <ns1:ID>10</ns1:ID>

          <ns1:Text>This is a test</ns1:Text>

        </ns1:Test>

      </ns0:Rows>

    </ns0:Insert>

    Then I create a BizTalk application where I deploy this project. I created a FILE receive location and a WCF-SQL send port (mssql://localhost//SqlAdapterTest?InboundId=1) that subscribes to its messages.

    When I test this scenario my send port fails with the error below:

    The adapter failed to transmit message going to send port "SendPort1" with URL "mssql://brnbiz09dev-ds//SqlAdapterTest?InboundId=1". It will be retransmitted after the retry interval specified for this Send Port. Details:"System.ArgumentNullException: Value cannot be null.

    Parameter name: key

       at System.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)

       at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)

       at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfClient`2.CreateChannelFactory[TChannel](IBaseMessage bizTalkMessage)

       at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfClient`2.InitializeValues(IBaseMessage message)

       at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfClient`2..ctor(IBaseMessage message, WcfTransmitter`2 transmitter)

       at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfTransmitter`2.GetClientFromCache(String spid, IBaseMessage message)

       at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfAsyncBatch`2.BatchWorker(List`1 messages)".

     

    Any help would be appreciated.

     

    Wednesday, December 1, 2010 3:31 PM

Answers

  • Hi David,

    For operations on table using the WCF-SQL Adapter I have written a post about how to do insert, update, delete and select. Error does state that one of the values is null.

    HTH

    Regards,

    Steef-Jan Wiggers
    MVP & MCTS BizTalk Server
    http://soa-thoughts.blogspot.com/
    If this answers your question please mark it accordingly

     


    BizTalk
    • Marked as answer by David Sand Thursday, December 2, 2010 7:34 AM
    Wednesday, December 1, 2010 6:12 PM
    Moderator