Biztalk: How to pass filename within msgbody into stored procedure by WCF-Custom port

StackOverflow https://stackoverflow.com/questions/19715706

  •  02-07-2022
  •  | 
  •  

質問

I have BizTalk application with FILE incoming port and WCFCustom sending port.

WCFCustom sending port is calling stored procedure and passing message body as xml parameter to this stored procedure by specifying Template property like on screenshot below.

Body of the message is specified by the bts-msg-body tag.

Questions:

1.Is there any way to pass file name into stored procedure as additional parameter ?

2.Is thre way to send multiple parameters into stored procedure ?

enter image description here

役に立ちましたか?

解決

The answer to 2, is it possible to send multiple parameters into the stored procedure. Yes it is

<ns0:StoredProc xmlns:ns0="http://schemas.microsoft.com/Sql/2008/05/Procedures/dbo">
<ns0:document>
<bts-msg-body xmlns="http://www.microsoft.com/schemas/bts2007" encoding="base64"/>
</ns0:document>
<ns0:documentname>
Test
</ns0:documentname>
</ns0:StoredProc>

How to populate the documentname from the message context property, that is the bit I can't figure out. Maybe someone else can come up with a suggestion for that.

他のヒント

  1. Yes, with a promoted property.
  2. Yes, as per Dijkgraaf's answer.

The way I would do this is:

  • Use the "Consume Adapter Service" BizTalk Project Add-in to generate a schema for your stored procedure that can have elements for multiple parameters (examples here) or create one by hand if you like.
  • Edit the schema to specify the element to contain your file name is promoted as "http://schemas.microsoft.com/BizTalk/2003/file-properties#ReceivedFileName". This will cause the XML Assembler to copy this value from the message context into the field.
  • Create a map to copy incoming message into message body element as CDATA. Add this map on your send port.
  • Use the XMLTransmit pipeline to populate the file name field from the message context

If your file is not XML you will probably need a custom pipeline component instead of a standard map (I would use the FixMsg example from the SDK).

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top