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
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>
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 23 hours 48 minutes ago
- Marked as answer by Ashwanth14 16 hours 1 minutes ago
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 Ashwanth14 Thursday, July 30, 2015 3:03 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 Ashwanth14 Thursday, July 30, 2015 3:03 PM