这是我的代码Yii框架:
class ServiceController extends Controller {
public function actions() {
return array(
'wsdl' => array(
'class' => 'CWebServiceAction',
'serviceOptions'=>array('soapVersion'=>'1.2'),
'classMap'=>array(
'Customers',
),
),
);
}
/**
* @param string
* @return string
* @soap
*/
public function sayHello($test){
return $test;
}
}
这个类生成了这种类型的xml:
<definitions name="ServiceController" targetNamespace="urn:ServiceControllerwsdl">
<wsdl:message name="sayHelloRequest">
<wsdl:part name="test" type="xsd:integer"/>
</wsdl:message>
<wsdl:message name="sayHelloResponse">
<wsdl:part name="return" type="xsd:struct"/>
</wsdl:message>
<wsdl:portType name="ServiceControllerPortType">
<wsdl:operation name="sayHello">
<wsdl:documentation/>
<wsdl:input message="tns:sayHelloRequest"/>
<wsdl:output message="tns:sayHelloResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ServiceControllerBinding" type="tns:ServiceControllerPortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="sayHello">
<soap:operation soapAction="urn:ServiceControllerwsdl#sayHello" style="rpc"/>
<wsdl:input>
<soap:body use="encoded" namespace="urn:ServiceControllerwsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</wsdl:input>
<wsdl:output>
<soap:body use="encoded" namespace="urn:ServiceControllerwsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ServiceControllerService">
<wsdl:port name="ServiceControllerPort" binding="tns:ServiceControllerBinding">
<soap:address location="http://webs.softvision.ro/api/service/wsdl/ws/1"/>
</wsdl:port>
</wsdl:service>
</definitions>
我必须创建我的xml,看起来像这个例子:
<WL5G3N0:definitions targetNamespace="http://helloworld.webservice.moodykettle.com">
<WL5G3N0:types>
<xsd:schema elementFormDefault="qualified" targetNamespace="http://helloworld.webservice.moodykettle.com">
<xsd:element name="sayHello">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="name" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="sayHelloResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="sayHelloReturn" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="visitTimestampReq">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="reqMsg" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="visitTimestampResp">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="respMsg" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</WL5G3N0:types>
<WL5G3N0:message name="sayHelloResponse">
<WL5G3N0:part element="WL5G3N1:sayHelloResponse" name="parameters"/>
</WL5G3N0:message>
<WL5G3N0:message name="sayHelloRequest">
<WL5G3N0:part element="WL5G3N1:sayHello" name="parameters"/>
</WL5G3N0:message>
<WL5G3N0:message name="visitTimestampReq">
<WL5G3N0:part element="WL5G3N1:visitTimestampReq" name="parameters"/>
</WL5G3N0:message>
<WL5G3N0:message name="visitTimestampResp">
<WL5G3N0:part element="WL5G3N1:visitTimestampResp" name="parameters"/>
</WL5G3N0:message>
<WL5G3N0:portType name="HelloWorld">
<WL5G3N0:operation name="sayHello">
<WL5G3N0:input message="WL5G3N1:sayHelloRequest" name="sayHelloRequest"/>
<WL5G3N0:output message="WL5G3N1:sayHelloResponse" name="sayHelloResponse"/>
</WL5G3N0:operation>
<WL5G3N0:operation name="visitTimestampDetails">
<WL5G3N0:input message="WL5G3N1:visitTimestampReq"/>
<WL5G3N0:output message="WL5G3N1:visitTimestampResp"/>
</WL5G3N0:operation>
</WL5G3N0:portType>
<WL5G3N0:binding name="HelloWorldSoapBinding" type="WL5G3N1:HelloWorld">
<WL5G3N2:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<WL5G3N0:operation name="sayHello">
<WL5G3N2:operation/>
<WL5G3N0:input name="sayHelloRequest">
<WL5G3N2:body use="literal"/>
</WL5G3N0:input>
<WL5G3N0:output name="sayHelloResponse">
<WL5G3N2:body use="literal"/>
</WL5G3N0:output>
</WL5G3N0:operation>
<WL5G3N0:operation name="visitTimestampDetails">
<WL5G3N2:operation/>
<WL5G3N0:input name="visitTimestampReq">
<WL5G3N2:body/>
</WL5G3N0:input>
<WL5G3N0:output name="visitTimestampResp">
<WL5G3N2:body/>
</WL5G3N0:output>
</WL5G3N0:operation>
</WL5G3N0:binding>
<WL5G3N0:service name="HelloWorldSoapBindingQSService">
<WL5G3N0:documentation>
Service 2
</WL5G3N0:documentation>
<WL5G3N0:port binding="WL5G3N1:HelloWorldSoapBinding" name="HelloWorldSoapBindingQSPort">
<WL5G3N2:address location="http://unitxxxx/SayHello/HelloWorldImplPipe-proxy"/>
</WL5G3N0:port>
</WL5G3N0:service>
</WL5G3N0:definitions>
我不明白我该如何创建这种类型的xml?我是这个新手!知道如何让我的web服务返回这个XML吗?