2010-01-13 4 views
1

나는 가장 성가신 문제가 있습니다.BizTalk WCF-SQL 어댑터보기에서 선택

보기에 대해 조회를 수행하는 오케스트레이션이 있습니다. 로컬 및 개발 서버에서 작동하지만 QA 또는 UAT에서는 작동하지 않습니다. 동일한 코드. 같은 견해. 다른 환경.

이 문제를 테스트하고 내 로컬 BizTalk를 사용하여 서버 A에 포트를 구성하고 메시지를 발생 시키면 예상대로 작동합니다. 그런 다음 송신 포트의 구성을 서버 B로 변경하고 (변경 사항은 모두) 같은 메시지를 입력하면 실패합니다.

동일한보기에서 동일한 작업에 대해 두 가지 오류 중 하나가 발생하므로 오류 메시지조차 일관성이 없습니다.

Event Type: Warning 
Event Source: BizTalk Server 2009 
Event Category: (1) 
Event ID: 5743 
Date: 13/01/2010 
Time: 16:53:07 
User: N/A 
Computer: VM-RC-BTS2009 
Description: 
The adapter failed to transmit message going to send port "AX Lookup CRM_CUST" with URL "mssql://server//db?". It will be retransmitted after the retry interval specified for this Send Port. Details:"Microsoft.ServiceModel.Channels.Common.XmlReaderGenerationException: The columns BANKACCOUNTRECID and BLOCKED are either duplicated or not in a sequence. Each column can only be selected one time, and columns must be selected in sequence. 
    at Microsoft.Adapters.Sql.SelectBodyWriter.OnWriteBodyContents(XmlDictionaryWriter writer) 
    at System.ServiceModel.Channels.BodyWriter.WriteBodyContents(XmlDictionaryWriter writer) 
    at System.ServiceModel.Channels.BodyWriterMessage.OnWriteBodyContents(XmlDictionaryWriter writer) 
    at System.ServiceModel.Channels.Message.WriteBodyContents(XmlDictionaryWriter writer) 
    at Microsoft.Adapters.AdapterUtilities.AdapterMessage.OnWriteBodyContents(XmlDictionaryWriter writer) 
    at System.ServiceModel.Channels.Message.WriteBodyContents(XmlDictionaryWriter writer) 
    at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfMarshaller.CreateBizTalkMessageStream(Message wcfMessage, IAdapterConfigInboundMessageMarshalling config) 
    at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfMarshaller.CreateBizTalkMessage(IBaseMessageFactory messageFactory, IAdapterConfigInboundMessageMarshalling marshallingConfig, Message wcfMessage) 
    at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfClient`2.RequestCallback(IAsyncResult result)". 

또는

Event Type: Warning 
Event Source: BizTalk Server 2009 
Event Category: (1) 
Event ID: 5743 
Date: 13/01/2010 
Time: 16:45:49 
User: N/A 
Computer: VM-RC-BTS2009.ad.integralgroup.co.nz 
Description: 
The adapter failed to transmit message going to send port "AX Lookup CRM_CUST" with URL "mssql://vm-lesmillsnzqa.aplplus.local//LMNZ_AX_Improve?". It will be retransmitted after the retry interval specified for this Send Port. Details:"Microsoft.ServiceModel.Channels.Common.XmlReaderGenerationException: The columns ACCOUNTNUM and BANKACCOUNTRECID are either duplicated or not in a sequence. Each column can only be selected one time, and columns must be selected in sequence. 
    at Microsoft.Adapters.Sql.SelectBodyWriter.OnWriteBodyContents(XmlDictionaryWriter writer) 
    at System.ServiceModel.Channels.BodyWriter.WriteBodyContents(XmlDictionaryWriter writer) 
    at System.ServiceModel.Channels.BodyWriterMessage.OnWriteBodyContents(XmlDictionaryWriter writer) 
    at System.ServiceModel.Channels.Message.WriteBodyContents(XmlDictionaryWriter writer) 
    at Microsoft.Adapters.AdapterUtilities.AdapterMessage.OnWriteBodyContents(XmlDictionaryWriter writer) 
    at System.ServiceModel.Channels.Message.WriteBodyContents(XmlDictionaryWriter writer) 
    at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfMarshaller.CreateBizTalkMessageStream(Message wcfMessage, IAdapterConfigInboundMessageMarshalling config) 
    at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfMarshaller.CreateBizTalkMessage(IBaseMessageFactory messageFactory, IAdapterConfigInboundMessageMarshalling marshallingConfig, Message wcfMessage) 
    at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfClient`2.RequestCallback(IAsyncResult result)". 
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp. 

나는 <Columns>*</Columns>을 요구하고 있고 <Query>WHERE FIELD='xyz'</Query>

여기에 실제 메시지입니다;

그런 다음 sqlbinding 인 TwoWay WCF- 사용자 지정 송신 포트가 있습니다. 구성은 다음과 같습니다.

<?xml version="1.0" encoding="utf-8"?> 
<configuration> 
    <system.serviceModel> 
    <client> 
     <endpoint address="mssql://devserver//DbName?" behaviorConfiguration="EndpointBehavior" binding="sqlBinding" bindingConfiguration="sqlBinding" contract="BizTalk" name="CUST Lookup" /> 
    </client> 
    <behaviors> 
     <endpointBehaviors> 
     <behavior name="EndpointBehavior" /> 
     </endpointBehaviors> 
    </behaviors> 
    <bindings> 
     <sqlBinding> 
     <binding name="sqlBinding" useAmbientTransaction="false" /> 
     </sqlBinding> 
    </bindings> 
    </system.serviceModel> 
</configuration> 

그리고이 설정은 작업 맵핑에 있습니다.

ViewOp/Select/dbo/CRM_CUST -

답변

1

그래서 뷰의 이름; 보기 작업에서 선택을 포기하고 단순해야하며 어댑터의 특정 부분에 대한 코드에 문제가 있다고 의심하여 ​​"트릭"을 시도하기로 결정했습니다.

는 단순히 VIEW에서 선택 *을 수행하는 프로 시저를 생성 WHERE 파람 제가

그 다음을 사용 ViewOp 기준에 합격 한 AccountNum이다 ID = @Param (동일 도면 이전 문제가 발생 하였다) 어댑터 마법사를 사용하여 ViewOp 대신 TypeStoredProcedure 작업을위한 스키마를 생성합니다. 지도를 변경하여이 새 메시지를 생성했습니다. Redploy presto ... 이제 두 가지 환경을 아무런 오류없이 원활하게 전환 할 수 있습니다!

이것은 SQL 어댑터의 ViewOp 부분에 문제가 있음을 분명히 말합니다. 어댑터에 대한 문제 이외의 다른 문제가 발생하는 이유는 다른 아이디어 나 설명이 있습니까?

대부분의 사람들은 뷰를 사용하지 말고 저장 프로 시저로 이동한다고 말합니다.하지만 뷰를 사용하는 이유는 매우 있습니다. 우리는 Microsoft Dynamics AX 데이터베이스를 선택합니다. AX는 외부 시스템이 사용할 수 있도록 이러한 뷰를 게시합니다. AX 스키마에 대해 저장 프로 시저를 만드는 것은 데이터베이스를 변경할 때 Microsoft에서 지원하지 않습니다. CRM에서 뷰를 사용하는 경우에도 저장 프로 시저를 자유롭게 만들 수는 없습니다.

그래서 지금 해결책을 찾았지만 지원되지 않습니다. 우리는이 문제가 해결 될 때까지 당분간 머물러야합니다.

1

나는 최근에 같은 문제를 만났습니다. 하루를 보낸 후 마침내 SQL 프로파일 러를 시작하고 원인을 발견했습니다. Ax2009 DB를 비롯한 일부 DB의 경우, biztalk에서 원하는 열 순서에 따라 열 순서가 달라집니다. 그것은 다음 코드를 실행하고 정확한 순서로 열을 원하는 ('*'당신을 위해 작동하지 않습니다) :

exec sp_executesql N'SELECT sp.type AS [ObjectType], modify_date AS [LastModified] FROM sys.all_objects AS sp WHERE ([email protected] and SCHEMA_NAME(sp.schema_id)[email protected]);SELECT clmns.name AS [Name], usrt.name AS [DataType], SCHEMA_NAME(usrt.schema_id) AS DataTypeSchemaName, usrt.is_assembly_type AS [IsAssemblyType], clmns.is_identity AS [IsIdentity], ISNULL(baset.name, N'''') AS [SystemType], CAST(CASE WHEN baset.name IN (N''nchar'', N''nvarchar'') AND clmns.max_length <> -1 THEN clmns.max_length/2 ELSE clmns.max_length END AS int) AS [Length], CAST(clmns.[precision] AS int) AS [NumericPrecision], CAST(clmns.[scale] AS int) AS [NumericScale], clmns.is_nullable as [IsNullable], clmns.is_computed as [IsComputed], 0 as [IsFileStream], AT.assembly_qualified_name AS AssemblyQualifiedName, defCst.definition AS [DefaultValue] FROM sys.columns as clmns LEFT OUTER JOIN sys.default_constraints defCst on defCst.parent_object_id = clmns.object_id and defCst.parent_column_id = clmns.column_id LEFT OUTER JOIN sys.types AS usrt ON usrt.user_type_id = clmns.user_type_id LEFT OUTER JOIN sys.types AS baset ON baset.user_type_id = clmns.system_type_id and baset.user_type_id = baset.system_type_id LEFT JOIN sys.assembly_types AT ON AT.[name] = usrt.name AND AT.schema_id = usrt.schema_id WHERE clmns.object_id = (SELECT object_id FROM sys.objects o WHERE [email protected] and SCHEMA_NAME(o.schema_id)[email protected])',N'@ORIGINALOBJECTNAME nvarchar(13),@ORIGINALSCHEMANAME nvarchar(3)',@ORIGINALOBJECTNAME=N'CRM_CFU',@ORIGINALSCHEMANAME=N'dbo' 

그냥보기 이름으로 @ORIGINALOBJECTNAME 값을 교체하고 당신의 seect에 열을 넣어 정확한 순서.

+0

nice! 그 드미트리 주셔서 감사합니다! – ryancrawcour

+0

@ryancrawcour :이 질문에 대한 답변을 수락하면 대답으로 표시해야합니다. –