Friday, January 10, 2025

create sql query to select all file shares used by all Biztalk applications from Biztalk database in a following format: Biztalk application,Location,file share path

Select * from (
--send ports 
SELECT
   nvcAddress  as path , btsapp.nvcName as BiztalkApp,sendport.nvcName as Port ,'SendPort'
FROM
    dbo.bts_application btsapp
INNER JOIN
    dbo.bts_sendport sendport ON btsapp.nID = sendport.nApplicationID
INNER JOIN
    dbo.bts_sendport_transport sendport_transport ON sendport.nID = sendport_transport.nSendPortID

Where nvcAddress like '%jack%'

UNION ALL

--receive locations
SELECT
     InboundTransportURL as path,
    btsapp.nvcName AS BiztalkApp,rp.nvcName ,
    'ReceivePort'
FROM
    dbo.bts_application btsapp
INNER JOIN
    dbo.bts_receiveport rp ON btsapp.nID = rp.nApplicationID
    INNER JOIN
    dbo.adm_ReceiveLocation rl ON rp.nID = rl.ReceivePortID

     Where InboundTransportURL like '%jack%'
) a
order by BiztalkApp

    --SELECT * FROM sys.tables where name like '%receive%'
    --SELECT * FROM adm_ReceiveLocation

Saturday, January 21, 2023

back biztalk apps

     
$exportFolder = "d:\bcp\2023-01-20"
$server = "DBSERVER110"
$database = "BizTalkMgmtDB"

$apps = @(
"App1"
,"App2"
,"App3"
)

$bp="D:\Program Files (x86)\Microsoft BizTalk Server 2013 R2"

foreach ($app in $apps)
    {
        Write-Host "===== Application: $($app) ==== "

        if ($app -ne "BizTalk.System")   # avoid error trying to export this app 
          {
            $fmtDateTime = $(get-date -f yyyy_MM_dd__HH_mm_ss)
            $bindingsDestFilename = "${exportFolder}\$($app).xml" # _$fmtDateTime 
            $msiAppDestFilename = "${exportFolder}\$($app).msi" # _$fmtDateTime

            write-host $bindingsDestFilename
            $allArgs = @("ExportBindings", "/Destination:$bindingsDestFilename",  "/ApplicationName:$($app)"
                "/Server:$server", "/Database:$database")
            if ($app -eq "BizTalk EDI Application")
            {
               #just backup the parties one time with this one app 
               $allArgs += "/GlobalParties"
            }

            write-host "Args=$allArgs"
            & "$bp\BTSTask.exe" $allArgs

            $allArgs = @("ExportApp", "/Package:$msiAppDestFilename",  "/ApplicationName:$($app)",
                "/Server:$server", "/Database:$database")
            write-host "Args=$allArgs"
            & "$bp\BTSTask.exe" $allArgs
          }
    }
    

Wednesday, July 1, 2015

How to receive email notification when biztalk receive location is suspended

Following stored procedure has been created:

       
IF EXISTS (SELECT '*' FROM sysobjects WHERE id = object_id(N'[dbo].[BiztalkRecieveLocationNotification]'))
DROP PROCEDURE [dbo].[BiztalkRecieveLocationNotification]
GO

CREATE PROCEDURE [dbo].[BiztalkRecieveLocationNotification]
/**********************************************************************************************************
--  DESCRIPTION: Email list of suspended receive locations 
--
--                DATE          AUTHOR                  
--      CREATED:  
--     MODIFIED:  
--                                                                                                       
**********************************************************************************************************/
AS
BEGIN

DECLARE @xml NVARCHAR(MAX)
DECLARE @body NVARCHAR(MAX)


if EXISTS (SELECT *
                FROM BizTalkMgmtDb.dbo.adm_ReceiveLocation AS RL WITH(READPAST, ROWLOCK)
                INNER JOIN BizTalkMgmtDb.dbo.bts_receiveport AS RP WITH(READPAST, ROWLOCK)
                ON RL.ReceivePortId = RP.nID
                INNER JOIN BizTalkMgmtDb.dbo.bts_application AS APP WITH(READPAST, ROWLOCK)
                ON RP.nApplicationID = APP.nID
                where APP.nvcName ='MyBiztalkApp'  AND
                Disabled=-1
            )
BEGIN

     SET @xml = CAST((
    SELECT
         APP.nvcName AS 'td',''
        ,RP.nvcName AS 'td',''
        ,RL.InboundTransportURL AS 'td',''
        ,RL.Name AS 'td',''
    FROM BizTalkMgmtDb.dbo.adm_ReceiveLocation AS RL WITH(READPAST, ROWLOCK)
        INNER JOIN BizTalkMgmtDb.dbo.bts_receiveport AS RP WITH(READPAST, ROWLOCK)
            ON RL.ReceivePortId = RP.nID
        INNER JOIN BizTalkMgmtDb.dbo.bts_application AS APP WITH(READPAST, ROWLOCK)
            ON RP.nApplicationID = APP.nID
     where APP.nvcName ='MyBiztalkApp'  AND
        Disabled=-1
     FOR XML PATH('tr'), ELEMENTS ) AS NVARCHAR(MAX)
      )


    /* Body as the HTML table */
            SET @body ='<html><body><H3>Biztalk Suspended Receive locations:</H3>
                        <table border = "2" align="center"  > 
                        <tr>
                        <th> Application Name </th> <th> Port Name </th> <th> Adapter URI </th><th> Location Name </th></tr>'

            SET @body = @body + @xml +'</table></body></html>'

    /*Execute the Stored Proc to send us the Mail using the Parameters */
                    EXEC msdb.dbo.sp_send_dbmail @recipients='my@email.com',
                    @copy_recipients ='my@email.com',
                    @subject =  'Biztalk recieve location suspended',
                    @body = @body,
                    @body_format = 'HTML' ;
    END

END

Wednesday, May 27, 2015

Error into Disassembler component: The published message could not be routed because no subscribers were found.

This error happens if in disassembler component you missed  outgoing message type specification.
This could be fixed by following code:


    
            // this schema is required to have routing working correctly.
            outMsg.Context.Promote("MessageType",
                "http://schemas.microsoft.com/BizTalk/2003/system-properties",
                "http://SampleImport.InternalSampleImportSchema#Root");


            outMsg.Context.Promote("SchemaStrongName",
              "http://schemas.microsoft.com/BizTalk/2003/system-properties",
              "SampleImport.dll");

counter