I´m working in a scenario with a proxy service that call a dataservice and send it this message:
<soap:Envelope xmlns:soap="http://ift.tt/18hkEkn" xmlns:add="http://ift.tt/1rsxmEZ">
<soap:Body>
<dat:getmpartybranch xmlns:dat="http://ift.tt/18X1brw">
<dat:clientid>473906852857651</dat:clientid>
</dat:getmpartybranch>
</soap:Body>
</soap:Envelope>
And recieve this response:
<soapenv:Envelope xmlns:soapenv="http://ift.tt/18hkEkn">
<soapenv:Header></soapenv:Header>
<soapenv:Body>
<DataCollection xmlns="http://ift.tt/18X1brw">
<Datalist>
<partybranchid>796243010946586</partybranchid>
<clientid>473906852857651</clientid>
</Datalist>
<Datalist>
<partybranchid>2500000000</partybranchid>
<clientid>473906852857651</clientid>
</Datalist>
</DataCollection>
</soapenv:Body>
</soapenv:Envelope>
The proxy iterate over each Datalist node, and with the values of clientid and partybranchid, it create another request a send to a another dataservice:
request1:
<soapenv:Envelope xmlns:soapenv="http://ift.tt/18hkEkn">
<soapenv:Body>
<dat:getselect_addresses xmlns:dat="http://ift.tt/18X1brw">
<dat:objectid>796243010946586</dat:objectid>
<dat:clientid>473906852857651</dat:clientid>
</dat:getselect_addresses>
</soapenv:Body>
</soapenv:Envelope>
request2:
<soapenv:Envelope xmlns:soapenv="http://ift.tt/18hkEkn">
<soapenv:Body>
<dat:getselect_addresses xmlns:dat="http://ift.tt/18X1brw">
<dat:objectid>2500000000</dat:objectid>
<dat:clientid>473906852857651</dat:clientid>
</dat:getselect_addresses>
</soapenv:Body>
</soapenv:Envelope>
response1:
<soapenv:Envelope xmlns:soapenv="http://ift.tt/18hkEkn">
<soapenv:Header></soapenv:Header>
<soapenv:Body>
<Addresses xmlns="http://ift.tt/18X1brw">
<Address>
<address>direccion1</address>
<partybranchid>796243010946586</partybranchid>
<clientid>473906852857651</clientid>
</Address>
<Address>
<address>direccion3</address>
<partybranchid>796243010946586</partybranchid>
<clientid>473906852857651</clientid>
</Address>
</Addresses>
</soapenv:Body>
</soapenv:Envelope>
response2:
<soapenv:Envelope xmlns:soapenv="http://ift.tt/18hkEkn">
<soapenv:Header></soapenv:Header>
<soapenv:Body>
<Addresses xmlns="http://ift.tt/18X1brw">
<Address>
<address>yo</address>
<partybranchid>2500000000</partybranchid>
<clientid>473906852857651</clientid>
</Address>
</Addresses>
</soapenv:Body>
</soapenv:Envelope>
In the outsequece I use a agregator mediator with this expression //add:Addresses/add:Address, so my out put message look like this:
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://ift.tt/18hkEkn">
<soapenv:Body>
<Address xmlns="http://ift.tt/18X1brw"><address>direccion1</address><partybranchid>796243010946586</partybranchid><clientid>473906852857651</clientid></Address>
<Address xmlns="http://ift.tt/18X1brw"><address>direccion3</address><partybranchid>796243010946586</partybranchid><clientid>473906852857651</clientid></Address>
<Address xmlns="http://ift.tt/18X1brw"><address>yo</address><partybranchid>2500000000</partybranchid><clientid>473906852857651</clientid></Address>
</soapenv:Body>
</soapenv:Envelope>
Now I want to transform this message with XSLT so I use ALTOVA XML SPY and build this xslt:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://ift.tt/tCZ8VR" xmlns:xs="http://ift.tt/tphNwY" xmlns:fn="http://ift.tt/pEXiIz" xmlns:a="http://ift.tt/18X1brw" xmlns:b="http://ift.tt/1rsxmEZ" exclude-result-prefixes="a fn xs">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<b:getAddressResponse>
<xsl:for-each select="//a:Address">
<address>
<address>
<xsl:value-of select="a:address"/>
</address>
<partybranchid>
<xsl:value-of select="a:partybranchid"/>
</partybranchid>
<clientid>
<xsl:value-of select="a:clientid"/>
</clientid>
</address>
</xsl:for-each>
</b:getAddressResponse>
</xsl:template>
</xsl:stylesheet>
If I test this transform in XML SPY with the previous soap message the result is this:
<?xml version="1.0" encoding="UTF-8"?>
<b:getAddressResponse xmlns:b="http://ift.tt/1rsxmEZ">
<address>
<address>direccion1</address>
<partybranchid>796243010946586</partybranchid>
<clientid>473906852857651</clientid>
</address>
<address>
<address>direccion3</address>
<partybranchid>796243010946586</partybranchid>
<clientid>473906852857651</clientid>
</address>
<address>
<address>yo</address>
<partybranchid>2500000000</partybranchid>
<clientid>473906852857651</clientid>
</address>
</b:getAddressResponse>
And it´s OK, but when I put this transformation inside the ESB after the aggregate mediator finish it work I recieve this wrong message:
<soapenv:Envelope xmlns:soapenv="http://ift.tt/18hkEkn">
<soapenv:Body>
<b:getAddressResponse xmlns:b="http://ift.tt/1rsxmEZ">
<address>
<address>direccion1</address>
<partybranchid>796243010946586</partybranchid>
<clientid>473906852857651</clientid>
</address>
</b:getAddressResponse>
<Address xmlns="http://ift.tt/18X1brw">
<address>direccion3</address>
<partybranchid>796243010946586</partybranchid>
<clientid>473906852857651</clientid>
</Address>
<Address xmlns="http://ift.tt/18X1brw">
<address>yo</address>
<partybranchid>2500000000</partybranchid>
<clientid>473906852857651</clientid>
</Address>
</soapenv:Body>
</soapenv:Envelope>
Any idea about this result??
No comments:
Post a Comment