Re: Custom pipeline component: subclassing the BizTalk Xml Assembler
From: Stan (skaethler_at_skulogix.com)
Date: 11/04/04
- Next message: Stan: "Funny characters at start of XML file"
- Previous message: Balaji Thiagarajan: "Re: Biztalk 2004 Single SQL Adapter for multiple inserts."
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 4 Nov 2021 17:07:10 -0500
I solved the problem:
1. instead of sub-classing the BizTalk XmlAssembler class, I wrote my own
pipeline component that takes the message stream, parses it, removes the
namespace & reads it back into the stream & then puts it back in the
message.
2. I placed my custom pipeline component in the Encode shape of the
pipeline. If I want to, I can use the XmlAssembler in the Assemble shape.
This is more effective than trying to sub-class the standard BizTalk class,
and it still lets me implement the functionality of both.
Thanks,
Stan
"Balaji Thiagarajan" <tbalaji_mcsd@hotmail.com.NOSPAM> wrote in message
news:#5C2X63uEHA.1448@TK2MSFTNGP10.phx.gbl...
> In the past, I tried with extension-element-prefixes,
> exclude-result-prefixes attributes, but I'm not sure if this would solve
> your issue. Take a look at it.
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/html/xmrefxsltransformelement.asp
>
> http://www.xm.co.nz/ShoXS/xslnamespace-alias.htm
>
> --
> Balaji Thiagarajan
> MCP (BizTalk)
> http://biztalkbits.blogspot.com
> --
>
>
> "Stan" <skaethler@skulogix.com> wrote in message
> news:Osjlww3uEHA.3456@TK2MSFTNGP14.phx.gbl...
> > Thanks for your help Balaji,
> >
> > But there's a few problems with this approach:
> > 1. It doesn't strip the namespace completely. When I use the map in my
> > send pipeline, it removes the "ns0:" prefix from the root node, but
every
> > child node now has "xmlns:ns1="http://namespace""" embedded as an
> attribute.
> > These attributes also cause errors for theVB6 xml DOM classes.
> >
> > 2. I want to avoid having to maintain 2 versions of the same schema
(one
> > with the namespace, one without).
> >
> > 3. I will run into BizTalk errors down the road when using schemas that
> > have the same Root node name and no Target Namespace -- BizTalk won't be
> > able to find a unique message schema in its database, since it requires
> > these 2 parameters to match messages. (Some of the schemas we use have
> the
> > same Root node name).
> >
> >
> > I think the best solution is to write my own custom pipeline component
> that
> > removes the namespaces from the final XML file output. I thought the
best
> > way to do this is to use the XML assembler class, but I think now this
is
> > the wrong approach too. -- I think I need to write a generic pipeline
> > component.
> >
> > Any ideas?
> >
> >
> > Thanks,
> > Stan
> >
> >
> > "Balaji Thiagarajan" <tbalaji_mcsd@hotmail.com.NOSPAM> wrote in message
> > news:e#cMEoFuEHA.3152@TK2MSFTNGP14.phx.gbl...
> > > To avoid namespace issue, you can create a separate similar schema and
> > clear
> > > the "Target Namespace" property in that <Schema>. Map your existing
> schema
> > > to this new schema and you are all set to get rid of this "Namespace"
> > issue.
> > > Let me know if this fixes your issue.
> > >
> > > --
> > > Balaji Thiagarajan
> > > MCP (BizTalk)
> > > http://biztalkbits.blogspot.com
> > > --
> > >
> > >
> > > "Stan" <skaethler@skulogix.com> wrote in message
> > > news:%239mAOZFuEHA.1356@TK2MSFTNGP11.phx.gbl...
> > > > Hi all,
> > > >
> > > > I have a requirement to output XML messages from a BizTalk
> orchestration
> > > > into a directory where a VB6 application reads in the XML.
> > > >
> > > > Main problem:
> > > > The problem is the VB6 XML parser gets confused by the namespace
> > prefixes
> > > > ("ns0:"...) and attributes ("xmlns:ns0=") in the XML being output by
> the
> > > > standard BizTalk XmlTRansmit pipeline. VB6 seems to treat the
> ns0:ROOT
> > as
> > > > the complete node name-- not as a seperate prefic & node name. As
far
> > as
> > > I
> > > > can tell, there's no way BizTalk can completely remove the namespace
> > from
> > > > the XML messages -- it always leaves a reference in the root node.
> > > >
> > > > Attempted solution:
> > > > I tried to build a custom pipeline component, which will remove the
> XML
> > > > namespace prefixes & attributes in the output stream (where I think
> > > BizTalk
> > > > no longer needs to resolve the namespaces). I created a new class
> that
> > > > inherits the Microsoft.BizTalk.Component.XmlAsmComp, and overrode
the
> > > > GetTranslatorStream() method. My method:
> > > > 1. Calls the base method to get the XmlTranslatorStream.
> > > > 2. Reads the stream into a string using a StreamReader.
> > > > 3. Parses the string to remove the XML prefixes & namespaces.
> > > > 4. Outputs the string to a Stream using an XMLTextWriter.
> > > > 5. Converts the Stream to an XmlTranslatorStream and returns.
> > > >
> > > > Everything seems to run fine in my method, but the pipeline still
> hangs
> > > > sometime afterward, and the exception thrown is "Specified Cast is
Not
> > > > Valid".
> > > >
> > > >
> > > > My new class uses the following attributes (if anyone has
> documentation
> > > > describing these, can you please let me know--I'm just guessing
> > blindly):
> > > > [ComponentCategory(CategoryTypes.CATID_PipelineComponent)]
> > > >
> > > > [ComponentCategory(CategoryTypes.CATID_AssemblingSerializer)]
> > > >
> > > > [ComponentCategory(CategoryTypes.CATID_Streamer)]
> > > >
> > > >
> > > >
> > > > Questions:
> > > > 1. What's wrong with my component? How can I successfully
sub-class
> > the
> > > > Xml Assembler (as the BizTalk SDK suggests is possible)?
> > > > 2.
> > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>
- Next message: Stan: "Funny characters at start of XML file"
- Previous message: Balaji Thiagarajan: "Re: Biztalk 2004 Single SQL Adapter for multiple inserts."
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|