Aspects of AJAX
Listings
120
<xsl:for-each select="/wsdl:definitions/wsdl:binding[@name = substring-
after(current()/@binding, ':')]">
<xsl:call-template name="soapbinding11" />
</xsl:for-each>
</xsl:template>
<xsl:template name="soapbinding11">
<xsl:variable name="portTypeName" select="substring-after(current()/@type, ':')" />
<xsl:for-each select="wsdl:operation">
<xsl:variable name="inputMessageName" select="substring-
after(/wsdl:definitions/wsdl:portType[@name = $portTypeName]/wsdl:operation[@name =
current()/@name]/wsdl:input/@message, ':')" />
<xsl:variable name="outputMessageName" select="substring-
after(/wsdl:definitions/wsdl:portType[@name = $portTypeName]/wsdl:operation[@name =
current()/@name]/wsdl:output/@message, ':')" />
/* inputMessageName='<xsl:value-of select="$inputMessageName" />',
outputMessageName='<xsl:value-of select="$outputMessageName" />' */
<xsl:for-each select="/wsdl:definitions/wsdl:portType[@name =
$portTypeName]/wsdl:operation[@name = current()/@name]/wsdl:documentation">
/** <xsl:value-of select="." /> */
</xsl:for-each>
proxies.<xsl:value-of select="$alias" />.<xsl:value-of select="@name" /> = function () {
return(proxies.callSoap(arguments)); }
proxies.<xsl:value-of select="$alias" />.<xsl:value-of select="@name" />.fname =
"<xsl:value-of select="@name" />";
proxies.<xsl:value-of select="$alias" />.<xsl:value-of select="@name" />.service =
proxies.<xsl:value-of select="$alias" />;
proxies.<xsl:value-of select="$alias" />.<xsl:value-of select="@name" />.action =
"\"<xsl:value-of select="soap:operation/@soapAction" />\"";
proxies.<xsl:value-of select="$alias" />.<xsl:value-of select="@name" />.params =
[<xsl:for-each select="/wsdl:definitions/wsdl:message[@name = $inputMessageName]">
<xsl:call-template name="soapMessage" />
</xsl:for-each>];
proxies.<xsl:value-of select="$alias" />.<xsl:value-of select="@name" />.rtype = [<xsl:for-
each select="/wsdl:definitions/wsdl:message[@name = $outputMessageName]">
<xsl:call-template name="soapMessage" />
</xsl:for-each>];
</xsl:for-each>
</xsl:template>
<xsl:template name="soapElem">
<xsl:param name="type"/>
<xsl:param name="name"/>
<!-- An annotation to comparisation of the types:
In XPath 1.0 there is no built in function to check if a string matches a specific type
declaration.
The trick with $XSDPrefix and the 2 following variables help out of this.
Thanks to António Cruz for this great trick.
This condition works on ASP.NET with ms - extensions available:
when test="msxsl:namespace-uri($type)='http://www.w3.org/2001/XMLSchema' and msxsl:local-
name($type)='boolean'"
This condition works with XPath 2.0 functions available:, (see http://www.w3.org/TR/xpath-
functions/#func-namespace-uri-from-QName)
when test="namespace-uri-from-QName($type)='http://www.w3.org/2001/XMLSchema' and local-
name-from-QName($type)='boolean'"
-->
<xsl:variable name="pre" select="substring-before($type, ':')" />
<xsl:variable name="post" select="substring-after($type, ':')" />
<xsl:choose>
<xsl:when test="$pre != '' and $pre!=$XSDPrefix and $pre!='tns'">
"<xsl:value-of select="$name" />"
</xsl:when>
<xsl:when test="$post='string'">
"<xsl:value-of select="$name" />"
</xsl:when>
<xsl:when test="$post='int' or $post='unsignedInt' or $post='short' or
$post='unsignedShort'
or $post='unsignedLong' or $post='long'">
"<xsl:value-of select="$name" />:int"