Connecting Tech Pros Worldwide Forums | Help | Site Map

calling javascript from XSLT

Newbie
 
Join Date: Nov 2008
Posts: 4
#1: Nov 18 '08
Hi

I need to call webservice from xslt in HTTP POST Method. The MSXML should be used. I am using javascript.

I have an XML File which is having Integer Node.....Shown Below
Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <NumberSet>
  3.   <integer>
  4.     <a>10</a>
  5.     <b>12</b>
  6.   </integer>
  7. </NumberSet>
  8.  
XSLT will call javascript and pass "Integer" node to javascript. The javascript will create the SOAP message and call webservice.
The soap message is....

Expand|Select|Wrap|Line Numbers
  1.   <?xml version="1.0" encoding="utf-8" ?>
  2.     - <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  3.    <soap:Body>
  4.    <AddTwoNumbers xmlns="http://localhost/wwwroot/addnumbers/Service1">
  5.       <a>10</a>
  6.       <b>12</b>
  7.       </AddTwoNumbers>
  8.       </soap:Body>
  9.  
Please tell me how to write the code in xslt.

Regards,
Smaranika




</xsl:stylesheet>


The Web method is......

Expand|Select|Wrap|Line Numbers
  1. using System;
  2. using System.Web;
  3. using System.Collections;
  4. using System.Web.Services;
  5. using System.Web.Services.Protocols;
  6. using System.Xml;
  7.  
  8.  
  9. /// <summary>
  10. /// Summary description for WebService
  11. /// </summary>
  12. [WebService(Namespace = "http://www.tempuri.org/")]
  13. [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
  14. public class WebService : System.Web.Services.WebService {
  15.  
  16.     public WebService () {
  17.  
  18.         //Uncomment the following line if using designed components
  19.         //InitializeComponent();
  20.     }
  21.  
  22.     //[WebMethod]
  23.     //public string HelloWorld()
  24.     //{
  25.     //    return "Hello World";
  26.     //}
  27.     [WebMethod]
  28.     public int WebAdd(int x, int y)
  29.     {
  30.         return x + y;
  31.     }
  32.     [WebMethod]
  33.     public int WebMultiply(int x, int y)
  34.     {
  35.         return x * y;
  36.     }
  37.     [WebMethod]
  38.     public void testmethod(XmlDocument xd)
  39.     {
  40.  
  41.     }
  42. }



Please help me.....
Regards,
Smaranika

acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#2: Nov 18 '08

re: calling javascript from XSLT


Does this help?

PS. please use [code] tags when posting code. Thanks.
Reply