none
XML Doc Conversion-BizTalk RRS feed

  • Question

  • I am right now working in a project where I got a wsdl schema which is a multi part message and I have two schemas , which is the source schema and destination schema (Not the wsdl schema) .Now I need to perform some mapping for the source and destination schema and then I need to convert that xml to string and then to a xml doc.The wsdl schema which I have got has only three fields and in one of that field I need to map the xml doc and send through a web service.Kindly help me out with converting my xml to xml doc for a multi part message.

    ashwin

    Wednesday, July 29, 2015 2:33 PM

Answers

  • As Morten mention you can do it within a map, one simple way is using inline XSLT  and simple c# method(script functoid).

    In the second map between the <applicant> to <checkapplicants>

     Try this: 

    Drop two script functoids

    Script functoid 1: this does not need any mapping as this will be used in the second functoid

    public static string NodeToString(XPathNodeIterator nodes)
    {
            nodes.MoveNext();
    return nodes.Current.OuterXml;
    }


    Script functoid 2: 

    <xsl:element name="arg2" namespace="http://webservice.sentinel.truthtechnologies.com/">
      <xsl:value-of select="userCSharp:NodeToString(/*[local-name()='applicant'])" />
    </xsl:element>

    Link the second functoid to "arg2"

    Regards

    K


    • Edited by Koushik984 Thursday, July 30, 2015 7:15 AM
    • Marked as answer by sukra1234 Thursday, July 30, 2015 3:03 PM
    Thursday, July 30, 2015 7:14 AM

All replies

  • It sounds like this could be accomplished using a BizTalk Map. Can you post an example of the input XML you receive and the desired output.

    Not sure I understand why you need to convert the input to a string and then to a xml doc?

    Morten la Cour

    Wednesday, July 29, 2015 4:10 PM
  • that's actually the requirement , the wsdl schema has three fields , one field is for the username , 2nd for password , 3rd for xml file as a xml doc.Now I need to convert the message which I have mapped to a xml doc so that I can assign that to the Field 3 of wsdl schema.

    ashwin

    Wednesday, July 29, 2015 4:30 PM
  • Input schema :

    <LanguageId>en-us</LanguageId><Name>BERMUDA DIGITAL COMMUNICATIONS</Name><NameAlias>BERMUDA DIGITAL COMM</NameAlias><PartyNumber>001501737</PartyNumber><PrimaryAddressLocation>41000008751</PrimaryAddressLocation><PrimaryContactEmail>5637190328</PrimaryContactEmail><PrimaryContactFax>5637190330</PrimaryContactFax><PrimaryContactPhone>5637190327</PrimaryContactPhone><RecId>5637191076</RecId><RecVersion>244850890</RecVersion>-<DirPartyPostalAddressView class="entity"><Address>5 Reid Street Kitson Building, 2nd Floor HAMILTON,HM 11 BMU</Address><City>HAMILTON</City><CountryRegionId>BMU</CountryRegionId><IsLocationOwner>Yes</IsLocationOwner><ISOcode>BM</ISOcode><IsPrimary>Yes</IsPrimary><IsPrivate>No</IsPrivate><Location>5637212076</Location><LocationName>BERMUDA DIGITAL COMMUNICATIONS-1330BDCBER1000-11</LocationName><Party>001501737</Party><PartyLocation>5637191076</PartyLocation><PostalAddress>5637203076</PostalAddress><RecId>5637191076</RecId><Roles>Invoice</Roles><Street>5 Reid Street Kitson Building, 2nd Floor</Street><TimeZone xsi:nil="true"/><ValidFrom>2015-04-25T22:44:12Z</ValidFrom><ValidTo>2154-12-31T23:59:59Z</ValidTo><ZipCode>HM 11</ZipCode></DirPartyPostalAddressView>-<DirPartyPostalAddressView class="entity"><Address>5 Reid Street Kitson Building, 2nd Floor HAMILTON,HM 11 BMU</Address><City>HAMILTON</City><CountryRegionId>BMU</CountryRegionId><IsLocationOwner>Yes</IsLocationOwner><ISOcode>BM</ISOcode><IsPrimary>No</IsPrimary><IsPrivate>No</IsPrivate><Location>5637212078</Location><LocationName>BERMUDA DIGITAL COMMUNICATIONS</LocationName><Party>001501737</Party><PartyLocation>5637191077</PartyLocation><PostalAddress>5637203077</PostalAddress><RecId>5637191077</RecId><Roles>Delivery</Roles><Street>5 Reid Street Kitson Building, 2nd Floor</Street><TimeZone xsi:nil="true"/><ValidFrom>2015-04-25T22:44:12Z</ValidFrom><ValidTo>2154-12-31T23:59:59Z</ValidTo><ZipCode>HM 11</ZipCode>

    After mapping :

    -<applicant><name last_name="BLACKBERRY"/>+<address>-<address><address_line1>295 PHILLIP STREET WATERLOO,ONN2L 3W8 CAN</address_line1><city>WATERLOO</city><state>ON</state><postal_code>N2L 3W8</postal_code><country country_code="CAN"/></address><phone/><account_number>31000000843</account_number>

    Output needed :

    <ns2:checkapplicants xmlns:ns2="http://webservice.sentinel.truthtechnologies.com/"><arg0>USERNAME</arg0>      <arg1>PASSWORD</arg1>      <arg2><?xml version="1.0" encoding="UTF-8"?> <batch_process xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:noNamespaceSchemaLocation="applicantBatch.xsd"> <userName>USERNAME</userName> <applicant> <name first_name="JOHN" middle_name="" last_name="DOE"/> <company_data> <company_name></company_name> <address> <address_line1></address_line1> <city></city> <state></state> <postal_code></postal_code> <country country_code=""/> </address> </company_data> <account_number>ACCOUNT123</account_number> </applicant> <applicant> <name first_name="JANE" middle_name="" last_name="DOE"/> <company_data> <company_name></company_name> <address> <address_line1></address_line1> <city></city> <state></state> <postal_code></postal_code> <country country_code=""/> </address> </company_data> <account_number>ACCOUNT456</account_number> </applicant> <applicant> <name first_name="?" middle_name="" last_name="?"/> <company_data> <company_name></company_name> <address> <address_line1></address_line1> <city></city> <state></state> <postal_code></postal_code> <country country_code=""/> </address> </company_data> <account_number>ACCOUNT456</account_number> </applicant> </batch_process>            </arg2>           </ns2:checkapplicants>                  


    ashwin

    Wednesday, July 29, 2015 4:32 PM
  • As Morten mention you can do it within a map, one simple way is using inline XSLT  and simple c# method(script functoid).

    In the second map between the <applicant> to <checkapplicants>

     Try this: 

    Drop two script functoids

    Script functoid 1: this does not need any mapping as this will be used in the second functoid

    public static string NodeToString(XPathNodeIterator nodes)
    {
            nodes.MoveNext();
    return nodes.Current.OuterXml;
    }


    Script functoid 2: 

    <xsl:element name="arg2" namespace="http://webservice.sentinel.truthtechnologies.com/">
      <xsl:value-of select="userCSharp:NodeToString(/*[local-name()='applicant'])" />
    </xsl:element>

    Link the second functoid to "arg2"

    Regards

    K


    • Edited by Koushik984 Thursday, July 30, 2015 7:15 AM
    • Marked as answer by sukra1234 Thursday, July 30, 2015 3:03 PM
    Thursday, July 30, 2015 7:14 AM