473,799 Members | 3,052 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

calling javascript from XSLT

6 New Member
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 2004
acoder
16,027 Recognized Expert Moderator MVP
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
2386
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 components as html. I'm trying to modify millstone so that it can display a html editor widget called HTMLArea instead of the usual html <textarea> tag. But I need a little help with the xslt transformation. Especially there is a construct,...
1
3351
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"> alert(<xsl:value-of select="@id"/>); </script> It will have javascript errors
1
2027
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 XSLT-related workarounds to this bug? I am aware that mozilla bug discussions are off-topic on this list. This question concerns only possible alternatives making use of XSLT's facilities. Neither linking to an external javascript file, nor...
1
4459
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 tree structure and a xsl file to transform it into xhtml strict. In my file xsl i have: <head> <title>Generic XHTML Treeview</title> <meta http-equiv="Content-type" content="text/html;
1
4340
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 result will be stored in to the <xsl:variable> how will i do that? Or is it really possible to do that or is there other way of doing it? Your help will be very much appreciated.
6
4692
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 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="html" /> <xsl:template match="/">
2
6179
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 ... http://www.bayes.co.uk/xml/portal.aspx?page=/xml/tutorial/index.xml&subpage=/xml/tutorial/filtering/filter.xml I experimented with the examples and found that they would run fine on a local PC (without installing a web-server). That is just what I need!
4
3126
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. In Mozillae, it works to parse the serializeToString output, but this functionality doesn't exist for IE. I've made one function that loops through all the nodes & attributes and constructs a string that can be successfully parsed into xml, but...
6
2582
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 entities here i wasn't 100% sure where to place it. Here is the background on the issue: I have a XML tag that is located in multiple places and multiple documents that has a structure of: <LINK ID="para0001">LINK TEXT</LINK> This tag...
0
10482
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10251
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10225
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10027
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7564
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5463
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3759
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.