Subject:Calling Web Service Method from XSLT . Author:sam desi Date:17 Apr 2006 12:07 PM
Hi All,
My XSL looks like following, I am calling Web Service method , which is returning me some plain HTML from screen scrapping. and I am using VB Script to make a call to web service from my XSLT. now I want to write something generic so I don't need to write any kind of script. Is there anyway I can call WebService method directly and get HTML from the method by passing parameter to web service method in XSLT itself.
Following is XSLT looks like
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:abcScripts="http://" xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="1.0">
<!-- Include Elements
-->
---
---
Function GetSomeHTML(url)
dim wsURL
wsURL = "http://localhost/abc/so/WebService.asmx/GetHTML"
dim xmlHttpObj
set xmlHttpObj = CreateObject("MSXML2.SERVERXMLHTTP")
xmlHttpObj.open "POST" , wsURL , false
xmlHttpObj.setRequestHeader "Content-Type" , "application/x-www-form-urlencoded"
xmlHttpObj.send "strURL=" & url
GetSomeHTML= xmlHttpObj.responseXML.documentElement.text
End Function
---
---
<xsl:when test="$navid='123'">
<xsl:value-of select="abcScripts:GetSomeHTML('http://localhost/abc/1/123.aspx')" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="abcScripts:GetSomeHTML('http://localhost/xyz/1/456.aspx')" />
</xsl:otherwise>
Subject:Calling Web Service Method from XSLT . Author:sam desi Date:18 Apr 2006 10:24 AM
here is my XSL
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="1.0">
<xsl:template match="/">
<xsl:text disable-output-escaping="yes"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"></xsl:text><xsl:text>
</xsl:text>
Subject:Calling Web Service Method from XSLT . Author:sam desi Date:18 Apr 2006 04:32 PM
I have attached my files , Actually XSL file and XML file is valid, I tried to edit some stuff so it got screwd up anyway, file I am attaching is valid XSL, now What's happening when I print the value of <xsl:value-of select="concat($ws,$url)" /> i get the correct value and i can also see good and when I put into the IE , i see the page. but when I use <xsl:value-of select="document(concat($ws,$url))" /> its throwing Transform() error '800a0066' and I am doing translation in ASP. Please let me know what do you think.
Subject:Calling Web Service Method from XSLT . Author:sam desi Date:19 Apr 2006 09:23 AM
Is there anyother way , I cam make a call to web service method in outside script and get the result back to XSLT and when I migrate to .NET I can also use that script no need to re-write the script.
Subject:Calling Web Service Method from XSLT . Author:Brynjar Larssen-Aas Date:09 Jun 2006 03:55 AM
Looks like you know this stuff Ivan,
so, can you help me with this:
I am working on a project and I am trying to find a way to validate XML-files with XSLT and Webservices. I have made a simple ws that returns a boolean true if the given number is below 50 and false if it is above 50. Now, I want to check this with the use of a variable that contains of the url to the ws (for this test it is something like http://localhost:port/service/check?value=X where X is the number picket up from the XML) I know that the variable containing the url works fine for every value, using a template, but I dont't get the choose or if-test to work.
Basicly I want something like this:
if $variable is true, then print out "value is valid" else "value is not valid"