Mombu the Microsoft Forum sponsored links

Go Back   Mombu the Microsoft Forum > Microsoft > Map individual XML Schema to Individual msg
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 29th July 05:01
atul
External User
 
Posts: 1
Default Map individual XML Schema to Individual msg


Hi ,

I've created a BizTalk Application which is having a receive port (with
SELECT * FROM CATEGORIES). It connects to Northwind database, categories
table. It returns me the xml as given below:
<Categories xmlns="http://Categories"><Categories CategoryID="1"
CategoryName="Beverages" Description="Soft drinks, coffees, teas, beers, and
ales" Picture="dbobject/Categories[@CategoryID='1']/@Picture" /><Categories
CategoryID="2" CategoryName="Condiments" Description="Sweet and savory
sauces, relishes, spreads, and seasonings"
Picture="dbobject/Categories[@CategoryID='2']/@Picture" /><Categories
CategoryID="3" CategoryName="Confections" Description="Desserts, candies,
and sweet breads" Picture="dbobject/Categories[@CategoryID='3']/@Picture"
/><Categories CategoryID="4" CategoryName="Dairy Products"
Description="Cheeses"
Picture="dbobject/Categories[@CategoryID='4']/@Picture" /><Categories
CategoryID="5" CategoryName="Grains/Cereals" Description="Breads, crackers,
pasta, and cereal" Picture="dbobject/Categories[@CategoryID='5']/@Picture"
/><Categories CategoryID="6" CategoryName="Meat/Poultry"
Description="Prepared meats"
Picture="dbobject/Categories[@CategoryID='6']/@Picture" /><Categories
CategoryID="7" CategoryName="Produce" Description="Dried fruit and bean
curd" Picture="dbobject/Categories[@CategoryID='7']/@Picture" /><Categories
CategoryID="8" CategoryName="Seafood" Description="Seaweed and fish"
Picture="dbobject/Categories[@CategoryID='8']/@Picture" /></Categories>

Then using Scope Block, I loop thru and get individual XML properly saved at
a particular location. The XML formal is:
<Categories CategoryID="1" CategoryName="Beverages" Description="Soft
drinks, coffees, teas, beers, and ales"
Picture="dbobject/Categories[@CategoryID='1']/@Picture"
xmlns="http://Categories" />

Now, my requirement is NOT to save this XML to specified location, rather I
want to access its individual node/attributes. I tried following options:
1. Promoted properties in the destination schema (envelop type) and set
appropriate BodyXPath property of the schema.
2. Tried to construct a new schema (promoted all its fields so that I can
access each) from this envelop schema and map the fields using Map file.

But none of these options are working. Any idea, how can I access individual
attributes?

Thanks a lot.
Atul
  Reply With Quote


  sponsored links


2 29th July 05:01
carlosqbˬ*h(~(
External User
 
Posts: 1
Default Map individual XML Schema to Individual msg


you can use xpath fuction to access each node/attribute in individual XML...
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sdk/htm/ebiz_prog_orch_doho.asp
  Reply With Quote
3 29th July 05:02
atul
External User
 
Posts: 1
Default Map individual XML Schema to Individual msg


Thanks!

I can access individual node/attribute using xpath function. But my
requirement is to assign these node/attribute value to another message
promoted fields. The business rules in the orchestration will execute based
on these field values.
Any idea how to assign node/attribute values to another message?
I was trying the following:
construct FieldMessage
{
//To access CategoryID of the third node.
OutputMessage.fld1 =
xpath(InputMessage,"/Category/Categories[2]/CategoryID')");
}

while compiling it is giving me following errors:
unexpected keyword: 'construct'
unexpected token: '}'
unexpected EOF

I have no clue how to solve this problem. Please help

Thanks
Atul
  Reply With Quote
4 29th July 05:02
carlosqbˬ*h(~(
External User
 
Posts: 1
Default Map individual XML Schema to Individual msg


hi..

yes, you can do it.... you can use a Message Assignment Shape as I show below:

// To assign the value to a promoted property
OutputMessage(BizTalk.Mapas.NilValue.Property1) =
xpath(InputMessage,"/Category/Categories[2]/CategoryID");

// To assign the value to a distinguished field
OutputMessage.fld1 = xpath(InputMessage,"/Category/Categories[2]/CategoryID");
  Reply With Quote
5 29th July 05:02
atul
External User
 
Posts: 1
Default Map individual XML Schema to Individual msg


Hi Carlos,

Thanks for the code. It worked.

Regards,
Atul
  Reply With Quote
Reply


Thread Tools
Display Modes




Copyright 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666