Rumah > pembangunan bahagian belakang > tutorial php > php怎么调用.NET开发的webservice

php怎么调用.NET开发的webservice

WBOY
Lepaskan: 2016-06-13 10:36:03
asal
1148 orang telah melayarinya

php如何调用.NET开发的webservice
接口地址是:http://pi.f3.cn/F3WebService.asmx

要调用的方法是:

SendSMS 
短信发送 

大家看看短信接口应该怎么写?我老是调用不成功

我先说明下我的代码:

PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><?phpclass SendSMSParam{        public $ToUserText;     public $ToUserByte;     public $SMSContent;    public $PlanSendTime;    public $MSGType;     public $LongCode;}class SendSMS{    public $SMSParam;    public $ECECCID;    public $Password;}$userid=1234567;//接入账户$pwd="abcdefg";//接入密码$mobile="13800000000";//下发手机号$content="php测试短信";$client=new SoapClient("http://pi.f3.cn/F3WebService.asmx?WSDL");$SMSParam = new SendSMSParam();$SMSParam->ToUserText=$mobile;$SMSParam->SMSContent=$content;$SMSParam->MSGType=5;$SendSMSinfo=new SendSMS();$SendSMSinfo->SMSParam=$SMSParam;$SendSMSinfo->ECECCID=$userid;$SendSMSinfo->Password=$pwd;print_r($SendSMSinfo);$client->SendSMS($SendSMSinfo);?>
Salin selepas log masuk


------解决方案--------------------
Fatal error: Uncaught SoapFault exception: [soap:Client] 服务器无法读取请求。 ---> XML 文档(2, 268)中有错误。 ---> 字符串“”不是有效的 AllXsd 值。 in
.....php:34 Stack trace: #0
.....php(34): SoapClient->__call('SendSMS', Array) #1 
.....php(34): SoapClient->SendSMS(Object(SendSMS)) #2
------解决方案--------------------
C/C++ code
<element minoccurs="0" maxoccurs="1" name="SMSParam" type="tns:SendSMSParam"></element><element minoccurs="1" maxoccurs="1" name="ECECCID" type="s:long"></element><element minoccurs="0" maxoccurs="1" name="Password" type="s:string"></element><complextype name="SendSMSParam"><sequence><element minoccurs="0" maxoccurs="1" name="ToUserText" type="s:string"></element><element minoccurs="0" maxoccurs="1" name="ToUserByte" type="s:base64Binary"></element><element minoccurs="0" maxoccurs="1" name="SMSContent" type="s:string"></element><element minoccurs="1" maxoccurs="1" name="PlanSendTime" type="s:dateTime"></element><element minoccurs="1" maxoccurs="1" name="MSGType" type="tns:c"></element><element minoccurs="0" maxoccurs="1" name="LongCode" type="s:string"></element></sequence></complextype><simpletype name="MSGType"><restriction base="s:string"><enumeration value="NoSMS"></enumeration><enumeration value="ShortSMS"></enumeration><enumeration value="LongSMSNoPageNum"></enumeration><enumeration value="LongSMSWithPageNum"></enumeration><enumeration value="LongSMS"></enumeration><enumeration value="WAPPush"></enumeration><enumeration value="MMS"></enumeration><enumeration value="NMS"></enumeration></restriction></simpletype><div class="clear">
                 
              
              
        
            </div>
Salin selepas log masuk
Label berkaitan:
sumber:php.cn
Kenyataan Laman Web ini
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
Tutorial Popular
Lagi>
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan