473,386 Members | 1,743 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

calling javascript from XSLT

6
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
Nov 18 '08 #1
1 1986
acoder
16,027 Expert Mod 8TB
Does this help?

PS. please use [code] tags when posting code. Thanks.
Nov 18 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Jon Martin Solaas | last post by:
For java programmers there exist a framework called Millstone (www.millstone.org) for programming web user-interfaces in a component oriented way. Millstone uses xslt transformations to render...
1
by: Matt | last post by:
Is it possible to put XSL instructions inside JavaScript? For example, pop up a message box with the xml value: alert(value in xml); Approach #1: <script type="text/javascript">...
1
by: Claudio Jolowicz | last post by:
I need to produce an HTML page with javascript using XSLT. Unfortunately, Mozilla has a bug that lets it crash when it encounters document.write in an XSLT stylesheet (bugzilla# 202765). Are there...
1
by: Sergio del Amo | last post by:
Hi, I post here because, i think that my problem can happen to a lot of people using javascript with xml and xsl and the future feedback can be useful to all of us. I hava an xml file with a...
1
by: ms_chika | last post by:
Please help! I just want to know how can i pass the return value of a javascript function to a xsl variable. I have an xsl file and from that file i will call a javascript function then the...
6
by: RC | last post by:
Hello World, I am try do call a JavaScript function from XSLT, but I got function not avaible error. See "????" below. Would someone out there tell me how? Thank Q! <xsl:stylesheet...
2
by: Alan Searle | last post by:
I would like to use an XSL/HTML template to sort XML data dynamically on the client side. As it is, I found a tutorial showing how to do this on the following site ... ...
4
by: elsigh | last post by:
I'm wondering if anyone has any ideas about a way to quickly convert an HTML DOM Node into an XML Document. The goal is that I want to perform XSLT on the Node, which is coded correctly as XHTML....
6
by: kenundrum | last post by:
Hey all, I am having an issue with XML/XSLT and JavaScript in my ASP.NET page that I am creating. I first want to apologize if i placed this in the wrong category. Since there were three different...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.