none
ESB Add Namespace Pipeline Component

    Question

  • Within our BizTalk solution we will be receiving documents with no namespace declaration: -

     <Order>

                    <OrderNo></OrderNumber>

                    <DateReceived></DateReceived>

                   

    </Order>

     

    To process this document our solution needs to add the namespace into the document: -

     

    <Order xmlns=”somenamespace”>

                    <OrderNo></OrderNumber>

                    <DateReceived></DateReceived>

                   

    </Order>

     

    I believe the ESB Toolkit provides a pipeline for performing such tasks. However, how do you configure it to perform the above? The example provided as part of the ESB solution bears no resemblance to a real world scenario. I have almost given up and I am tempted to write our own component. Hopefully someone out there can show me how to perform the above.

     

    Fingers crossed…

    Wednesday, January 06, 2010 10:25 PM

Answers

  • Could you paste the error here?

    You can actually open the assembly Microsoft.Practices.ESB.Namespace.PipelineComponents in Reflector to see the source code. You could search the source code for the exception name to find out where it throws it to determine the problem.

    Thanks,

    If this answers your question, please use the "Answer" button to say so | Ben Cline
    Monday, January 11, 2010 9:54 PM
    Moderator
  • Hi Ben Thanks, your feedback was invaluable. It turns out the configuration should be: - ExtractionNodeXPath:= /<our root element> NamespaceBase:= <our namespace> Works a treat....
    • Marked as answer by BizChatter Thursday, January 14, 2010 5:35 PM
    Thursday, January 14, 2010 5:34 PM

All replies

  • Hey, you just need to create a custom receive pipeline and then add the ESB add namespace component to the pipeline. In the port properties go the properties of the pipeline where it shows the ESB add namespace component and add your namespace base (http://www.mycompany.com, etc), namespace prefix, and the XPath of the element you want to add the namespace to.

    I am using the remove namespace component on one of my client's integrations and it works pretty well. You can use the ESB components w/o installing all of the ESB toolkit - you just need to copy the dependencies of the component to the BizTalk pipeline component folder and deploy them to the GAC.

    Thanks,
    If this answers your question, please use the "Answer" button to say so | Ben Cline
    Friday, January 08, 2010 3:32 PM
    Moderator
  • Hi Ben Thanks for the reply. I have already created a custom pipeline. My problem is that I cannot set the necessary properties on the Add Namespace Pipeline component to add a simple namespace declaration into the root element i.e. <Order xmlns"mynamespace"> ... ... </Order> I have set the namespacebase property to "urn:com.vanprov1" however I am unsure what other properties to set. I don't think i need to set the xpath. Perhaps you can help... Anthony
    Friday, January 08, 2010 4:10 PM
  • Ok that makes sense now that the example is confusing because it is based on a http:// namespace rather than the urn syntax.

    Here is the article that explains the valid values for the Add Namespace pipeline component properties: http://msdn.microsoft.com/en-us/library/cc789137.aspx

    I think for the urn you may need to change the separator to an empty string rather than a slash (/).

    The namespace prefix is used in the xmlns line. So if you had more than one namespace in the Xml document you might choose a different prefix. I think you could just leave it blank or use one like ord0 or ns10, etc. Funny, ns10 is the next "not reserved" namespace recommended by the article.

    Thanks,


    If this answers your question, please use the "Answer" button to say so | Ben Cline
    Friday, January 08, 2010 7:00 PM
    Moderator
  • Hi Ben For the scenario I am looking for I would expect to specify extractnodepath [/BatchOrders] my root element and namespacebase [urn:com.vancpsv1] the target namespace we use. However when i provide these parameters within the pipeline configuration I get an error indicatin end element not supplied - bizare... I think writting our own pipeline component is the course of least resistance and less headaches. Although saying that I would love to know if this component actually works. If I had the source code at least i could step into it and try to work out what the &^^% it is supposed to do. Never mind, glad to see someone is having some success with it.....
    Monday, January 11, 2010 3:20 PM
  • Could you paste the error here?

    You can actually open the assembly Microsoft.Practices.ESB.Namespace.PipelineComponents in Reflector to see the source code. You could search the source code for the exception name to find out where it throws it to determine the problem.

    Thanks,

    If this answers your question, please use the "Answer" button to say so | Ben Cline
    Monday, January 11, 2010 9:54 PM
    Moderator
  • Hi Ben Thanks, your feedback was invaluable. It turns out the configuration should be: - ExtractionNodeXPath:= /<our root element> NamespaceBase:= <our namespace> Works a treat....
    • Marked as answer by BizChatter Thursday, January 14, 2010 5:35 PM
    Thursday, January 14, 2010 5:34 PM
  • Awesome! Glad it is working for you now!

    Thanks,
    If this answers your question, please use the "Answer" button to say so | Ben Cline
    Thursday, January 14, 2010 11:19 PM
    Moderator