Sign In/My Account | View Cart  
advertisement

Article:
 XSLT Web Service Clients
Subject: Using mode="" to process web services responses
Date: 2004-12-07 07:54:14
From: Andrzej Taramina

Good article, Bob. Funny that I just used this technique in implementing a new application for a client. Mind you, I used Cocoon and composed the app from internal pipelines, but the principle is the same.


One thing I found useful, is that sometimes you need/want to transform the response you are receiving from the web service. One simple way to do that, yet not screw up your primary flow of transforms on your original source document is to use the mode attribute on apply-templates. Something like this works very elegantly:


<xsl:apply-templates select="document( $webServiceURL )" mode="processWSResponse"/>


Then code your templates that process the response as:


<xsl:template match="something" mode="processWSResponse"/>


If you name your modes with descriptive identifiers, it keeps your XSLT code nicely organized, so that at a glance you can check what a template will be transforming.


....Andrzej


Previous Message Previous Message   Next Message Next Message


Titles Only Titles Only Newest First
  • Using mode="" to process web services responses
    2006-04-20 08:59:27 SAMDesi

    Hi ! I am trying similar calls in my XSLT but I keep getting parsing error. following is my small code and I am using MSXML4 SP2 to translate the same.


    Error while parsing "http://webservice.net/abc/webService.asmx/GetHTML?strURL=http://www.msn.com/". No data is available for the requested resource.


    if i print out above value and past into IE , i get the result but not via document() function. any idea?




  • Using mode="" to process web services responses
    2004-12-07 10:20:49 Bob DuCharme

    Yes, that's a nice self-documenting way to address the potential issue of the same template rule processing nodes from different documents, like with the "/" issue that I mentioned.


Sponsored By: