28 protected $sName=
'webservice';
30 public function setName($sName){
34 public function setUrl($url){
38 public function addFunction($sName){
39 $this->tmpMethod=$sName;
42 public function addParameter($sName,$sType){
43 $this->tMethod[$this->tmpMethod][
'param'][$sName]=$sType;
46 public function addReturn($sName,$sType){
47 $this->tMethod[$this->tmpMethod][
'return'][$sName]=$sType;
50 public function getWsdl(){
51 $sWsdl=
'<definitions xmlns:tns="'.$this->url.
'" targetNamespace="'.$this->url.
'" ';
52 $sWsdl.=
'xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" ';
53 $sWsdl.=
'xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" ';
54 $sWsdl.=
'xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" name="'.$this->sName.
'">';
57 $sWsdl.=
'<xsd:schema targetNamespace="'.$this->url.
'"/>';
60 $sWsdl.=
'<portType name="'.$this->sName.
'Port">';
61 foreach($this->tMethod as $sMethod => $foo){
62 $sWsdl.=
'<operation name="'.$sMethod.
'">';
63 $sWsdl.=
'<documentation>documenation</documentation>';
64 $sWsdl.=
'<input message="tns:'.$sMethod.
'In"/>';
65 $sWsdl.=
'<output message="tns:'.$sMethod.
'Out"/>';
66 $sWsdl.=
'</operation>';
68 $sWsdl.=
'</portType>';
71 $sWsdl.=
'<binding name="'.$this->sName.
'Binding" type="tns:'.$this->sName.
'Port">';
72 $sWsdl.=
'<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>';
73 foreach($this->tMethod as $sMethod => $foo){
74 $sWsdl.=
'<operation name="'.$sMethod.
'">';
75 $sWsdl.=
'<soap:operation soapAction="'.$this->url.
'#'.$sMethod.
'"/>';
77 $sWsdl.=
'<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />';
80 $sWsdl.=
'<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />';
82 $sWsdl.=
'</operation>';
87 $sWsdl.=
'<service name="'.$this->sName.
'Service">';
88 $sWsdl.=
'<port name="'.$this->sName.
'Port" binding="tns:'.$this->sName.
'Binding">';
89 $sWsdl.=
'<soap:address location="'.$this->url.
'"/>';
93 foreach($this->tMethod as $sMethod => $tParam){
94 $sWsdl.=
'<message name="'.$sMethod.
'In">';
95 foreach($tParam[
'param'] as $sParam => $sType){
96 $sWsdl.=
'<part name="'.$sParam.
'" type="xsd:'.$sType.
'"/>';
101 foreach($this->tMethod as $sMethod => $tParam){
102 $sWsdl.=
'<message name="'.$sMethod.
'Out">';
103 foreach($tParam[
'return'] as $sParam => $sType){
104 $sWsdl.=
'<part name="'.$sParam.
'" type="xsd:'.$sType.
'"/>';
106 $sWsdl.=
'</message>';
110 $sWsdl.=
'</definitions>';
116 public function show(){
117 header (
"Content-Type:text/xml");
118 echo $this->getWsdl();