对象没有在属性中 - php Soap wsdl

发布于 2024-12-06 18:39:23 字数 3779 浏览 1 评论 0原文

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

PHP Fatal error: SOAP-ERROR: Encoding: object has not 'in' property in / www/zendserver/htdocs/dev/csc/csc.php 第 10 行


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

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 - 创建和调用 SOAP Web 服务 - 错误

Every time I try to make a call to my webservice, through the wsdl, I get the error message shown here. I think it's probably an issue within the the WSDL defintion, because I am not really sure what I am doing within the WSDL definition to begin with:

PHP Fatal error: SOAP-ERROR: Encoding: object hasn't 'in' property in /www/zendserver/htdocs/dev/csc/csc.php on line 10


I have a very simple web service, located at:

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();

?>

I have an interfacing page, which is what I access and then get the error shown above, located at:

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);
}
>?

I have my WSDL, located at:

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>

This post is a continuation of PHP - create and call SOAP web service - error

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文