0

I need to convert this xml into another one to send a soap message

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:Magento" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
  <SOAP-ENV:Body>
    <ns1:customerCustomerListResponse>
      <storeView SOAP-ENC:arrayType="ns1:customerCustomerEntity[2]" xsi:type="ns1:customerCustomerEntityArray">
        <item xsi:type="ns1:customerCustomerEntity">
          <customer_id xsi:type="xsd:int">1</customer_id>
          <created_at xsi:type="xsd:string">2007-08-30 23:23:13</created_at>
          <updated_at xsi:type="xsd:string">2008-08-08 12:28:24</updated_at>
          <increment_id xsi:type="xsd:string">000000001</increment_id>
          <store_id xsi:type="xsd:int">1</store_id>
          <website_id xsi:type="xsd:int">1</website_id>
          <email xsi:type="xsd:string">john.doe@example.com</email>
          <firstname xsi:type="xsd:string">John</firstname>
          <middlename xsi:type="xsd:string">
          </middlename>
          <lastname xsi:type="xsd:string">Doe</lastname>
          <group_id xsi:type="xsd:int">1</group_id>
          <prefix xsi:type="xsd:string">
          </prefix>
          <suffix xsi:type="xsd:string">
          </suffix>
          <taxvat xsi:type="xsd:string">
          </taxvat>
          <password_hash xsi:type="xsd:string">2049484a4020ed15d0e4238db22977d5:eg</password_hash>
        </item>
        <item xsi:type="ns1:customerCustomerEntity">
          <customer_id xsi:type="xsd:int">2</customer_id>
          <created_at xsi:type="xsd:string">2011-12-02 11:50:09</created_at>
          <updated_at xsi:type="xsd:string">2011-12-14 08:04:41</updated_at>
          <increment_id xsi:type="xsd:string">
          </increment_id>
          <store_id xsi:type="xsd:int">1</store_id>
          <website_id xsi:type="xsd:int">1</website_id>
          <created_in xsi:type="xsd:string">English</created_in>
          <email xsi:type="xsd:string">debashree.p@insync.co.in</email>
          <firstname xsi:type="xsd:string">Debashree</firstname>
          <lastname xsi:type="xsd:string">Paul</lastname>
          <group_id xsi:type="xsd:int">1</group_id>
          <password_hash xsi:type="xsd:string">5dfbcb1e28473f9ac6de23b2f6292caafca27bb551b354dff5c80601f2ac6586:1A</password_hash>
        </item>
      </storeView>
    </ns1:customerCustomerListResponse>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

I need it converted into this format

<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:Magento">
   <soapenv:Header/>
   <soapenv:Body>
      <urn:customerCustomerCreate soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
         <sessionId xsi:type="xsd:string"></sessionId>
         <customerData xsi:type="urn:customerCustomerEntityToCreate">


            <customer_id xsi:type="xsd:int">1</customer_id>

            <email xsi:type="xsd:string">john.doe@example.com</email>

            <firstname xsi:type="xsd:string">John</firstname>

            <lastname xsi:type="xsd:string">Doe</lastname>

            <password xsi:type="xsd:string">2049484a4020ed15d0e4238db22977d5</password>

            <website_id xsi:type="xsd:int">1</website_id>

            <store_id xsi:type="xsd:int">1</store_id>

            <group_id xsi:type="xsd:int">1</group_id>
         </customerData>
      </urn:customerCustomerCreate>
   </soapenv:Body>
</soapenv:Envelope>

I have created this xslt but its not working,i would be grateful if anyone helps me with this.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
	   <soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
	 xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:Magento">
<xsl:output method="xml"  indent="yes"/>

 <xsl:template match="/storeView">
 <soapenv:Header/>
 <soapenv:Body>
 <urn:customerCustomerCreate soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
 <sessionId xsi:type="xsd:string"></sessionId>							  				 					   
 <customerData xsi:type="urn:customerCustomerEntityToCreate">
 <xsl:for-each select="item">
 <customer_id xsi:type="xsd:int">
 <xsl:value-of select= "item/customer_id"/>								 
 </customer_id>
 <email xsi:type="xsd:string">
 <xsl:value-of select="item/email"/>									  
 </email>
 <firstname xsi:type="xsd:string">
 <xsl:value-of select="item/firstname"/>										  
 </firstname>
 <lastname xsi:type="xsd:string">
 <xsl:value-of select="item/lastname"/>										  
 </lastname>
 <password xsi:type="xsd:string">
 <xsl:value-of select="item/password"/>										  
 </password>
 <website_id xsi:type="xsd:int">
 <xsl:value-of select= "item/website_id"/>										 
 </website_id>
 <store_id xsi:type="xsd:int">  
 <xsl:value-of select= "item/store_id"/>										 
 </store_id>
 <group_id xsi:type="xsd:int">
 <xsl:value-of select="item/group_id"/>										  
 </group_id>
 </xsl:for-each>
 </customerData>
 </urn:customerCustomerCreate>
 </soapenv:Body>
 </xsl:template>
 </soapenv:Envelope>
	    
</xsl:stylesheet>
1
Contributor
1
Reply
2
Views
5 Years
Discussion Span
Last Post by sulagno
0
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
				 xmlns:ns1="urn:Magento"
				xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xmlns:urn="urn:Magento" version="1.0">
	<xsl:output method="xml"   indent="yes"/>

	<xsl:template match="/">
		<xsl:copy>

			<xsl:apply-templates select="//storeView"/>

		</xsl:copy>

	</xsl:template>


	<xsl:template match="storeView">
		<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:Magento">
			<soapenv:Header/>
			<soapenv:Body>
				<urn:customerCustomerCreate soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
					<sessionId xsi:type="xsd:string">

					</sessionId>
					<xsl:for-each select="item">
<customerData xsi:type="urn:customerCustomerEntityToCreate">

<customer_id xsi:type="xsd:int">
<xsl:value-of select= "customer_id"/>
</customer_id>
<email xsi:type="xsd:string">
<xsl:value-of select="email"/>
</email>
<firstname xsi:type="xsd:string">
<xsl:value-of select="firstname"/>
</firstname>
<lastname xsi:type="xsd:string">
<xsl:value-of select="lastname"/>
</lastname>
<password xsi:type="xsd:string">
<xsl:value-of select="password"/>
</password>
<website_id xsi:type="xsd:int">
<xsl:value-of select= "website_id"/>
</website_id>
<store_id xsi:type="xsd:int">
<xsl:value-of select= "store_id"/>
</store_id>
<group_id xsi:type="xsd:int">
<xsl:value-of select="group_id"/>
</group_id>
</customerData>
</xsl:for-each>
</urn:customerCustomerCreate>
</soapenv:Body>

</soapenv:Envelope>
</xsl:template>

</xsl:stylesheet>
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.