2

这真的让我很烦,所以任何帮助都会很棒。对 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
4

1 回答 1

3

尝试禁用缓存:

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

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

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

于 2013-06-10T01:20:47.157 回答