BrowsingArtifacts (BizTalk Server 範例)
BrowsingArtifacts 範例示範如何列舉 BizTalk 成品和屬性。
必要條件
您必須擁有BizTalk Server系統管理許可權,才能使用此範例中的系統管理物件。
Windows PowerShell 指令碼範例需要 Windows PowerShell 執行原則來允許指令碼執行。 如需詳細資訊,請參閱 about_Execution_Policies。
此範例的用途
此範例示範如何使用Microsoft.BizTalk.ExplorerOM命名空間中的BtsCatalogExplorer類別來列舉成品並報告其屬性。 下列成品包含在此範例所產生的報表中:協調流程、埠、元件、合作物件和轉換。 此範例是以 Microsoft Visual C# 撰寫。 本主題也會提供Windows PowerShell範例腳本。
此範例的位置
這個範例位於下列 SDK 位置:
<範例路徑>\管理員\ExplorerOM\BrowsingArtifacts
下表顯示此範例中的檔案,並描述其用途。
檔案 | Description |
---|---|
BrowsingArtifacts.cs | 此範例中示範之作業的 Visual C# 原始程式檔。 |
BrowsingArtifacts.sln、BrowsingArtifacts.csproj、BrowsingArtifacts.suo | 此範例的方案和專案檔。 |
建置和執行此範例
建置此範例
在 Visual Studio 中,開啟方案檔 BrowsingArtifacts.sln。
在 [建置] 功能表上,按一下 [建置方案]。
執行此範例
開啟命令視窗並巡覽至下列資料夾:
<範例路徑>\管理員\ExplorerOM\BrowsingArtifacts\bin\Debug
執行檔案 BrowsingArtifacts.exe。
Windows PowerShell 指令碼範例
下列Windows PowerShell腳本可用來示範ExplorerOM類別的相同功能:
Function EnumOrchestrations($catalog)
{
Write-Host `r`n======================
Write-Host === ORCHESTRATIONS ===
Write-Host ======================`r`n
#=== Enumerating the assemblies and pulling orchestration information ===#
foreach($assembly in $catalog.Assemblies)
{
foreach($orch in $assembly.Orchestrations)
{
#=== We can’t report the host if it is not hosted or enlisted ===#
if ($orch.Status -ieq "Unenlisted")
{
Write-Host Name : $orch.Fullname`r`nHost : N/A`r`nStatus : $orch.Status
}
else
{
Write-Host Name : $orch.Fullname`r`nHost : $orch.Host.Name`r`nStatus : $orch.Status
}
#=== Reporting port types and operations ===#
foreach($port in $orch.Ports)
{
Write-Host "`tPort:"$port.PortType.FullName
foreach($portop in $port.PortType.Operations)
{
Write-Host "`t`tOperation:"$portop.Name
}
}
#=== Reporting Used roles ===#
foreach($role in $orch.UsedRoles)
{
Write-Host "`tRole:"$role.Name"`("$role.ServiceLinkType"`)"
foreach($EnlistedParty in $role.EnlistedParties)
{
Write-Host "`t`tParty:"$Enlistedparty.Party.Name
}
}
#=== Reporting implemented roles ===#
foreach($role in $orch.ImplementedRoles)
{
Write-Host "`tRole:"$role.Name"`("$role.ServiceLinkType"`)"
}
Write-Host
}
}
}
Function EnumOtherArtifacts($catalog)
{
Write-Host `r`n======================
Write-Host "=== ASSEMBLIES ==="
Write-Host ======================`r`n
foreach($assembly in $catalog.Assemblies)
{
Write-Host $assembly.Name
}
Write-Host `r`n======================
Write-Host "=== HOSTS ==="
Write-Host ======================`r`n
foreach($btshost in $catalog.Hosts)
{
Write-Host $btshost.Name"`($($btshost.Type)`)"
}
Write-Host `r`n======================
Write-Host "=== PARTIES ==="
Write-Host ======================`r`n
foreach($party in $catalog.Parties)
{
Write-Host $party.Name
foreach($sendport in $party.SendPorts)
{
Write-Host "`tSendPort:"$sendport.Name
}
foreach($alias in $party.Aliases)
{
Write-Host "`tAlias:"$alias.Name":"$alias.Qualifier"="$alias.Value
}
}
Write-Host `r`n======================
Write-Host "=== TRANSFORMS ==="
Write-Host ======================`r`n
foreach($transform in $catalog.Transforms)
{
Write-Host $transform.FullName":`r`n`t"$transform.SourceSchema.Fullname"==>"$transform.TargetSchema.Fullname`r`n
}
}
#=== Main Script Body ===#
#=== Make sure the ExplorerOM assembly is loaded ===#
[void] [System.reflection.Assembly]::LoadWithPartialName("Microsoft.BizTalk.ExplorerOM")
#=== Connect to the BizTalk Management database ===#
$Catalog = New-Object Microsoft.BizTalk.ExplorerOM.BtsCatalogExplorer
$Catalog.ConnectionString = "SERVER=.;DATABASE=BizTalkMgmtDb;Integrated Security=SSPI"
#=== All reporting is performed in the following two functions ===#
EnumOrchestrations $Catalog
EnumOtherArtifacts $Catalog
以下是執行Windows PowerShell腳本以及範例輸出的範例:
PS C:\> .\BrowsingArtifacts.ps1
======================
=== ORCHESTRATIONS ===
======================
Name : Microsoft.BizTalk.Edi.BatchSuspendOrchestration.BatchElementSuspendService
Host : BizTalkServerApplication
Status : Enlisted
Name : Microsoft.BizTalk.Edi.BatchingOrchestration.BatchingService
Host : BizTalkServerApplication
Status : Enlisted
Name : Microsoft.BizTalk.Edi.RoutingOrchestration.BatchRoutingService
Host : BizTalkServerApplication
Status : Enlisted
Name : EAIOrchestrations.EAIProcess
Host : N/A
Status : Unenlisted
Port: EAIOrchestrations.ReceiveReqType
Operation: Operation_1
Port: EAIOrchestrations.SendDeclineType
Operation: Operation_1
Port: EAIOrchestrations.SendToERPType
Operation: Operation_1
Name : B2BOrchestrations.B2BProcess
Host : BizTalkServerApplication
Status : Started
Port: B2BOrchestrations.ReceivePO_Type
Operation: Operation_1
Port: B2BOrchestrations.SendPOConfirmed_Type
Operation: Operation_1
Port: B2BSchemas.localhost.Process_.Process
Operation: ReceivePO
Port: B2BOrchestrations.ReceiveASN_Type
Operation: Operation_1
Port: B2BOrchestrations.ReceiveInvoice_Type
Operation: Operation_1
Port: B2BOrchestrations.PortType_PaymentVoucherArchive
Operation: Operation_1
Port: B2BSchemas.localhost1.Payment_Service_.Payment_Service
Operation: ProcessPayment
Port: B2BOrchestrations.SendPaymentAck_Type
Operation: Operation_1
======================
=== ASSEMBLIES ===
======================
Microsoft.BizTalk.GlobalPropertySchemas
Microsoft.BizTalk.DefaultPipelines
Microsoft.BizTalk.Adapter.MSMQ.MsmqAdapterProperties
MQSeries
Microsoft.BizTalk.Hws.HwsPromotedProperties
Microsoft.BizTalk.Hws.HwsSchemas
Microsoft.BizTalk.KwTpm.StsDefaultPipelines
Microsoft.BizTalk.KwTpm.RoleLinkTypes
mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Microsoft.BizTalk.Edi.BaseArtifacts
Microsoft.BizTalk.Edi.EdiPipelines
Microsoft.BizTalk.Edi.BatchingOrchestration
Microsoft.BizTalk.Edi.RoutingOrchestration
Microsoft.BizTalk.Edi.EdiIntPipelines
EAISchemas
EAIOrchestrations
B2BSchemas
B2BOrchestrations
WCFArtifacts
FFDisassemblerWalkthrough
BTSWhitespaceTest
======================
=== HOSTS ===
======================
BizTalkServerApplication (InProcess)
BizTalkServerIsolatedHost (Isolated)
======================
=== PARTIES ===
======================
PartyB
Alias: Organization : OrganizationName = PartyB
======================
=== TRANSFORMS ===
======================
EAISchemas.FFRequestDeniedMap :
EAISchemas.FlatFileSchema1 ==> EAISchemas.RequestDenied
EAISchemas.RequestDeniedMap :
EAISchemas.Request ==> EAISchemas.RequestDenied
B2BSchemas.InvoiceToPayment :
B2BSchemas.CommonInvoice ==> B2BSchemas.localhost1.Reference
B2BSchemas.MapToCommonPO :
B2BSchemas.PO ==> B2BSchemas.localhost.Reference
BizTalkArtifacts.ConcatMap :
BizTalkArtifacts.InputSchema ==> BizTalkArtifacts.OutputSchema
FFDisassemblerWalkthrough.Map1 :
FFDisassemblerWalkthrough.Body ==> FFDisassemblerWalkthrough.Body
BTSWhitespaceTest.Map1 :
FFDisassemblerWalkthrough.Body ==> BTSWhitespaceTest.Schema1