gpt4 book ai didi

php - RPC/Literal Procedure 不存在

转载 作者:搜寻专家 更新时间:2023-10-31 22:12:18 24 4
gpt4 key购买 nike

我目前正在尝试提供基于 SOAP RPC/Literal 的 Web 服务。
这是我的 WSDL 文件:

<?xml version="1.0" encoding="iso-8859-1"?>
<!--WSDL genere permettant de decrire le service web.-->
<!--Partie 1 : Definitions-->
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" name="WSDL" targetNamespace="http://soap.mycompany.org/wsdl/" xmlns:typens="http://soap.mycompany.org/wsdl/" 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/">
<!--partie 2 : Types-->
<types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://soap.mycompany.org/wsdl/">
<xsd:complexType name="calculatorAuthInput">
<xsd:annotation>
<xsd:documentation>^CSoapHandler-calculatorAuth^</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="operation" type="xsd:string">
<xsd:annotation>
<xsd:documentation>^CSoapHandler-calculatorAuth-operation^</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="entier1" type="xsd:integer">
<xsd:annotation>
<xsd:documentation>^CSoapHandler-calculatorAuth-entier1^</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="entier2" type="xsd:integer">
<xsd:annotation>
<xsd:documentation>^CSoapHandler-calculatorAuth-entier2^</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="calculatorAuthOutput">
<xsd:sequence>
<xsd:element name="result" type="xsd:integer">
<xsd:annotation>
<xsd:documentation>^CSoapHandler-calculatorAuth-result^</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</types>
<!--partie 3 : Message-->
<message name="calculatorAuthRequest">
<part name="parameters" type="typens:calculatorAuthInput"/>
</message>
<message name="calculatorAuthResponse">
<part name="parameters" type="typens:calculatorAuthOutput"/>
</message>
<!--partie 4 : Port Type-->
<portType name="MyPort">
<!--partie 5 : Operation-->
<operation name="calculatorAuth">
<input message="typens:calculatorAuthRequest"/>
<output message="typens:calculatorAuthResponse"/>
</operation>
</portType>
<!--partie 6 : Binding-->
<binding name="MyBinding" type="typens:MyPort">
<soap:binding xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="calculatorAuth">
<soap:operation xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" soapAction=""/>
<input name="calculatorAuthRequest">
<soap:body xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" use="literal"/>
</input>
<output name="calculatorAuthResponse">
<soap:body xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" use="literal"/>
</output>
</operation>
</binding>
<!--Partie 7 : Service-->
<service name="MyService">
<documentation>Documentation du WebService</documentation>
<!--partie 8 : Port-->
<port name="MyPort" binding="typens:MyBinding">
<soap:address xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" location="http://localhost/mywebsite/?login=1&amp;username=myusername&amp;password=mypassword&amp;m=webservices&amp;a=soap_server&amp;class=CSoapHandler&amp;suppressHeaders=1"/>
</port>
</service>
</definitions>

我以为一切都是正确的,但似乎不是因为我在启动 SOAP 客户端时遇到了这个错误(我在 soapUI 上遇到了同样的错误):

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Server</faultcode>
<faultstring>Procedure 'calculatorAuth' not present</faultstring>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

这是我的 SOAP 客户端示例代码:

<?php   
// Désactivation du cache WSDL
ini_set("soap.wsdl_cache_enabled", "0");

$client = new SoapClient("http://localhost/mywebsite/index.php?login=myusername:mypassword=webservices&a=soap_server&class=CSoapHandler&wsdl&wsdl_mode=CWSDLRPCLiteral", array("trace" => true));
try {
echo "<pre>";
$res = $client->calculatorAuth(array("operation" => "add", "entier1" => 888, "entier2" => 987654321));
print_r($res);
}
catch (SoapFault $e) {
echo $e;
}
?>

我不明白为什么找不到我的程序。我徒劳地花了几个小时来搜索我的 WSDL 中的问题所在。
我还没有真正试验过这些技术,也许有人可以给我一个外部观点?

最佳答案

你没有 <xsd:complexType name="calculatorAuth">在你的任何地方 <types>声明??您似乎正在尝试调用不存在的方法。

关于php - RPC/Literal Procedure 不存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11557715/

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