我正在做一个与WSDL相关的项目,我想在我的WSDL文件中添加新的属性。WSDL的主要结构是:
<definitions>
<types>
data type definitions........
</types>
<message>
definition of the data being communicated....
</message>
<portType>
set of operations......
</portType>
<binding>
protocol and data format specification....
</binding>
</definitions>
我想做的是在wsdl中添加服务质量(QoS)属性,所以新的结构是这样的:
<definitions>
<types>
data type definitions........
</types>
<message>
definition of the data being communicated....
</message>
<portType>
set of operations......
</portType>
<binding>
protocol and data format specification....
</binding>
<QoS>
Qos criteria.....
</QoS>
</definitions>
例如,这个属性将被添加到wsdl:
<Reliability Qualification="threshold-best-effort" Offered="true">
<TimeToFailure value= 500000000 unit="sec" source="measured"
type=”mean” direction=”increasing />
</Reliability>
结果应该是这样的,<Reliability>
属性将被插入到<service>
:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://sample" xmlns:qwsdl="http://example.com/stockquote/schemas" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://sample" xmlns:intf="http://sample" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)-->
<wsdl:import namespace = "http://localhost:8080/WSDLExtention/wsdl/stockquote.xsd" location="http://localhost:8080/WSDLExtention/wsdl/stockquote.xsd"/>
<wsdl:types>
<schema elementFormDefault="qualified" targetNamespace="http://sample" xmlns="http://www.w3.org/2001/XMLSchema">
<element name="myCalculation">
<complexType>
<sequence>
<element name="decimal" type="xsd:string"/>
</sequence>
</complexType>
</element>
<element name="myCalculationResponse">
<complexType>
<sequence>
<element name="myCalculationReturn" type="xsd:string"/>
</sequence>
</complexType>
</element>
</schema>
</wsdl:types>
<wsdl:message name="myCalculationResponse">
<wsdl:part element="impl:myCalculationResponse" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="myCalculationRequest">
<wsdl:part element="impl:myCalculation" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="Calculation">
<wsdl:operation name="myCalculation">
<wsdl:input message="impl:myCalculationRequest" name="myCalculationRequest">
</wsdl:input>
<wsdl:output message="impl:myCalculationResponse" name="myCalculationResponse">
</wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="CalculationSoapBinding" type="impl:Calculation">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="myCalculation">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="myCalculationRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="myCalculationResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="CalculationService">
<wsdl:port binding="impl:CalculationSoapBinding" name="Calculation">
<wsdlsoap:address location="http://localhost:8080/Action1/services/Calculation"/>
</wsdl:port>
<Reliability Qualification="threshold-best-effort" Offered="true">
<TimeToFailure value= 500000000 unit="sec" source="measured"
type=”mean” direction=”increasing />
</Reliability>
</wsdl:service>
</wsdl:definitions
我尝试向wsdl添加新的模式,但总是失败。有可能做到吗?知道如何将这个新属性添加到WSDL文件中吗?
WSDL有一个标准定义,您不能像这样自定义它。
根据你的绑定来定义这个模式。
http://www.w3.org/TR/wsdl A4.2
显然,您可以使用这个模式(Ext)
<element name="service" type="wsdl:serviceType"/>
<complexType name="serviceType">
<complexContent>
<extension base="wsdl:documented">
<sequence>
<element ref="wsdl:port" minOccurs="0" maxOccurs="unbounded"/>
<any namespace="##other" minOccurs="0"/>
</sequence>
<attribute name="name" type="NCName" use="required"/>
</extension>
</complexContent>
</complexType>
但是我从来没有试过,没有任何样品。