我在任务中使用laravel和Soap Webservice。
这是我到目前为止尝试过的。当我想显示基于AppNo id的数据时,它起作用。
我的问题是我想在刀片文件的表中显示来自Web服务的所有数据。
$this->soapWrapper->add('MOMDSRA', function ($service) {
$service
->wsdl('http://192.168.0.xxx/xxx/MMxxx.asmx?WSDL')
->trace(true)
->cache(WSDL_CACHE_NONE)
//->customHeader($myheader)
->header('http://www.w3.org/2001/XMLSchema-instance', 'Action', 'http://tempuri.org/MMxxx')
->options([
'login' => 'xx',
'password' => 'xx'
])
->classmap([
MOMBsc::class,
MOMDSRCResponse::class,
]);
});
$response = $this->soapWrapper->call('MOMDSRA.MMxxx', [
[
'AppNo' => '434648b7ad8d46dd9f2944ad8a07d737',
'txnCode' => 'ST003',
'ActCode' => 'R',
'usr' => 'xxx',
'pwd' => 'ccc',
]
]);
foreach ($response as $key => $object) {
$AppNo = $object->AppNo;
$ApvAm = $object->ApvAm;
}
var_dump($response);
dd($response);
exit;
然后我在下面尝试了此代码,但它仅显示没有值的列,如下面的pict
$options = array(
'soap_version'=>SOAP_1_1,
'exceptions'=>true,
'trace'=>1,
'cache_wsdl'=>WSDL_CACHE_NONE
);
$client = new SoapClient("http://192.xxx.0.xxx/xxx/xxx.asmx?WSDL", $options);
$questionTargetGroup = array (
'txnCode' => 'ST003',
'ActCode' => 'R',
'usr' => 'xxx',
'pwd' => 'xx',
);
$response = $client->MOMCallStat($questionTargetGroup, 2, 0, 0, "passstring");
print_r($response);
请帮助我