我是PHP的SOAP请求和响应新手,我正在使用充值API。 API提供商给了我以下XML(我使用的是Arzoo API提供商)。
<MobileRechargeRequest>
<Clientid>Given By Arzoo</Clientid>
<Clientpassword>Given By Arzoo</Clientpassword>
<ClientType>ArzooFWS1.1</ClientType>
<ServiceProvider>AIRTEL-TopUp</ServiceProvider>
<ServiceProviderId>1</ServiceProviderId>
<Rechrgeamount>100.0</Rechrgeamount>
<SubscriberID>9876543210</SubscriberID>
<PartnerReferenceId>123456</PartnerReferenceId>
</MobileRechargeRequest>
他们说这是SOAP API,如何将此请求发送到他们的URL: -
http://demo.arzoo.com/ArzooWS/services/MobileRecharge?wsdl
在PHP中使用SOAP。 我试过下面的代码
$soapclient = new \SoapClient('http://demo.arzoo.com/ArzooWS/services/MobileRecharge?wsdl');
//Use the functions of the client, the params of the function are in
//the associative array
$params = array('CountryName' => 'Spain', 'CityName' => 'Alicante');
$response = $soapclient->getMobileDetails('<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope/" soap:encodingStyle="http://www.w3.org/2003/05/soap-encoding">
<soap:Body>
<getMobileDetails xmlns="http://demo.arzoo.com/ArzooWS/services/MobileRecharge">
<MobileRechargeRequest>
<Clientid>77743781</Clientid>
<Clientpassword>******</Clientpassword>
<Clienttype>ArzooFWS1.1</Clienttype>
<ServiceProvider>AIRTEL-TopUp</ServiceProvider>
<ServiceProviderId>1</ServiceProviderId>
<Rechrgeamount>100.0</Rechrgeamount>
<SubscriberID>9164995714</SubscriberID>
<PartnerReferenceId>123456</PartnerReferenceId>
</MobileRechargeRequest> </getMobileDetails> </soap:Body></soap:Envelope>');
var_dump($response);
如果我在SOAP XML请求中有错误
,请帮助我