gpt4 book ai didi

PHP SoapClient __getFunctions() 返回未知类型

转载 作者:行者123 更新时间:2023-12-04 06:13:54 25 4
gpt4 key购买 nike

我正在尝试构建一个将由 PHP SoapClient 读取的示例 wsdl 文件,尽管我的 wsdl 文档可以正常工作(它正确返回函数),但仍有一些地方不对,因为 PHP 的 __getFunctions 方法返回以下内容:

array(1) { [0]=> string(35) "UNKNOWN getDocument(UNKNOWN $input)" } 

从这个函数返回的内容来看,类型定义似乎不是 100% 正确的,因为类型显示为 UNKNOWN。
<?xml version="1.0"?>
<definitions name="Document" targetNamespace="urn:Document" xmlns:tns="urn:Document" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/">
<types>
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:Document">
<xsd:element name="InputUserType" type="xsd:string" />
<xsd:element name="DocumentResponseType" type="xsd:string" />
</xsd:schema>
</types>

<message name="getDocumentInputUser">
<part name="input" type="tns:InputUserType" />
</message>

<message name="getDocumentResponse">
<part name="return" type="tns:DocumentResponseType" />
</message>

<portType name="DocumentPort">
<operation name="getDocument">
<input message="tns:getDocumentInputUser" />
<output message="tns:getDocumentResponse" />
</operation>
</portType>

<binding name="DocumentBinding" type="tns:DocumentPort">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
<operation name="getDocument">
<soap:operation soapAction="urn:DocumentAction" />
<input>
<soap:body use="encoded" namespace="urn:Document" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</input>
<output>
<soap:body use="encoded" namespace="urn:Document" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</output>
</operation>
</binding>

<service name="DocumentService">
<port name="DocumentPort" binding="tns:DocumentBinding">
<soap:address location="http://www.apollo.co.za/soap/test2server.php" />
</port>
</service>

</definitions>

我试图定义一个简单的 wsdl 文档,它有一个操作“getDocument”,它接受一个用户名字符串参数并返回一个字符串结果。我对 SOAP 非常陌生,并且正在努力掌握它,所以如果有人能指出我的 wsdl 定义中的错误,我将不胜感激。

最佳答案

尝试 type='xsd:string' 而不是 type="tns:InputUserType"

希望例子有帮助,这是我使用的一个:

<?xml version='1.0' encoding='UTF-8' ?>
<definitions name='AddWidget'
targetNamespace='urn:ANYTHINGHEREAddWidget'
xmlns:tns='urn:ANYTHINGHEREAddWidget'
xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'
xmlns:xsd='http://www.w3.org/2001/XMLSchema'
xmlns:soapenc='http://schemas.xmlsoap.org/soap/encoding/'
xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'
xmlns='http://schemas.xmlsoap.org/wsdl/'>

<message name='AddWidgetRequest'>
<part name='Auth_Username' type='xsd:string'/>
<part name='Auth_Password' type='xsd:string'/>
<part name='Widget_Name' type='xsd:string'/>
<part name='Widget_Description' type='xsd:string'/>
</message>
<message name='AddWidgetResponse'>
<part name='Result' type='xsd:string'/>
</message>

<portType name='AddWidgetPortType'>
<operation name='AddWidget'>
<input message='tns:AddWidgetRequest'/>
<output message='tns:AddWidgetResponse'/>
</operation>
</portType>

<binding name='AddWidgetBinding' type='tns:AddWidgetPortType'>
<soap:binding style='rpc'
transport='http://schemas.xmlsoap.org/soap/http'/>
<operation name='AddWidget'>
<soap:operation soapAction='urn:xmethods-delayed-quotes#AddWidget'/>
<input>
<soap:body use='encoded' namespace='urn:xmethods-delayed-quotes'
encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
</input>
<output>
<soap:body use='encoded' namespace='urn:xmethods-delayed-quotes'
encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
</output>
</operation>
</binding>

<service name='AddWidgetService'>
<port name='AddWidgetPort' binding='tns:AddWidgetBinding'>
<soap:address location='https://www.yoursite.com/en/Soap_Server.html'/>
</port>
</service>
</definitions>

关于PHP SoapClient __getFunctions() 返回未知类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7486703/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com