- 论坛徽章:
- 0
|
本帖最后由 loveme99 于 2012-01-10 15:31 编辑
一个发短信的webservices 用php的soap 访问,由于不懂用法,求助
服务器端 http://202.96.188.86:8081/sxt_webservice/services/SMSService?wsdl程序应该怎么写,我写的这样的- <?php
- header("content-type:text/html; charset=utf-8");
- $client = new SoapClient ( 'http://202.96.188.86:8081/sxt_webservice/services/SMSService?wsdl', array('trace' => 1,'encoding'=>'utf-8'));
- $headers[] = new SoapHeader('http://soapinterop.org/echoheader/', 'soapenv');
- $headers[] = new SoapHeader('http://www.w3.org/2001/XMLSchema', 'xsd');
- $headers[] = new SoapHeader('http://www.w3.org/2001/XMLSchema-instance', 'xsi');
- $headers[] = new SoapHeader('http://www.muleumo.org', 'mul');
- $headers[] = new SoapHeader('http://message.scape.gsta.com', 'mes');
- $headers[] = new SoapHeader('http://sms.cap.scape.gsta.com', 'sms');
- $client->__setSoapHeaders($headers);
- //$CII[] = new SoapParam("account", 'account');
- //$CII[] = new SoapParam('','$extendField');
- //$CII[] = new SoapParam('','$hashCode');
- //$CII[] = new SoapParam( "111111",'password');
- //$CII[] = new SoapParam('','$timestamp');
- //$str = $client -> sendSMS($CII,$BUI,$SMSPayload);
- //$t = $client
- class CII{
- public $account = '0760tljtyp';
- public $extendField = '';
- public $hashCode = '';
- public $password = '11111';
- public $timestamp = '';
- }
- class BUI{
- public $account = '';
- public $id = '';
- }
- class SMSPayload{
- public $content = 'test';
- public $contentFormat = '1';
- public $needFeedback = '1';
- public $password = '';
- public $receivers = array('13545685468');
- public $areacode = '';
- public $sender = '';
- }
- $CII = new CII();
- $in0_0 = new SoapVar($CII, SOAP_ENC_OBJECT,'mul');
- $in0 = new SoapParam($in0_0, 'in0');
- print_r($in0);
- $BUI = new BUI();
- $in1_0 = new SoapVar($CII, SOAP_ENC_OBJECT,'sendSMS');
- $in1 = new SoapParam($in1_0, 'in1');
- $SMSPayload = new SMSPayload();
- $in2_0 = new SoapVar($SMSPayload, SOAP_ENC_OBJECT,'sendSMS');
- $in2 = new SoapParam($in2_0, 'in2');
- $param = array(
- 'in0' => $in0,
- 'in1' => $in1,
- 'in2' => $in2,
- );
- $str = $client -> sendSMS(array('parameters' => $params));
- //array('parameters' => $params)
- //echo $client-> sendSMSResult;
- echo '<pre>';
- print_r( $str );
- echo '</pre>';
- echo '<pre>';
- var_dump ($client->__getLastRequest());
- echo '</pre>';
- die();
复制代码 结果总是出错,求助懂的大侠,该如何写呢?最主要是参数怎么样传递,命名空间又怎么样定义,真的头痛 |
|