📄 esd2wsdl.xsl
字号:
<?xml version="1.0" encoding="UTF-8"?>
<!--
/////////////////////////////////////////////////////////////////////////////
// $Id: esd2wsdl.xsl,v 1.6 2001/07/27 19:38:51 rosimildo Exp $
//
// Copyright (c) 2000-2001 - Rosimildo da Silva. All Rights Reserved.
//
// MODULE DESCRIPTION: XSL stylesheet to transform an eSD to a WSDL document.
//
// MODIFICATION/HISTORY:
//
// $Log: esd2wsdl.xsl,v $
// Revision 1.6 2001/07/27 19:38:51 rosimildo
// Moved the type namespace infor the service object.
//
// Revision 1.5 2001/07/27 17:29:21 rosimildo
// Soem changes to get the ICU.esd file compiling back to WSDL file.
//
// Revision 1.4 2001/07/27 11:40:52 rosimildo
// Small changes to remove the "soapinterop" stuff.
//
// Revision 1.3 2001/07/27 00:51:16 rosimildo
// Changed the name of the access for arrays to be "item".
//
//
// Created 2001/07/03 Rosimildo da Silva, ConnectTel Inc.
// [rdasilva@connecttel.com]
//
//////////////////////////////////////////////////////////////////////////////
-->
<xsl:stylesheet version="1.0"
xmlns:xsl ="http://www.w3.org/1999/XSL/Transform"
xmlns:typens="http://schemas.esoap.com/types/xsd"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:esd="http://esd.esoapcg.com/esd/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" >
<xsl:output method = "xml" indent ="yes"/>
<xsl:template match="esd:Service">
<xsl:variable name="serviceName" select="@name"/>
<wsdl:definitions name="{$serviceName}"
xmlns="http://schemas.xmlsoap.org/wsdl/"
targetNamespace="{@targetNamespace}"
xmlns:wsdlns="http://esd.esoapcg.com/wsdlns/" >
<!-- process the complex types of the SSDL file -->
<xsl:if test="/esd:Service/esd:CType | /esd:Service/esd:AType">
<wsdl:types>
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
targetNamespace="{@typeNamespace}" >
<xsl:for-each select="/esd:Service/esd:CType">
<xsl:call-template name="outputType">
</xsl:call-template>
</xsl:for-each>
<xsl:for-each select="/esd:Service/esd:AType">
<xsl:call-template name="outputArray">
</xsl:call-template>
</xsl:for-each>
</xsd:schema>
</wsdl:types>
</xsl:if>
<xsl:for-each select="/esd:Service/esd:Interface/esd:Method/esd:InParam | /esd:Service/esd:Interface/esd:Method/esd:OutParam">
<xsl:call-template name="outputMessage">
</xsl:call-template>
</xsl:for-each>
<xsl:for-each select="/esd:Service/esd:Interface">
<wsdl:portType name="{@name}">
<xsl:for-each select="current()/esd:Method">
<xsl:call-template name="outputOperation">
</xsl:call-template>
</xsl:for-each>
</wsdl:portType>
<xsl:call-template name="outputBinding">
</xsl:call-template>
</xsl:for-each>
<wsdl:service name="{@name}">
<xsl:for-each select="/esd:Service/esd:Interface">
<xsl:variable name="i_name" select="@name"/>
<xsl:variable name="b_name" select="concat( 'Binding', $i_name ) "/>
<xsl:variable name="loc" select="@location"/>
<wsdl:port name="{$i_name}" binding="wsdlns:{$b_name}">
<soap:address location="{$loc}" />
</wsdl:port>
</xsl:for-each>
</wsdl:service>
</wsdl:definitions>
</xsl:template>
<!-- templates definitions -->
<xsl:template name="outputType">
<xsd:complexType name="{@name}">
<xsd:all>
<xsl:for-each select="current()/esd:item">
<xsl:variable name="aT" select='/esd:Service/esd:AType[@stype=current()/@type]'/>
<xsl:choose><xsl:when test="current()[@array='true']" >
<xsl:variable name="tp_name" select="concat( 'typens:', $aT/@name ) "/>
<xsd:element name="{@name}" type="{$tp_name}" />
</xsl:when><xsl:otherwise>
<xsl:variable name="tp_n1" select="substring-after( current()/@type, ':' )" />
<xsl:variable name="tp_n" select="concat( 'typens:', $tp_n1 ) "/>
<xsl:choose><xsl:when test="current()[@builtin='true']" >
<xsd:element name="{@name}" type="{@type}" />
</xsl:when><xsl:otherwise>
<xsd:element name="{@name}" type="{$tp_n}" />
</xsl:otherwise></xsl:choose>
</xsl:otherwise></xsl:choose>
</xsl:for-each>
</xsd:all>
</xsd:complexType>
</xsl:template>
<xsl:template name="outputArray">
<xsd:complexType name="{@name}">
<xsd:complexContent>
<xsd:restriction base="SOAP-ENC:Array">
<xsl:choose><xsl:when test="current()[@builtin='true']" >
<xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="{@type}" />
</xsl:when><xsl:otherwise>
<xsl:variable name="tp_n1" select="substring-after( current()/@type, ':' )" />
<xsl:variable name="tp_n" select="concat( 'typens:', $tp_n1 ) "/>
<xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="{$tp_n}" />
</xsl:otherwise></xsl:choose>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
</xsl:template>
<xsl:template name="outputMessage">
<wsdl:message name="{@name}">
<xsl:for-each select="current()/esd:item">
<xsl:variable name="aT" select='/esd:Service/esd:AType[@stype=current()/@type]'/>
<xsl:choose><xsl:when test="current()[@array='true']" >
<xsl:variable name="tp_name" select="concat( 'typens:', $aT/@name ) "/>
<wsdl:part name="{@name}" type="{$tp_name}" />
</xsl:when><xsl:otherwise>
<xsl:variable name="tp_n1" select="substring-after( current()/@type, ':' )" />
<xsl:variable name="tp_n" select="concat( 'typens:', $tp_n1 ) "/>
<xsl:choose><xsl:when test="current()[@builtin='true']" >
<wsdl:part name="{@name}" type="{@type}" />
</xsl:when><xsl:otherwise>
<wsdl:part name="{@name}" type="{$tp_n}" />
</xsl:otherwise></xsl:choose>
</xsl:otherwise></xsl:choose>
</xsl:for-each>
</wsdl:message>
</xsl:template>
<xsl:template name="outputOperation">
<wsdl:operation name="{@name}">
<wsdl:input message="wsdlns:{current()/esd:InParam/@name}" />
<wsdl:output message="wsdlns:{current()/esd:OutParam/@name}" />
</wsdl:operation>
</xsl:template>
<xsl:template name="outputBinding">
<xsl:variable name="sa" select="@soapAction"/>
<xsl:variable name="ns" select="@namespace"/>
<xsl:variable name="bind_name" select="concat( 'Binding', @name ) "/>
<wsdl:binding name="{$bind_name}" type="wsdlns:{@name}">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
<xsl:for-each select="current()/esd:Method">
<wsdl:operation name="{@name}">
<soap:operation soapAction="{$sa}" />
<wsdl:input>
<soap:body use="encoded" namespace="{$ns}"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</wsdl:input>
<wsdl:output>
<soap:body use="encoded" namespace="{$ns}"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</wsdl:output>
</wsdl:operation>
</xsl:for-each>
</wsdl:binding>
</xsl:template>
</xsl:stylesheet>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -