对象没有属性 - php soap wsdl

时间:2011-09-26 21:34:37

标签: php xml web-services soap wsdl

每当我尝试通过wsdl调用我的web服务时,都会收到此处显示的错误消息。我认为这可能是WSDL定义中的一个问题,因为我不确定我在WSDL定义中做了什么:

PHP致命错误:SOAP-ERROR:编码:对象在第10行的/www/zendserver/htdocs/dev/csc/csc.php中没有'in'属性


我有一个非常简单的网络服务,位于:

http://192.168.1.2:10088/csc/csc.php

<?php

function EchoText($text){
    return $text;
}

$server = new SoapServer("http://192.168.1.2:10088/csc/csc.wsdl",
                         array('uri' => "http://192.168.1.2:10088/csc/csc.php"));
$server->addFunction('EchoText');
$server->handle();

?>

我有一个接口页面,这是我访问的,然后得到上面显示的错误,位于:

http://192.168.1.2:10088/csc/request.php

<?php
try{
    $client = new SoapClient("http://192.168.1.2:10088/csc/csc.wsdl", array('trace'=>1));
    $result = $client->EchoText("test");
    echo $result;
} catch (Exception $e) {
    print_r($e);
}
>?

我有我的WSDL,位于:

http://192.168.1.2:10088/csc/csc.wsdl

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://192.168.1.2:10088/csc/csc.wsdl" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="csc" targetNamespace="http://192.168.1.2:10088/csc/csc.wsdl">
  <wsdl:types>
    <xsd:schema targetNamespace="http://192.168.1.2:10088/csc/csc.wsdl">
      <xsd:element name="EchoText">
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element name="in" type="xsd:string"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="EchoTextResponse">
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element name="out" type="xsd:string"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="EchoTextFault">
        <xsd:complexType>
          <xsd:all>
          <xsd:element name="errorMessage" type="xsd:string"/>
        </xsd:all>
        </xsd:complexType>
      </xsd:element>         
    </xsd:schema>
  </wsdl:types>
  <wsdl:message name="EchoTextRequest">
    <wsdl:part element="tns:EchoText" name="parameters"/>
  </wsdl:message>
  <wsdl:message name="EchoTextResponse">
    <wsdl:part element="tns:EchoText" name="parameters"/>
  </wsdl:message>
  <wsdl:portType name="csc">
    <wsdl:operation name="EchoText">
      <wsdl:input message="tns:EchoTextRequest"/>
      <wsdl:output message="tns:EchoTextResponse"/>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="cscSOAP" type="tns:csc">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="EchoText">
      <soap:operation soapAction="http://192.168.1.2:10088/csc/csc/EchoText"/>
      <wsdl:input>
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="csc">
    <wsdl:port binding="tns:cscSOAP" name="cscSOAP">
      <soap:address location="http://192.168.1.2:10088/csc/csc.php"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

这篇文章是PHP - create and call SOAP web service - error

的延续

0 个答案:

没有答案