| Author |
How to access message as XML text
|
|
| killbill 2006-03-21, 3:09 am |
| Hi All,
I am unable to figure it out how to do this:
I want to receive an xml file in my orchestration and pass it to a .NET
component where i want to open that message as text and delete some
text. After that i want to compose that message again and return it
back to orchestration.
Any suggestion ???
| |
|
|
You should set up a variable in your orchestration as either a string or
xml document depending on what your DLL is expecting.
Set your new variableA = to your XLANG message.
Reference your DLL, call it in an expression shape, you may need another
variable here for the result, anyway, pass in your variableA. You may need
to do this in an atomic scope if its not a static method call, in which case
you'd also need to make a variable for the class you are referencing in the
DLL.
Take the result and set it to an XLANG message again, from there you can
deliver, or whatever is next in your process.
BA
http://biztalkia.blogspot.com/
> Hi All,
>
> I am unable to figure it out how to do this:
> I want to receive an xml file in my orchestration and pass it to a
> .NET
> component where i want to open that message as text and delete some
> text. After that i want to compose that message again and return it
> back to orchestration.
> Any suggestion ???
>
| |
| Tomas Restrepo \(MVP\) 2006-03-21, 3:09 am |
| > I am unable to figure it out how to do this:
> I want to receive an xml file in my orchestration and pass it to a .NET
> component where i want to open that message as text and delete some
> text.
Your .NET component just has to take an XmlDocument instance as an argument;
BizTalk will do the conversion for you. or, if you prefer more control (such
as getting a Stream or an XmlReader instead), you can have it take an
XLANGPart as an argument and then use the RetrieveAs() method.
> After that i want to compose that message again and return it
> back to orchestration.
Again, just have it return an XmlDocument instance, and then assign it to a
new message on the orchestration (inside the appropriate MessageContruct /
Message Assignment shapes)
--
Tomas Restrepo
tomasr@mvps.org
http://www.winterdom.com/
| |
| killbill 2006-03-21, 5:54 pm |
| Thanks for response. I want to do very simple thing but this solution
seems complex for that. Actually, i want to remove 'ns0' from my
message before sending it on send port. Cant i access XML text in
message as string so i could replace "ns0" with "". Or any other idea
???
Tomas Restrepo (MVP) wrote:
>
> Your .NET component just has to take an XmlDocument instance as an argument;
> BizTalk will do the conversion for you. or, if you prefer more control (such
> as getting a Stream or an XmlReader instead), you can have it take an
> XLANGPart as an argument and then use the RetrieveAs() method.
>
>
> Again, just have it return an XmlDocument instance, and then assign it to a
> new message on the orchestration (inside the appropriate MessageContruct /
> Message Assignment shapes)
>
>
> --
> Tomas Restrepo
> tomasr@mvps.org
> http://www.winterdom.com/
| |
| Greg Forsythe 2006-03-21, 5:54 pm |
| I wouldn't recommend using string manipulation to change an Xml message.
If you want to remove a namespace prefix, the method I use is a custom Xslt
in a map.
Create and test the map as normal, validate the map and save the resultant
Xslt to a file.
Edit the Xslt to remove the result namespace prefix and assign the Xslt file
to the Custom Xslt property on the map.
Greg
"killbill" <indus.vision@gmail.com> wrote in message
news:1142958848.822150.186910@i39g2000cwa.googlegroups.com...
> Thanks for response. I want to do very simple thing but this solution
> seems complex for that. Actually, i want to remove 'ns0' from my
> message before sending it on send port. Cant i access XML text in
> message as string so i could replace "ns0" with "". Or any other idea
> ???
>
>
> Tomas Restrepo (MVP) wrote:
>
| |
| Tomas Restrepo \(MVP\) 2006-03-21, 5:54 pm |
|
> Thanks for response. I want to do very simple thing but this solution
> seems complex for that. Actually, i want to remove 'ns0' from my
> message before sending it on send port. Cant i access XML text in
> message as string so i could replace "ns0" with "". Or any other idea
> ???
I agree with Greg here, using a map is a much safer and maintanable way of
doing it.
--
Tomas Restrepo
tomasr@mvps.org
http://www.winterdom.com/
| |
| killbill 2006-03-25, 11:37 am |
| I am facing the following error 30 times when i run "Test Map" command.
ERROR:
Output validation error: The element 'Task' in namespace
'http://myNameSpace/myType.xsd' has invalid child element 'Order' in
namespace 'http://myNameSpace/myType.xsd'. List of possible elements
expected: 'TaskType' in namespace 'http://myNameSpace/myType.xsd'.
Cannot figure it out, any suggestion ???
killbill wrote:[vbcol=seagreen]
> thanks... i made some changes in XSLT and it worked for me but message
> cannot be validated on send port. Message does not match the definded
> type at send port.
>
>
> Tomas Restrepo (MVP) wrote:
| |
| Greg Forsythe 2006-03-25, 11:37 am |
| If you have changed the Xslt to remove the namespace then the Xml will no
longer be valid against the schema.
The Test Map validates both the input and output Xml against their
respective schema. This is not done at runtime by the Transform.
For testing purposes you can turn off Validate Ouput. Right click on map
file -> Properties.
Otherwise you need to define a Xml schema without a namespace to validate
against.
Greg
"killbill" <indus.vision@gmail.com> wrote in message
news:1143126198.048215.106350@t31g2000cwb.googlegroups.com...
>I am facing the following error 30 times when i run "Test Map" command.
>
> ERROR:
> Output validation error: The element 'Task' in namespace
> 'http://myNameSpace/myType.xsd' has invalid child element 'Order' in
> namespace 'http://myNameSpace/myType.xsd'. List of possible elements
> expected: 'TaskType' in namespace 'http://myNameSpace/myType.xsd'.
>
> Cannot figure it out, any suggestion ???
>
> killbill wrote:
>
|
|
|
|