Polling using WCF SQL Adapter

Hi - I have to develop this in BizTalk
There is a table in SQL database where BizTalk needs to poll the data using WCF SQL Adapter.
How and what query/stored proc do I need to write ?
and how about polling interval should I mention.
Is there any detailed blog or link which clearly explains this, will be helpful
MBH

The first thing that you should remember is that the most effective way of getting data from SQL would be if you could remove the records after reading them. This was something that the native SQL Server adapter supported. For WCF-SQL, the way to achieve
this is to
Create a SP which is what you will specify as the execute statement for your adapter. This SP would, on the basis of TOP 1, get the ID, read the record and delete it. Then it would return the read data. You will generate schemas for this SP and deploy them
for subscribing to the received messages.
You will create a query that returns the count of records from the said table which you will use as the polling query. This will ensure that the adapter uses this on the configured interval to see if data exists. If it exists, it would use the execute statement
(invoking your SP) to get the data.
There is an option to keep executing the SP while data is available. This ensures that if more than ONE record is inserted into your table, all the records would be picked up after the first polling interval (as opposed to poll, pick-up one, poll and then
pick up the other, etc.). Be careful while setting the polling interval (you cannot go beyond 1 sec) since this depends on your SQL servers ability to process the data.
With regards to documentation, I'd refer you to
http://msdn.microsoft.com/en-us/library/dd788532.aspx - Polling SQL Server by using the WCF-SQL Adapter.
Regards.

Similar Messages

  • Polling records from mulitiple table(61 Tables) using WCF-SQL adapter

    Hi,
    I would like get some suggestion from this forum. I've a scenario, in which I need to poll the records from multiple table(61) which are related and may have one to many relationship. what's the best way to poll the records from SQL table to BizTalk.
    Thanks in advance..
    Regards,
    Karthick

    Karthick,
    Write a SQL stored procedure with joins from your 61 tables (!!!) . Use WCF-SQL adapter to invoke the procedures.
    Following references shall help you:
    Executing Stored Procedures in SQL Server by Using BizTalk Server
    Performing Composite Operations on SQL Server by Using BizTalk Server
    Bing-Results: biztalk wcf sql
    adapter polling stored procedure
    I don’t know your exact requirement. Consider using SQL-SSIS for ETL process depending on your requirements. Anyway if your requirement really needs BizTalk, above suggest
    should solve your problem.
    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

  • How do you configure a WCF-SQL adapter to write data from a SQL2012 "always on" database?

    Hi All,
    I have a BizTalk environment. I have to write the data from BizTalk to the database which is configured using ALWAYS ON availability group.
    I use WCF-SQL adapter to write the data. My question is this setup a supported?

    The answer is NO.
    Refer: Can
    I use a BizTalk WCF-SQL send adapter with a SQL 2012 Always on Database?
    A snippet quoted below.
    In summary (in order of preference):
    Disable AlwaysOn Availability Groups / Mirroring on SQL server if you need to connect to this SQL server which has this enabled
    Disable transactions and implement logic to be able to handle duplicates .
    Disable transactions and handle the duplicates or lost messages with custom logic (e.g. Send twice and compare and implement error handling). You need to write your own DTC handling this which
    is probably very complicated.
    Disable transactions and live with risk of duplicates or lost messages without handling duplicates.
    Refer: SQL Server AlwaysOn feature does not support MSDTC transactions.
    Rachit
    Please mark as answer or vote as helpful if my reply does

  • WCF-SQL Adapter Set up

    Hi,
    I am using Microsoft Biztalk 2010 on Windows Server 2007(SP2). I am want to use WCF-SQL adapter but I am not able to see any adapter when I tried to create new adapter at "Platform Setting -> Adapter -> New Adapter dropdown.".
    Windows Communication Foundation LOB Adapter SDK, Microsoft Biztalk Adapter Pack, Microsoft Biztalk Adapter Pack(x64) are installed on my machine.
    Am I missing something? how to get the WCF-SQL in the list of adapter.
    Thanks, Girish R. Patil.

    Hi Girish,
    Another area to check is machine.config file for binding entries.
    check following for hint  :   http://tech-findings.blogspot.in/2013/06/no-valid-adapters-installed-on-machine.html
    Maheshkumar S Tiwari|User Page|Blog|BizTalk
    Server : How Map Works on Port Level

  • WCF-SQL Adapter Login fail 'NT AUTHORITY\ANONYMOUS LOGON

    Hi,  
    I am have three WCF-SQL receive with WCF-SQL Adapater and two are working fine but the third one is giving the following warning in the Eventlog.  Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.
    I really appreciate your help.
    thanks
    Ram
    ---------------Warning written to EventLog --------------- 
    The adapter "WCF-SQL" raised an error message. Details "Microsoft.ServiceModel.Channels.Common.AdapterException: Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.. Endpoint Address - mssql://txhubdb//switch_mailbox_RX2?
    ---> System.Data.SqlClient.SqlException: Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.
       at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
       at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
       at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
       at System.Data.SqlClient.SqlDataReader.get_MetaData()
       at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
       at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds)
       at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite)
       at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
       at System.Data.SqlClient.SqlCommand.ExecuteXmlReader()
       at Microsoft.Adapters.Sql.ExecutionHelper.ExecuteXmlReader(SqlCommand sqlCommand, Double totalSeconds)
       at Microsoft.Adapters.Sql.SqlAdapterInboundHandler.Polling_TryReceive(TimeoutHelper timeoutHelper, Message& wcfMessage)
       at Microsoft.Adapters.Sql.SqlAdapterInboundHandler.TryReceive(TimeSpan timeout, Message& message, IInboundReply& reply)
       --- End of inner exception stack trace ---
       at Microsoft.ServiceModel.Channels.Common.Channels.AdapterInputChannel.EndTryReceive(IAsyncResult result, Message& message)
       at System.ServiceModel.Dispatcher.InputChannelBinder.EndTryReceive(IAsyncResult result, RequestContext& requestContext)
       at System.ServiceModel.Dispatcher.ErrorHandlingReceiver.EndTryReceive(IAsyncResult result, RequestContext& requestContext)".

    1) Do you have the same Credentials settings for all 3 Receive Locations (Found under Configure | Other | Credentials on you WCF-SQL Adapter)
    2) Are all 3 Receive Locations Locations polling from the same SQL Server? If not are they then on the same domain? If the server that is failing is not on the same domain as your BizTalk Host User, then you might need to supply credentials and use a local
    SQL User.
    Morten la Cour

  • WCF-SQL Adapter Hangs in Active State for hours

    I'm at a new client, and doing a simple test with a content-based-routing solution picks up a file, maps it, and is supposed to update a SQL database.  The WCF-SQL send port is stuck in the "active" state.  No messages in EventLog.  If there's
    an issue, I don't know why it doesn't just suspend.
    Any ideas?
    Thanks,
    Neal Walters

    Hi Neal,
    Few things to check IMO,
    Check if the host instance is running properly
    Check the version of the Host instance, If required make the host instance to 32 bit. 
    If it is using any schemas then make sure the binaries are deployed and gace'ed
    Try to restart the BizTalk host instance to see if it makes a difference
    Check if your SQL Database Instance is UP and running , Make sure the BizTalk service Account has proper rights on the SQL server and has execute permission on the SQL Stored procedure (if using one)
    Check if you have anything on the SQL server event viewer.
    Try to complete you routing of file using a send port also which will copy the input message to a temp folder location , Try  Using Failed Message Routing to see
    if it helps!
    There is an article
    Configuring a Port Using the WCF-SQL Adapter for further reference. 
    HTH,
    Naushad Alam
    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or
    Mark As Answer
    alamnaushad.wordpress.com
    My new TechNet Wiki
    "BizTalk Server: Performance Tuning & Optimization"

  • WCF-SQL Adapter

    How to add the wcf-sql adapter to BizTalk application?
    Aditi

    Hi Aditi,
    To add WCF-SQL adapter follow the MSDN link:Adding the SQL Adapter to BizTalk Server Administration Console
    To add WCF-SQL adapter  and start working with it, follow the technet article :
    BizTalk Server: WCF-SQL Adapter Table Operations
    Maheshkumar
    S Tiwari|User
    Page|Blog|BizTalk
    Server: Multiple XML files to Single FlatFile Using File Adapter

  • Adding wcf-sql adapter

    Please suggest how to add the wcf-sql adapter to biztalk application.

    you first need to configure handler for wcf-sql adapter.
    open admin console, goto platform settings, expand adapters, and select wcf-sql adapter. and right click on it, and then create receive/send handlers for it.
    if you don't see wcf-sql adapter in adapter section, it means that you did not install wcf-sql adapter components.
    Please mark the post as answer if this answers your question. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

  • Use wcf-sql to call procedure

    when i use wcf-sql to call store procedure, i got problem:
    the store procedure like this:
    @variable_1 varchar(300);
    @variable_2 varchar(300);
    @variable_3 int;
    if LEN(@variable_1)<=1
    begin
         set @variable_2=0;
    end
    else
        set @variable_2=substring(@variable_1,1,LEN(@variable_1)-1); 
        set @variable_3= checksum(@variable_2);
    when the input parameter @variable_1 is empty value, it will raise two error: 1: invalid length parameter passed to the SUBSTRING function. 2: function "checksum" request at least 1 argument(s).
     it's so strange! how can i avoid this issue?

    Hi Jacky,
    Substring function can have length as positive integer only.
    SUBSTRING ( expression ,start , length )
    Length is a positive integer or bigint expression that specifies how many characters of the
    expression will be returned. If
    length is negative, an error is generated and the statement is terminated. If the sum of
    start and
    length is greater than the number of characters in
    expression, the whole value expression beginning at
    start is returned.
    Error (invalid length parameter passed to the SUBSTRING function) is result of this.
    i.e. when variable_1 = 0, length will return a negative integer.
    Error (function "checksum" request at least 1 argument(s)) is because the variable_2 is not assigned any value due to Error 1.
    Rachit
           thanks Rachit, but if @variable_1 is empty value,it should not execute
    "else" part. this is my question. how can it happen?

  • DB polling using custom SQL in SOA Suite 11g

    Hi,
    We are trying to poll records from a database using custom sql. But all the records in the table are being picked up at the same time and not as per the polling frequency set in the adapter.
    Below is the configuration from the .jca file:
    <endpoint-activation portType="II_ptt" operation="receive">
    <activation-spec className="oracle.tip.adapter.db.DBActivationSpec">
    <property name="DescriptorName" value="II.OrderRequest"/>
    <property name="QueryName" value="IISelect"/>
    <property name="MappingsMetaDataURL" value="II-or-mappings.xml"/>
    <property name="PollingStrategy" value="DeletePollingStrategy"/>
    <property name="PollingInterval" value="60"/>
    <property name="MaxRaiseSize" value="10"/>
    <property name="MaxTransactionSize" value="10"/>
    <property name="SequencingColumn" value="REQUEST_SAK"/>
    <property name="NumberOfThreads" value="1"/>
    <property name="ReturnSingleResultSet" value="false"/>
    <property name="DeleteDetailRows" value="false"/>
    </activation-spec>
    </endpoint-activation>
    Please let us know if anything else needs to be set to enable the polling as per the frequency in the adapter.
    Thanks.

    As the link from Anuj said, you need to also configure 'Distributed Polling' in the wizard. This speed limit trick will no longer work out of the box in 11.1.1.3 on, you will also have to set usesSkipLocking="false" in your DbAdapter connection pool definition. Skip locking eliminates the locking contention issue, so this primitive kind of load balancing is no longer needed in that case.
    Thanks
    Steve

  • Using WCF Cutom Adapter to return CLOB (or similar)

    Hi all,
    I am trying to return mulitple sets of data from an Oracle table each of which exceed VARCHAR2(4000).
    I wish to do this in one call to a stored procedure as the intention is to assign the returned data to a messages body parts so that I can send them as multiple seperate attachments to an email (using the SMTP adapter).
    My oracle stored procedure and returned data types are as follows:
        PROCEDURE get_job(
            po_job_id OUT jobs.job_id%TYPE, po_endpoint OUT data.endpoint%TYPE,
            po_job_type OUT job_types.job_type_id%TYPE, po_data OUT rec_data_table);
        TYPE rec_data_table IS TABLE OF rec_data
           INDEX BY BINARY_INTEGER;
        TYPE rec_data IS RECORD (
            data CLOB
            --data VARCHAR2(4000));
    If I do restrict the data to VARCHAR2(4000), as shown commented out in the rec_data RECORD above everything works fine.
    However, to return anything larger I believe would require me to return a CLOB (even though I would probably only be returning data of a few MBytes not GBytes).
    Having tried this I get the following error:
    "The adapter "WCF-Custom" raised an error message. Details "Microsoft.ServiceModel.Channels.Common.TargetSystemException: ORA-03113: end-of-file on communication channel
    Process ID: 499868
    Session ID: 201 Serial number: 33735 ---> Oracle.DataAccess.Client.OracleException: ORA-03113: end-of-file on communication channel
    Process ID: 499868
    Session ID: 201 Serial number: 33735"
    I am using Oracle 11gR2, BizTalk 2010 and the WCF adapter with oracle bindings.
    Researching this I find conflicting information:
    "LOB types: The WCF-based Oracle DB adapter provides rich support for BLOB, CLOB and BFILE types in tables and stored procedures/functions. The adapter also exposes special operations for streaming BLOB/CLOB/BFILE data in the WCF service model
    interface." Source: http://blogs.msdn.com/b/adapters/archive/2007/10/29/biztalk-oracle-adapter-vs-wcf-based-oracle-db-adapter.aspx
    “Due to the limitation of associative arrays, PL/SQL tables or PL/SQL tables of records that contain any of the following data types are not supported in the Oracle Database adapter:
    BFILE
    BLOB
    CLOB ……….”
    Source: http://msdn.microsoft.com/en-us/library/dd788520.aspx
    Also, this post (http://social.msdn.microsoft.com/Forums/en-US/303cc67c-5e01-4ecb-ba5c-184a1d73a7f7/biztalk-wcf-adpater-oracle-store-procedure-returning-clob?forum=biztalkediandas2) seems to indicate
    it is possible but there is no detail so not sure if it matches my requirements.
    I have also had a quick look at the
    Operate_LOB sample but not sure if this will provide me with the solution I am after as I really wanted to return an array of CLOBS (or similar).
    I have seen various other posts but nothing that definitively answers my questions and from my tests I would say that I can’t easily return largish amounts of data (a few MBs) in a single element
    from Oracle …. unless of course I am missing something.
    Can anyone give me a definitive answer as to whether I can do what I have set out above … if not I will turn my attention to a different solution.
    Many Thanks for any help/advice you can provide,
    Regards,
    Dave

    From your description, it can hardly give precise troubleshooting for this problem, you can
    consider opening a support case with us. Visit this link to see the various support options that are available to better meet your needs: 
    http://support.microsoft.com/default.aspx 

  • For the property PollingStatement issue in WCF-SQL adapter

    Why i am getting below errors and finally receive port is disabled .
    Configured WC_SQl properties :
    In General tab:
    InBoundID=PODepartment
    IntialCatalog:Test
    Server: .
    First error :
    The Messaging Engine failed to add a receive location "RL_WCFCustomer" with URL "mssql://.//Test?InboundId=PODepartment" to the adapter "WCF-SQL". Reason: "Microsoft.ServiceModel.Channels.Common.AdapterException: The value
    "" for the property PollingStatement is invalid.
    Second error:
    The receive location "RL_WCFCustomer" with URL "mssql://.//Test?InboundId=PODepartment" is shutting down. Details:"The Messaging Engine failed while notifying an adapter of its configuration. ".

    After configure below properties ,getting new issue,but i don't see the schema in admin console which has mentioned in below schema related issue
    Property details
    Inbound operation type:TypedPooling
    Poll data available statement:select * from dbo.PODepartment
    Polling statement:select * from dbo.PODepartment
    Issue Details:
    There was a failure executing the receive pipeline: "Microsoft.BizTalk.DefaultPipelines.XMLReceive, Microsoft.BizTalk.DefaultPipelines, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Source: "XML disassembler" Receive
    Port: "RPN_WCFCustomer" URI: "mssql://.//Test?InboundId=PODepartment" Reason: Finding the document specification by message type "http://schemas.microsoft.com/Sql/2008/05/TypedPolling/PODepartment#TypedPolling" failed. Verify
    the schema deployed properly.

  • Error while posting to Webservice using WCF-BasicHttp adapter

    Hi,
    I am getting the below exception when i am posting a request to a .asmx webservice using the Wcf-BasicHttp adapter.
    I am able to call the same service with the SOAP adapter successfully. Could you please let me know any resolutions for the same.
    The adapter failed to transmit message going to send port "MySendPort" with URL "http://myservice.com/Web.Services/service1.asmx". It will be retransmitted after the retry interval specified for this Send Port. Details:"System.ServiceModel.ProtocolException:
    The content type text/html; charset=utf-8 of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 1024 bytes
    of the response were: '
    <html>
        <head><link rel="alternate" type="text/xml" href="/Web.Services/Service1.asmx?disco" />
        <style type="text/css">
            BODY { color: #000000; background-color: white; font-family: Verdana; margin-left: 0px; margin-top: 0px; }
            #content { margin-left: 30px; font-size: .70em; padding-bottom: 2em; }
            A:link { color: #336699; font-weight: bold; text-decoration: underline; }
            A:visited { color: #6699cc; font-weight: bold; text-decoration: underline; }
            A:active { color: #336699; font-weight: bold; text-decoration: underline; }
            A:hover { color: cc3300; font-weight: bold; text-decoration: underline; }
            P { color: #000000; margin-top: 0px; margin-bottom: 12px; font-family: Verdana; }
            pre { background-color: #e5e5cc; padding: 5px; font-family: Courier New; font-size: x-small; margin-top: -5px; border: 1px #f0f0e0 solid; }
            td { color: #000000; font-family: Verdana; font-size: .7em; }
            h2 { font-size: 1.5em; font-weight: bold; margin-top: 25px; margin-bottom: 10px; border-to'.
    Server stack trace:
       at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
       at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result)
       at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
       at System.ServiceModel.Channels.ServiceChannel.EndRequest(IAsyncResult result)
    Exception rethrown at [0]:
       at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
       at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
       at System.ServiceModel.Channels.IRequestChannel.EndRequest(IAsyncResult result)
       at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfClient`2.RequestCallback(IAsyncResult result)".
    Regards,
    Ujjwal
    -Ujjwal

    Where does the HTML indicate that the Service is not running??
    The error message " The content type text/html; charset=utf-8 of the response message does not match
    the content type of the binding (text/xml; charset=utf-8)" points to a bug in the WCF-BasicHttp described here:
    http://social.msdn.microsoft.com/Forums/en-US/11796bf5-ba6a-4878-977e-5c854642f67c/the-content-type-textxml-charsetiso88591-of-the-response-message-does-not-match-the-content?forum=biztalkgeneral
    Although not 100% the same, the conclusion here was to still use the old Adapter :-(
    Morten la Cour

  • Notice update or delete in Database via WCF SQL Adapter

    Hi Folks,
    i try to notice any changes in a database table via SQL Adapter: so i check for a special column wich contains '0' for new datasets and '1' for those i already copied via BizTalk.
    This works fine as long as you only insert datasets, update or delete is not recocnized...
    Whats the best or possible way to react on these actions too?
    Thanks for your Ideas!

    Hi,
    I am shure there are many different approaches so here is what I have in mind:
    In case you need to react to deleted rows in your original table you need a sub table to trigger your biztalk for datasets that do not exist any longer.
    In this table you need 2 colums:
    first one to correlate to your original data row (id),
    second one to hold the status: For ex. 0= new, 1=update, 3=deleted
    Then you need a
    Trigger event on your original table that sets the status for the modified data id in your new table.
    You can then poll on this sub table as you already mentioned in your question.

  • How Biztalk Engine come to know through WCF-Sql Adapter that new record was added in Sql Table?

    Regards Ravin

    WCF-SQL adapter for receiving polls the the DB to fetch records. Its not by intelligence that the adapter will know that a new record is added.
    Your db and table design and the poll querry has to be intelligent enough to pull in new records from the table and not the already processes or polled records.
    Something like a poll flag for processed records.
    Regards
    When you see answers and helpful posts,
    please click Vote As Helpful, Propose As Answer, and/or Mark As Answer

Maybe you are looking for