472,143 Members | 1,674 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

HTTP POST from XSLT

6
Hi,

I am newbie in xslt.

I have some problem in my current project.

I have to call web service from xslt. I have to use HTTP Post method to access webservice.

I have got a guideline but not understanding fully....
http://www.biglist.com/lists/xsl-list/archives/200212/msg00068.html


Please let me know how can I write the xslt.

Regards,
Smaranika
Nov 16 '08 #1
6 7972
Dormilich
8,658 Expert Mod 8TB
you picked up quite a difficult topic for your start....

well, the mentioned <post:message> was a self written extension (...) by the author, so without that, we can't help you there. The discussion went then about server interactions of xml/xslt.

Is it absolutely necessary, that you call your webservice (SOAP?) from within XSLT? there may be other ways including other techniques, but I can't say that for sure (I don't use websevices yet).

regards
Nov 17 '08 #2
neerom
6
Hi

Thanx for your reply.......

I need to call webservice from xslt.

I have implemented the get method:

The sample is a addition program.

The xslt is.....


<?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>


The Web method is......

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)
{

}
}


Now i want to call webservice using post method. The soap is written below. Please tell me how can pass this soap message from xslt to the webservice?


<?xml version="1.0" encoding="utf-8" ?>
- <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/">
- <soap:Body>
- <AddTwoNumbers xmlns="http://localhost/wwwroot/addnumbers/Service1">
<a>10</a>
<b>12</b>
</AddTwoNumbers>
</soap:Body>
</soap:Envelope>
Nov 17 '08 #3
Dormilich
8,658 Expert Mod 8TB
first, please use [code] tags (or select your code, then click on the # button in the message editor menu) when posting code.

I suppose your calculation service is just an example for something else (why add two numbers remotely except for testing something more complex...)

also I do not see the point for the need of xslt yet. if you could be a bit more specific about the background I could be of more help.

regards

PS: which XSLT version are you using?
PPS: found XSLT 2.0 SOAP extension
Nov 17 '08 #4
neerom
6
Actually i need to call many functions one by one And have to use XSLT for that.

I use microsoft processor. Not the saxon one...
Nov 17 '08 #5
Dormilich
8,658 Expert Mod 8TB
that's the best I could find... but maybe it gives you a little push in the right direction (the idea there was to call soap via java)

regards
Nov 17 '08 #6
jkmyoung
2,057 Expert 2GB
XSLT can only access an xml document as if it was a static document. You really need to do this coding in C# or another language.
Nov 17 '08 #7

Post your reply

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

Similar topics

4 posts views Thread by Gary Petersen | last post: by
reply views Thread by WIWA | last post: by
3 posts views Thread by JansenH | last post: by
1 post views Thread by Arfeen | last post: by
2 posts views Thread by =?Utf-8?B?cGhlbmdsYWk=?= | last post: by
reply views Thread by leo001 | last post: by

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.