0

我有一个网站,其中包含一个在某些点发出各种 SOAP 请求的表单。其中一个请求获取返回的诱导时间列表并将其显示给用户,以便他们选择一个。我从 SOAP 服务返回的结果很好,但不幸的是,它似乎没有正确显示信息,甚至根本没有显示返回的对象键。我已经与 SOAP 端的一位开发人员联络,他说服务很好并且吐出 cirrect 信息。他提供了一个截图:

在此处输入图像描述

这是我调用此信息所需的方法的代码:

public function getInductionTimes($options) {
        $client = $this->createSoapRequest();
        $inductionTimes = $client->FITinductionlist($options);
        //die(print_r($inductionTimes));
        return $inductionTimes;
    }

    private function createSoapRequest() {
        $url = 'https://fitspace.m-cloudapps.com:444/FITSPACE/MHservice.asmx?WSDL';
        $options["connection_timeout"] = 25;
        $options["location"] = $url;
        $options['trace'] = 1;
        $options['style'] = SOAP_RPC;
        $options['use'] = SOAP_ENCODED;

        $client = new SoapClient($url, $options);
        //die(print_R($client->__getFunctions()));
        return $client;
    }   

如您所见,我在收到代码后立即打印代码以检查我收到的内容,它是这样的:

在此处输入图像描述

正如你所看到的,这个 IDdtstring 字段被完全忽略了。有没有人知道为什么会发生这种情况?它与编码有关吗?我似乎无法解决这个问题!谢谢

4

2 回答 2

0

我能够使用您的基本代码正确检索字段,包括 IDdtstring。也许您没有正确发送参数?

function getInductionTimes($options) {
    $client = createSoapRequest();
    $inductionTimes = $client->FITinductionlist($options);
    die(print_r($inductionTimes));
    return $inductionTimes;
}

function createSoapRequest() {
    $url = 'https://fitspace.m-cloudapps.com:444/FITSPACE/MHservice.asmx?WSDL';
    $options["connection_timeout"] = 25;
    $options["location"] = $url;
    $options['trace'] = 1;
    $options['style'] = SOAP_RPC;
    $options['use'] = SOAP_ENCODED;

    $client = new SoapClient($url, $options);
    //die(print_R($client->__getFunctions()));
    return $client;
}

getInductionTimes(array("IDDate" => "2013-06-28T13:00:00+01:00", "GYMNAME" => "Bournemouth"));
于 2013-06-24T16:42:26.117 回答
0

我设法通过将代码行添加到我的 SOAP 选项数组中来解决这个问题,然后我认为这是我的 WSDL 被缓存在 PHP 中的问题:

$options['cache_wsdl'] = WSDL_CACHE_NONE;

于 2013-06-25T09:13:15.237 回答