[英]Php soapClient array method
Im new to php soapclient. 我是php soapclient的新手。 I have been trying to send details and i keep getting an empty response.
我一直在尝试发送详细信息,但我一直收到空响应。
I have this soap details 我有这个肥皂的细节
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<UploadFileNew_XML xmlns="http://tempuri.org/GAPS_Uploader/FileUploader">
<xmlRequest>
<transdetails>
<transactions>
<transaction>
<amount>25000</amount>
<paymentdate>2017/09/07</paymentdate>
<reference>777777</reference>
<remarks>Name</remarks>
<vendorcode>vendor details</vendorcode>
<vendorname>Vendor name</vendorname>
<vendoracctnumber>0212893398</vendoracctnumber>
<vendorbankcode>058152052</vendorbankcode>
</transaction>
</transactions>>
</transdetails>
<customerid>481472280</customerid>
<username>username</username>
<password>password</password>
<hash>'.hash(sha512,'hasdetails','other details').'</hash>
</xmlRequest>
</UploadFileNew_XML>
</soap:Body>
</soap:Envelope>
<?php
try{
define ('WSDL_URL_BAL','http://gtweb.gtbank.com/gaps_fileuploader/fileuploader.asmx?WSDL');
$stringsample = [];
$stringsample['transdetails']['transactions']['transaction']['amount'] = 2500;
$stringsample['transdetails']['transactions']['transaction']['paymentdate'] = '2017/09/07';
$stringsample['transdetails']['transactions']['transaction']['reference'] = 'aaaaaa';
$stringsample['transdetails']['transactions']['transaction']['remarks'] = 'bbbbbbb';
$stringsample['transdetails']['transactions']['transaction']['vendorcode'] = 'cccccccc';
$stringsample['transdetails']['transactions']['transaction']['vendorname'] = 'ddddddd';
$stringsample['transdetails']['transactions']['transaction']['vendoracctnumber'] = '0212893398';
$stringsample['transdetails']['transactions']['transaction']['vendorbankcode'] = '058152052';
$stringsample['customerid'] = '12345';
$stringsample['customerid'] = 'abcdefrggg';
$stringsample['customerid'] = '445566555';
$stringsample['hash'] = 'hash';
$endpoint = WSDL_URL_BAL;
$client = new SoapClient( $endpoint );
$params = array('xmlrequest'=>$stringsample);
$result = $client->UploadFileNew_XML($params);
$data = $result->UploadFileNew_XMLResult;
echo $data.'<br /><br /><br />';
print_r($data); echo '<br /><br /><br />';
} catch (Exception $e) {
$message = 'Error: '. $e->getMessage();
}
echo $message;
?>
kindly help i could not find useful resource online. 请帮助我无法在线找到有用的资源。 Thanks.
谢谢。 I have made modifications to the highlighted comment.
我对突出显示的评论进行了修改。 I dont know if i translated the soap correctly into the array i am parsing.
我不知道我是否将肥皂正确地转换为要解析的数组。
Your code is missing the Whole things it seems like you copied and pasted the source.. So i have just Added the <?php ?>
tags to your Code. 您的代码缺少完整的东西,好像您已复制并粘贴了源代码。.因此,我刚刚在代码中添加了
<?php ?>
标记。
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<UploadFileNew_XML xmlns="http://tempuri.org/GAPS_Uploader/FileUploader">
<xmlRequest>
<transdetails>
<transactions>
<transaction>
<amount>25000</amount>
<paymentdate>2017/09/07</paymentdate>
<reference>777777</reference>
<remarks>Name</remarks>
<vendorcode>vendor details</vendorcode>
<vendorname>Vendor name</vendorname>
<vendoracctnumber>0212893398</vendoracctnumber>
<vendorbankcode>058152052</vendorbankcode>
</transaction>
</transactions>>
</transdetails>
<customerid>481472280</customerid>
<username>username</username>
<password>password</password>
<hash>'.hash(sha512,'hasdetails','other details').'</hash>
</xmlRequest>
</UploadFileNew_XML>
</soap:Body>
</soap:Envelope>
<?php
try{
define ('WSDL_URL_BAL','http://gtweb.gtbank.com/gaps_fileuploader/fileuploader.asmx?WSDL');
$client = new SoapClient( $endpoint );
$params = array('xmlrequest'=>$stringsample);
$result = $client->UploadFileNew_XML($params);
$data = $result->UploadFileNew_XMLResult;
echo $data.'<br /><br /><br />';
print_r($data); echo '<br /><br /><br />';
} catch (Exception $e) {
$message = 'Error: '. $e->getMessage();
}
echo $message;
?>
Now you can try it. 现在您可以尝试一下。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.