开发者

Object hasn't in property - php soap wsdl

开发者 https://www.devze.com 2023-04-08 19:17 出处:网络
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

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:/开发者_JS百科/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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号