Ariyan
Ariyan

Reputation: 15158

Passing tns:ArrayOfString to SOAP client

I'm trying to use the api from this service:

http://messagingws.payamservice.ir/SendSMS.asmx?WSDL

I'm using the php's SOAP client like this:

$client = new SoapClient("http://messagingws.payamservice.ir/SendSMS.asmx?WSDL");

$params=array();
$params['PortalCode']='code';
$params['UserName']='user';
$params['PassWord']='pass';
$params['Mobiles']=array('09123456789');
$params['Messages']=array('test');
$params['FlashSMS']=false;
$params['ServerType']=1;

$response = $client->__soapCall('MultiSMSEngine', array($params));

but I get "empty message" error, when I try with single mode it works correctly so it seems the problem is with Mobiles & Messages parameters that are tns:ArrayOfString

How can I correctly pass an array as tns:ArrayOfString for SOAP ?

thanks

Upvotes: 1

Views: 1434

Answers (1)

Mikaël DELSOL
Mikaël DELSOL

Reputation: 760

First, you can call the method such as $client->MultiSMSEngine($params) instead of $client->__soapCall('MultiSMSEngine', array($params));.

If you keep your form of call, try $client->__soapCall('MultiSMSEngine', $params);

Finally, to ease you the call to any SOAP Web Service, I strongly advise you to use a WSDL to php generator such as PackageGenerator

Upvotes: 1

Related Questions