对象没有在属性中 - php Soap wsdl
每次我尝试通过 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>
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论