BizTalk Server Orchestration - Web services w/in Orch - combine two outputs.

This is Interesting: Free IT Magazines  
Home > Archive > BizTalk Server Orchestration > March 2006 > Web services w/in Orch - combine two outputs.





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Web services w/in Orch - combine two outputs.
Art

2006-03-07, 5:51 pm

Here is the situation:
There are two web services I need to use from an orchestration, A and B, and
then expose this orchestration as a web service (for use by external apps).
Web service A returns what we want BUT before it can be used, data from B
needs to be appended to it. "A" has a field where return data from "B" needs
to be appended. Essentially A.value = B.
So far I:
- have created message of type A and passed it to A web service,
- have created message of type B and passed it to B web service,

I now have A and B, I inserted new Construct Message shape but how do I
insert B into A such that A.value = B?
Greg Forsythe

2006-03-07, 8:47 pm

There are a number of ways to do this:

In a message assignment shape
You can use System.Xml.XmlDocument variables.
xmlDocA = A;
xmlDocB = B;
the use SelectNode and Append methods to add B to A
msgC = xmlDocA;

You can use a transform shape to map two docs into one, add A and B as
source documents and C as destination

You can use properties and distinguished fields to move data into A - this
requires the Xml nodes already exist in the message which may not be the
case.

Can you show us example messages for A and B and C

Greg

"Art" <Art@discussions.microsoft.com> wrote in message
news:3DC12E70-4FF6-4C63-A5AA-0738E477206A@microsoft.com...
> Here is the situation:
> There are two web services I need to use from an orchestration, A and B,
> and
> then expose this orchestration as a web service (for use by external
> apps).
> Web service A returns what we want BUT before it can be used, data from B
> needs to be appended to it. "A" has a field where return data from "B"
> needs
> to be appended. Essentially A.value = B.
> So far I:
> - have created message of type A and passed it to A web service,
> - have created message of type B and passed it to B web service,
>
> I now have A and B, I inserted new Construct Message shape but how do I
> insert B into A such that A.value = B?



Art

2006-03-08, 2:48 am

These are the steps I have taken so far:
- added WS references to my BTS project, both WS open up nicely (in Ports
Surface area of the designer) exposing all the methods available.
- WS A exposes [among others] GetCustomer(ID) and returns Customer structure,
- WS B exposes GetOrders(ID) and returns List (.NET type) of Orders
- as a first step I create a message (via Create Message shape) and then set
A.ID = "1234" (via Expression Editor),
- then I call A (request/response),
- I create message of type B and set B.ID = "1234",
- then I call B (request/response),
- when both WSs return their types, I should have two messages, A and B,
with populated values,
- "A" has a property, of type List, called OrderDetails and now I would like
to merge B, which is that list ,and "marry" it to A.OrderDetails.
- so as the last step I have created another (third) message (via Create
Message shape) of type A (that's ultimately what the orchestration will
return when called, as a WS, from an application). Message of type A already
has appropriate storage defined to accept Bs return type. I just don't know
how to marry the two.

I hope that this is making sense and I'm doing this in the right order.

I'd be happy to provide message samples but I'm not quite sure what is that
you'd like to see. I have XSD schemas of types which A and B (they where
automatically created when I referenced these two WSs in my BTS project) and
there is whole bunch of message parts automatically created at the same time.

"Greg Forsythe" wrote:

> There are a number of ways to do this:
>
> In a message assignment shape
> You can use System.Xml.XmlDocument variables.
> xmlDocA = A;
> xmlDocB = B;
> the use SelectNode and Append methods to add B to A
> msgC = xmlDocA;
>
> You can use a transform shape to map two docs into one, add A and B as
> source documents and C as destination
>
> You can use properties and distinguished fields to move data into A - this
> requires the Xml nodes already exist in the message which may not be the
> case.
>
> Can you show us example messages for A and B and C
>
> Greg
>
> "Art" <Art@discussions.microsoft.com> wrote in message
> news:3DC12E70-4FF6-4C63-A5AA-0738E477206A@microsoft.com...
>
>
>

Greg Forsythe

2006-03-08, 2:48 am

With a Web Service you have two messages a request and response.
You need to declare these orchestration messages:
A_request = GetCustomer Web Service request message type
A_response= GetCustomer Web Service response message type
B_request = GetOrdersWeb Service request message type
B_response= GetOrdersWeb Service response message type
outputMessage = GetCustomer Web Service response message type

In a construct message shape construct A_request and set ID as you have done
A_request.ID = "1234"
You can do this because the A-request message is a simple type and has no
schema.

Send A_request
Receive A_response

repeat for B.

After receiving the B_response message add a construct message shape for
outputMessage.
Add a Transform shape.
Select New Map and give it a name
Add both A_response and B_response to the Source
Add outputMessage to the Destination

When you click OK a new map is created and opened.
The source schema is a concatenation of the two input schemas defined
Complete the map as appropriate.

You should now have an outputMessage with merged data.

hope this helps
Greg

"Art" <Art@discussions.microsoft.com> wrote in message
news:57ED8BC0-3418-4021-95EE-EB3629EED554@microsoft.com...[vbcol=seagreen]
> These are the steps I have taken so far:
> - added WS references to my BTS project, both WS open up nicely (in Ports
> Surface area of the designer) exposing all the methods available.
> - WS A exposes [among others] GetCustomer(ID) and returns Customer
> structure,
> - WS B exposes GetOrders(ID) and returns List (.NET type) of Orders
> - as a first step I create a message (via Create Message shape) and then
> set
> A.ID = "1234" (via Expression Editor),
> - then I call A (request/response),
> - I create message of type B and set B.ID = "1234",
> - then I call B (request/response),
> - when both WSs return their types, I should have two messages, A and B,
> with populated values,
> - "A" has a property, of type List, called OrderDetails and now I would
> like
> to merge B, which is that list ,and "marry" it to A.OrderDetails.
> - so as the last step I have created another (third) message (via Create
> Message shape) of type A (that's ultimately what the orchestration will
> return when called, as a WS, from an application). Message of type A
> already
> has appropriate storage defined to accept Bs return type. I just don't
> know
> how to marry the two.
>
> I hope that this is making sense and I'm doing this in the right order.
>
> I'd be happy to provide message samples but I'm not quite sure what is
> that
> you'd like to see. I have XSD schemas of types which A and B (they where
> automatically created when I referenced these two WSs in my BTS project)
> and
> there is whole bunch of message parts automatically created at the same
> time.
>
> "Greg Forsythe" wrote:
>


Art

2006-03-08, 5:53 pm

Greg,
Thanks for your help, I've set it up just the way you described but in my
case mapping doesn't seem to be working as well as I had hoped for. I get
errors telling me that "OrderDetails" has already been declared, which makes
sense since both WSs schemas define OrderDetails. WS A schema defines
OrderDetails as A.OrderDetails of <someType> and WS B schema also defines
OrderDetails as of <someType>. When I include both schemas in the source and
then try to map to destination I can do it freely but I get errors during
compilation.

What I'm going to try to do now is to copy XML nodes from B into A
programmatically. Perhaps I'll be more successful. Thanks for your help!
Art

2006-03-09, 5:52 pm

Greg,
Another idea I had, which may work. Since I can not map (in my case) from
two different sources into one (like I mentioned in my previous post, both of
my source schemas define the same element, I had a conflinct and my
orchestration would not compile) I was thinking it would be possible to break
this process up and do it one at a time. So,
- A_response arrives from WS "A",
- I map this to the output message* via Construct Message->Transform etc...
- B_response arrives from WS "B"
- I map this to the output message via Construc Message->Transform etc...

The only thing I'd have to make sure of is that I work with the same
instance of the output message in steps 2 and 4. Hence my question; how do I
make sure I work w/ the same instance?? I'm affraid that Construct
Message->Transform actions in steps 2 and 4 would instantiate two separate
output messages and that would be not what I want since the outputs from WS
"A" and "B" would still be divided but now between two instances of output
message.

"Greg Forsythe" wrote:

> With a Web Service you have two messages a request and response.
> You need to declare these orchestration messages:
> A_request = GetCustomer Web Service request message type
> A_response= GetCustomer Web Service response message type
> B_request = GetOrdersWeb Service request message type
> B_response= GetOrdersWeb Service response message type
> outputMessage = GetCustomer Web Service response message type
>
> In a construct message shape construct A_request and set ID as you have done
> A_request.ID = "1234"
> You can do this because the A-request message is a simple type and has no
> schema.
>
> Send A_request
> Receive A_response
>
> repeat for B.
>
> After receiving the B_response message add a construct message shape for
> outputMessage.
> Add a Transform shape.
> Select New Map and give it a name
> Add both A_response and B_response to the Source
> Add outputMessage to the Destination
>
> When you click OK a new map is created and opened.
> The source schema is a concatenation of the two input schemas defined
> Complete the map as appropriate.
>
> You should now have an outputMessage with merged data.
>
> hope this helps
> Greg
>
> "Art" <Art@discussions.microsoft.com> wrote in message
> news:57ED8BC0-3418-4021-95EE-EB3629EED554@microsoft.com...
>
>
>

Greg Forsythe

2006-03-09, 5:52 pm

Art,
Each Transform shape will create a new message, so if you use the same
message instance then it will be overwritten in the sceond transform.
Are you able to post your schemas, I can try to create a map.

Greg


"Art" <Art@discussions.microsoft.com> wrote in message
news:546507E8-87CF-40D5-95AF-C7C1C1EE6C52@microsoft.com...[vbcol=seagreen]
> Greg,
> Another idea I had, which may work. Since I can not map (in my case) from
> two different sources into one (like I mentioned in my previous post, both
> of
> my source schemas define the same element, I had a conflinct and my
> orchestration would not compile) I was thinking it would be possible to
> break
> this process up and do it one at a time. So,
> - A_response arrives from WS "A",
> - I map this to the output message* via Construct Message->Transform
> etc...
> - B_response arrives from WS "B"
> - I map this to the output message via Construc Message->Transform etc...
>
> The only thing I'd have to make sure of is that I work with the same
> instance of the output message in steps 2 and 4. Hence my question; how do
> I
> make sure I work w/ the same instance?? I'm affraid that Construct
> Message->Transform actions in steps 2 and 4 would instantiate two separate
> output messages and that would be not what I want since the outputs from
> WS
> "A" and "B" would still be divided but now between two instances of output
> message.
>
> "Greg Forsythe" wrote:
>


Art

2006-03-09, 5:52 pm

Greg,
I sent the schemas to your email address.

"Greg Forsythe" wrote:

> Art,
> Each Transform shape will create a new message, so if you use the same
> message instance then it will be overwritten in the sceond transform.
> Are you able to post your schemas, I can try to create a map.
>
> Greg
>
>
> "Art" <Art@discussions.microsoft.com> wrote in message
> news:546507E8-87CF-40D5-95AF-C7C1C1EE6C52@microsoft.com...
>
>
>

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com