Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 17th, 2008, 04:15 AM
Registered User
 
Join Date: Nov 2008
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Passing soap message

Hi,

I need to pass a SOAP message to a web service from xslt.

Please guide me how to write the xslt ....

Smaranika

Reply With Quote
  #2 (permalink)  
Old November 17th, 2008, 05:09 AM
mhkay's Avatar
Wrox Author
Points: 18,481, Level: 59
Points: 18,481, Level: 59 Points: 18,481, Level: 59 Points: 18,481, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,960
Thanks: 0
Thanked 292 Times in 287 Posts
Default

This same question was asked a couple of days ago. There is no standard way to invoke web services from an XSLT stylesheet, either in XSLT 1.0 or 2.0. There may be a way to do it from your particular XSLT processor, but the solution will be vendor-dependent.

Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer's Reference
Reply With Quote
  #3 (permalink)  
Old November 17th, 2008, 05:59 AM
Registered User
 
Join Date: Nov 2008
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

Thanx for your update.. I am using visual studio 2005. I have written a webservice which adds two integer....

using System;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml;


/// <summary>
/// Summary description for WebService
/// </summary>
[WebService(Namespace = "http://www.tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class WebService : System.Web.Services.WebService {

    public WebService () {

        //Uncomment the following line if using designed components
        //InitializeComponent();
    }

    //[WebMethod]
    //public string HelloWorld()
    //{
    // return "Hello World";
    //}
    [WebMethod]
    public int WebAdd(int x, int y)
    {
        return x + y;
    }
    [WebMethod]
    public int WebMultiply(int x, int y)
    {
        return x * y;
    }
    [WebMethod]
    public void testmethod(XmlDocument xd)
    {

    }


The XSLT passes the int value by GET method:

<?xml version="1.0" encoding="utf-8"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:user="http://my_domain_name/my_namespace">

    <xsl:output method="xml" omit-xml-declaration="yes"/>

    <xsl:template match="/">
        <xsl:variable name="params" select="concat('x=',10,'&amp;y=',20)" />

        <xsl:variable name="CallWebService" select="'http://localhost:1600/smaranika_test/WebService.asmx/WebAdd'" />

        <xsl:variable name="docName" select="concat($CallWebService,'?',$params)" />

        <xsl:variable name="returnvalue" select="document($docName)" />
        <xsl:value-of select="$returnvalue"/>
    </xsl:template>


</xsl:stylesheet>



It is running successfully.... Then why cant we call a web service using post method??

Reply With Quote
  #4 (permalink)  
Old November 17th, 2008, 07:32 AM
mhkay's Avatar
Wrox Author
Points: 18,481, Level: 59
Points: 18,481, Level: 59 Points: 18,481, Level: 59 Points: 18,481, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,960
Thanks: 0
Thanked 292 Times in 287 Posts
Default

The document() function in most implementations will do a simple HTTP GET request. (Personally, I think it's a bit pretentious to call that a web service, but some people do.) However, there is no capability in the language to do a POST request, and there are some difficulties in providing such a capability in a language which is supposed to be purely functional and side-effect-free. I do know that some vendors have added such capabilities to their products but I can't give you any detail.

Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer's Reference
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
need way to pass the soap message to webservice i raju_kmarhotmail.com .NET Web Services 0 November 3rd, 2007 03:19 AM
Chapter 15, POSTing a SOAP message ;example on 579 kbrown BOOK: Beginning XML 3rd Edition 3 August 25th, 2006 05:23 PM
message passing between threads in c# hisham_abu General .NET 0 September 26th, 2005 03:13 PM
Soap parameters passing as null daniel_bowden XML 3 February 26th, 2004 12:17 PM
SOAP Message hueduongit .NET Web Services 4 December 1st, 2003 08:46 PM



All times are GMT -4. The time now is 03:42 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.