AW: [xsl] Webservices and XSLT

Subject: AW: [xsl] Webservices and XSLT
From: "Szabo, Patrick \(LNG-VIE\)" <patrick.szabo@xxxxxxxxxxxxx>
Date: Fri, 3 Feb 2012 10:27:48 +0100
Hi,

Thanks a lot for your very detailed answer.
I'll take a look at EXPath and the ressources you've provided.

Best regards


. . . . . . . . . . . . . . . . . . . . . . . . . .
Ing. Patrick Szabo
 XSLT Developer
LexisNexis
A-1030 Wien, Marxergasse 25

mailto:patrick.szabo@xxxxxxxxxxxxx
Tel.: +43 1 53452 1573
Fax: +43 1 534 52 146


-----UrsprC<ngliche Nachricht-----

Von: Florent Georges [mailto:lists@xxxxxxxxxxxx]
Gesendet: Freitag, 03. Februar 2012 09:58
An: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Betreff: Re: [xsl] Webservices and XSLT

"Szabo, Patrick (LNG-VIE)" wrote:

  Hi,

> I was looking online and found several possibilities to work
> with soap and xslt but I can't wrap my head around how this
> really works.

  Well, as with any other client (if we restrict the discussion
to synchronous SOAP-over-HTTP Web services), technically you
have to send POST requests (with the XML message as the payload)
and you get the operation's XML response as the payload of the
HTTP response.

  XSLT is very well suited to construct the XML request and
consume the XML response, but you'll need an extension to send
HTTP POST requests.  The EXPath HTTP Client is implemented for
several processor, check your processor to see if it does support
it.  More infos in the following pages (including an example of
consuming a SOAP Web service):

    http://expath.org/modules/http-client/
    http://expath.org/modules/http-client/samples#soap
    http://expath.org/spec/http-client

> In no example online I see where the URL to the wsdl is
> configured.

  If you expect more automated support in XSLT from a WSDL,
that's another story.  I wrote once a WSDL compiler, that
"compiled" a WSDL to a stylesheet defining a function for each
Web service operation, hiding all the communication technical
details for the user.  So the user can just call a function by
passing directly the payload, and getting back the response.

  With the WSDL in the above example, the generated function
could be called like:

    <xsl:stylesheet xmlns:tns="http://www.webservicex.net"; ...>

       <!-- import the library generated from the WSDL -->
       <xsl:import href="compiled-web-service.xsl"/>

       <!-- the service operation request -->
       <xsl:variable name="request">
          <wsx:GetWeatherByPlaceName>
             <wsx:PlaceName>NEW YORK</wsx:PlaceName>
          </wsx:GetWeatherByPlaceName>
       </xsl:variable>

       <!-- invoke the service operation -->
       <xsl:template name="main">
          <xsl:sequence select="
              tns:GetWeatherByPlaceName($request)"/>
       </xsl:template>


    </xsl:stylesheet>

  Unfortunately the WSDL compiler was never released, but I can
send you a copy if you want...  Of course, it relies on the
EXPath HTTP Client in order to send HTTP requests under the hood.

  Regards,

--
Florent Georges
http://fgeorges.org/
http://h2oconsulting.be/

Current Thread