Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

convert XML into another web service's XML structure

Status
Not open for further replies.

atlzbest

IS-IT--Management
Sep 25, 2009
2
US
HI ALL !

I’ve got 2 webservices which need to transfer data.

First web service sends back a query result in well formed XML
<ROOT>
<Customer>
<ID>
….
</ID>
</Customer>
</ROOT>

The second web service is a problem. All the methods exposed expect a input/output in this format, yea I know it’s a very poor job by the tool but that’s how they expect it.

<ROOT>
<XML> (XML) </XML>
</ROOT>

Where (XML) is any XML you wish to pass to this method. This (XML) will contain the well formed structure they are expecting entities/values in, like

<Customer><ID> id </ID> </Customer>

it sounds pretty simple to just add the container xml around this, but its very time consuming in CastIron, its much easier if the WSDL or description is schema aware and tells the client all the schema objects that are available, like Customer.

I am thinking of these options

1. Instead of using second web services’ given WSDL, Generate a WSDL from the first web service’s XML output (not sure if there exists a visual tool like this). This way I will have a nice, clean structured WSDL. The tool I am using, Cast Iron, will see all the XML entities separately and I can just drag n drop elements (right now it just shows an XML entity and I cant attach my source entities to it directly without doing concatenations and converting it into one giant XML string.
2. Find a visual tool that can generate an XSLT based on my inputs/outputs so I can simply attach it after my source XML so I get a XML doc formatted based on the second web svc’s requirement.
3. Any better way to transform source to destination?

Thanks!
 
This is how it can be done, if (XML) you meant by it being an xml fragment under ROOT in the input xml document.
[tt]
<xsl:template match="/">
<ROOT>
<XML><xsl:copy-of select="ROOT/*" /></XML>
</ROOT>
</xsl:template>
[/tt]
ps: Naming a tag XML or any case variation is not recommended, you can but not very forward-looking.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top