none
How to Use C#API from XSLT RRS feed

  • Question

  • Hi All In BizTalk I need to query all employee Id from Sql. and map to destination using xslt

    for example

    <employeeId>

        <xsl:value-of select="$var:v16" />         
    </employeeId>we will pass id to sql and get all ID in string variable. then iterate in string and take individual values and maped to destination.

    desination is

    <months> Repaeting

    <empid>

    <ename>

    </months>


    anagh

    Tuesday, February 2, 2016 10:35 AM

Answers

All replies

  • You can add custom extension XML file to your solution in order to declare the namespace and use a method from a .Net assembly from XSLT.

    see the link  https://code.msdn.microsoft.com/Calling-an-external-c74ce8dc




    Tuesday, February 2, 2016 11:00 AM
  • Thank you let me try

    anagh

    Tuesday, February 2, 2016 11:22 AM
  • HOLD ON!

    It is very bad practice to call SQL Server, or any service, from a Map.  Please don't go any further.

    Can you explain you process/requirement some more?  Then we can give you much better advice.

    For instance, you probably should be polling the database using a Stored Procedure, then mapping the entire result to your destination format.  That is a fairly simple operation and does nor require calling out from Map.

    Tuesday, February 2, 2016 12:50 PM
    Moderator
  • Hi this is the input we get s for each employeeid we need to get data in MAP from SQL. SQL will return all details of employee, then iterate and map to destination Months shown below

    INPUT:<StoredProcedureResultSet2 xmlns="http://schemas.microsoft.com/Sql/2008/05/ProceduresResultSets/dbo/S">
          <PROCESSTYPE>merge                         </PROCESSTYPE>
          <EMPLID>10994      </EMPLID>
          <DATE_DAY1>2015-10-01T00:00:00Z</DATE_DAY1>
          <HOURLY_RT>0.000000</HOURLY_RT>
          <JOB_TITLE>JT        </JOB_TITLE>
        </StoredProcedureResultSet2>
        <StoredProcedureResultSet2 xmlns="http://schemas.microsoft.com/Sql/2008/05/ProceduresResultSets/dbo/">
          <PROCESSTYPE>merge                         </PROCESSTYPE>
          <EMPLID>10994      </EMPLID>
          <DATE_DAY1>2015-10-05T00:00:00Z</DATE_DAY1>
          <HOURLY_RT>8.000000</HOURLY_RT>
          <JOB_TITLE>JT        </JOB_TITLE>
        </StoredProcedureResultSet2>
        DESTINATION

    <months> Repaeting

    <empid>

    <ename>

    </months>


    anagh

    Tuesday, February 2, 2016 1:33 PM
  • Hi Anagh,

    Simple way to go ahead is to use Orchestration instead of query SQL in MAP.

    Using Orchestration will make your Development and maintenance easy and you can use mapping inside your orchestration to populate data in SQL.

    Thanks

    Abhishek 


    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

    Tuesday, February 2, 2016 7:34 PM
  • I think you'd be better off using a Stored Procedure to retrieve all the data internally.

    From you sample, you can use the Batch Retrieve pattern described here to pass in and return all employee data at once.

    http://social.technet.microsoft.com/wiki/contents/articles/24803.biztalk-server-sql-patterns-for-polling-and-batch-retreive.aspx

    You should still not be looking up data from a Map.

    • Marked as answer by Angie Xu Thursday, February 18, 2016 4:25 AM
    Tuesday, February 2, 2016 8:15 PM
    Moderator