locked
How to extract particular field from Source schema of any type RRS feed

  • Question

  • Hi,

    • I want to extract a praticular filed "orderID" from my source schema and want to map it with my destination schema.
    • My source schema is ANY type.
    • Because BODY record in source schema will consist OrderID.
    • How can I extract "OrderID" from source Schema.

    Thanks,

    John


    • Edited by John(Daniel) Tuesday, September 6, 2016 11:57 AM more info
    Tuesday, September 6, 2016 11:55 AM

Answers

  • Hi John,

    From scripting functoid, you need to link OrderId node.

    (Once try to make output, input validation to false - map property).

    specify sample input and test map.

    Sample here 

    <ns0:Root xmlns:ns0="http://MappingExternal.Schema2">
      <OrderId>123</OrderId>
    </ns0:Root>


    Thanks, SMSVikasK


    Wednesday, September 7, 2016 10:29 AM
    Answerer
  • Hi John,

    Thanks for the response !

    I have to used this because of certain business requirement.

    However I fullfilled my approach by adding <Any> element to Body record .

    And by adding <Any> element i was able to extract the particular from the Body since  it provides a way to keep/contain XML element which is not defined in the schema.  

    https://alamnaushad.wordpress.com/2012/02/25/biztalk-schema-to-use-any-element/

    • Marked as answer by John(Daniel) Thursday, September 8, 2016 9:39 AM
    Thursday, September 8, 2016 9:39 AM

All replies

  • Sorry, it's not really clear.  Why do you have to use the Any type?
    Tuesday, September 6, 2016 12:04 PM
    Moderator
  • Hi john,

    Its the requirement only that the source schema will be of Anytype only and we have to extract order ID from it.

    Thanks,

    John

    Tuesday, September 6, 2016 12:11 PM
  • Hi John,

    I use DanSharp XmlViewer in this kind of scenario.

    Download the tool from CodePlex https://dansharpxmlviewer.codeplex.com/

    Use your sample XML as a source (Map source), get the XPATH from the tool for OrderId.

    Use that XPath and then map using XSLT template then link to destination orderId field.

      <xsl:template name="OrderId">
        <OrderId>
          <xsl:value-of select="Xpath"/>
        </OrderId>
      </xsl:template>

    Thanks, SMSVikasK

    Tuesday, September 6, 2016 12:19 PM
    Answerer
  • Hi , For this u can use Xslt and do the mapping. Even if the body is Any type , u know the structure of the xml. Get the xpath of Orderid and map. If there is no good reason for this to be Any type why don't u create a structured schema instead..

    Pi_xel_xar

    Blog: My Blog

    BizTalkApplicationDeploymentTool: BizTalk Application Deployment Tool

    LinkedIn: LinkedIn

    Tuesday, September 6, 2016 12:24 PM
    Answerer
  • Its the requirement only that the source schema will be of Anytype only and we have to extract order ID from it.

    But why?  My first action would be to challenge that requirement.  Where does it come from?

    If you explain this 'requirement' we can probably help you address that with whoever is pushing this.

    Tuesday, September 6, 2016 12:59 PM
    Moderator
  • Hi,

    As Johns mentioned already first of all why are you using any type schema? If you want to stick with this any type then you have to used xpath expression in XSLT template in map since you know the format of request xml.

    Thanks


    JB

    Tuesday, September 6, 2016 9:21 PM
  • Hi Vikas,

    I tried the following steps:-

    • Created xpath for ORderID from source XML with dansharpxmlviewer tool.
    • And then I was using it in Script Functoid (inline xslt) which I was mapping with the destination orderId.
    • But after doing this when I am testing the map then the output is coming with namespace only.
    • It is not showing order ID field in the output.
    • Below is the xpath that was generated for orderID

    Wednesday, September 7, 2016 7:23 AM
  • Hi John,

    From scripting functoid, you need to link OrderId node.

    (Once try to make output, input validation to false - map property).

    specify sample input and test map.

    Sample here 

    <ns0:Root xmlns:ns0="http://MappingExternal.Schema2">
      <OrderId>123</OrderId>
    </ns0:Root>


    Thanks, SMSVikasK


    Wednesday, September 7, 2016 10:29 AM
    Answerer
  • Please answer why do you have to do this?

    If we can, let us help you solve the real problem, which is the untyped message.

    Wednesday, September 7, 2016 12:16 PM
    Moderator
  • Hi John,

    Thanks for the response !

    I have to used this because of certain business requirement.

    However I fullfilled my approach by adding <Any> element to Body record .

    And by adding <Any> element i was able to extract the particular from the Body since  it provides a way to keep/contain XML element which is not defined in the schema.  

    https://alamnaushad.wordpress.com/2012/02/25/biztalk-schema-to-use-any-element/

    • Marked as answer by John(Daniel) Thursday, September 8, 2016 9:39 AM
    Thursday, September 8, 2016 9:39 AM
  • What we're saying is that 'business requirement' is your problem.

    We can help you address that.

    Thursday, September 8, 2016 11:46 AM
    Moderator