Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
| 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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
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

 
Old November 17th, 2008, 05:09 AM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
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
 
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??

 
Old November 17th, 2008, 07:32 AM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
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




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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.