gpt4 book ai didi

php - SOAP WSDL 文件未调用函数

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

这真的让我烦恼,所以任何帮助都会很棒。对 getTerminalEntry 的调用总是返回正常,但是对 updateTicketPrinted 的调用从来没有,我什至使这两个函数在返回和作为参数的内容方面彼此相同。 is_soap_fault() 方法或任何其他方式也没有显示错误。

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions
targetNamespace='http://10.1.10.187/api'
xmlns:tns=' http://10.1.10.187/api'
xmlns:xsd='http://www.w3.org/2001/XMLSchema'
xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'
xmlns='http://schemas.xmlsoap.org/wsdl/'
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:impl="http://10.1.10.187/api">

<wsdl:message name="getTerminalEntryResponse">

<wsdl:part name="entryResponse" type="xsd:string">

</wsdl:part>

</wsdl:message>

<wsdl:message name="getTerminalEntryRequest">

<wsdl:part name="terminalId" type="xsd:string">

</wsdl:part>

</wsdl:message>

<wsdl:message name="updateTicketPrintedResponse">

<wsdl:part name="ticketResponse" type="xsd:string">

</wsdl:part>

</wsdl:message>

<wsdl:message name="updateTicketPrintedRequest">

<wsdl:part name="ticketId" type="xsd:string">

</wsdl:part>

</wsdl:message>

<wsdl:portType name="TerminalApi">

<wsdl:operation name="getTerminalEntry">

<wsdl:input message="impl:getTerminalEntryRequest" name="getTerminalEntryRequest">

</wsdl:input>

<wsdl:output message="impl:getTerminalEntryResponse" name="getTerminalEntryResponse">

</wsdl:output>

</wsdl:operation>

<wsdl:operation name="updateTicketPrinted">

<wsdl:input message="impl:updateTicketPrintedRequest" name="updateTicketPrintedRequest">

</wsdl:input>

<wsdl:output message="impl:updateTicketPrintedResponse" name="updateTicketPrintedResponse">

</wsdl:output>

</wsdl:operation>

</wsdl:portType>

<wsdl:binding name="TerminalApiBinding" type="impl:TerminalApi">

<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>

<wsdl:operation name="getTerminalEntry">

<wsdlsoap:operation soapAction=""/>

<wsdl:input name="getTerminalEntryRequest">

<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://10.1.10.187/api" use="encoded"/>

</wsdl:input>

<wsdl:output name="getTerminalEntryResponse">

<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://10.1.10.187/api" use="encoded"/>

</wsdl:output>

</wsdl:operation>

<wsdl:operation name="updateTicketPrinted">

<wsdlsoap:operation soapAction=""/>

<wsdl:input name="updateTicketPrintedRequest">

<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://10.1.10.187/api" use="encoded"/>

</wsdl:input>

<wsdl:output name="updateTicketPrintedResponse">

<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://10.1.10.187/api" use="encoded"/>

</wsdl:output>

</wsdl:operation>

</wsdl:binding>

<wsdl:service name="TerminalApi">

<wsdl:port binding="impl:TerminalApiBinding" name="TerminalApi">
<wsdlsoap:address location="http://10.1.10.187/api_alistair/api/index.php/api"/>
</wsdl:port>

</wsdl:service>
<?php
$client = new SoapClient("http://10.1.10.187/api_alistair/terminal.wsdl");
$catalogId='catalog2';
$result = $client->getTerminalEntry($catalogId);
$result2 = $client->updateTicketPrinted($catalogId);
echo $result;
if (is_soap_fault($result2)) {
trigger_error("SOAP Fault: (faultcode: {$result->faultcode}, faultstring: {$result->faultstring})", E_USER_ERROR);
}else{
echo $result2;
}

?>

任何帮助都会很棒。谢谢。

更新
随着 php 中的错误报告,我得到:
   Fatal error: Uncaught SoapFault exception: [Client] Function ("updateTicketPrinted") is not a valid method for this service in /sites/api_alistair/soap-client.php:7 Stack trace: #0 /sites/api_alistair/soap-client.php(7): SoapClient->__call('updateTicketPri...', Array) #1 /sites/api_alistair/soap-client.php(7): SoapClient->updateTicketPrinted('catalog2') #2 {main} thrown in /sites/api_alistair/soap-client.php on line 7

最佳答案

尝试禁用缓存:

ini_set("soap.wsdl_cache_enabled", "0");

或者使用 __getFunctions() 查看可用的方法:

http://php.net/manual/en/soapclient.getfunctions.php

关于php - SOAP WSDL 文件未调用函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16983449/

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