公司做了一个饮食类的问题,测试好了几家短信接口,最后选择了56 短信网的短信接口(网址是:http://www.56dxw.com),为找一个短信接口,我们公司整理测试了一个月,主要是看稳定性和速度方面吧,觉得它们公司的不错,就选择它们公司了,因为公司总部将投入资金去推广这个网站,短信接口起到了非常重要的作用,所以,我们公司这一块比较慎重,选择短信接口就选择了很长的时间,我看过它们公司的接口文档,觉得接入应该比较简单的,所以,答应领导明天能把接口这一块弄好,现在让我郁闷的是,我调用它们的http的接口没有问题,但调用asp.net webservers的,老是出来 出错:服务器未能识别 HTTP 头 SOAPAction 的值
这个问题,找了很久没有找到原因,我问过我那个朋友,调用它们公司的也是webservers的,它的就可以,我的为啥不行呢
这是我写的一个调用56短信网webservers的例子,//网址:http://www.56dxw.com<?php
//短信接口测试程序
//$url = "http://jiekou.56dxw.com/sms/HttpInterface.aspx";
$webService_url = "http://jiekou.56dxw.com/WebServiceInterface.asmx";
$comid= "123"; //企业ID
$username= "test1"; //用户名
$userpwd= "99999"; //密码
$smsnumber= "1061"; //所用平台
$handtel= "1313131312"; //手机号
$sendcontent= "测试成功!success!"; 
$sendtime= ""; //定时时间
header("content-type:text ml;charset=utf-8");
require_once('nusoap/nusoap.php');
$soap = new soapclient($webService_url.'?WSDL', true); //web service 地址
$soap->soap_defencoding = 'utf-8';
$soap->decode_utf8 = false;
$result = $soap ->call("SendNote",array("handtels" => $handtel,"_content"=>$sendcontent, "userName"=> $username , "password"=>$userpwd , "cid"=>$comid, "_sendtime"=>"" , "_smsnumber"=>$smsnumber ));
if ($soap->fault) {
echo '<h2>Fault</h2><pre>';
print_r($result);
echo '</pre>';
} else {
// Check for errors
$err = $soap->getError();
if ($err) {
  // Display the error
  echo '<h2>Error</h2><pre>' . $err . '</pre>';
} else {  echo '<h2>Result</h2><pre>';
  print_r($result);
  echo '</pre>';
}
}
请高手帮助一下吧,明天急用呢.........

解决方案 »

  1.   


    <?php
    include_once('nusoap.php');
    $url="http://jiekou.56dxw.com/WebServiceInterface.asmx?WSDL";
    $type= "WSDL";
    $charset="utf-8";
    $param=array(
    'handtels'=> "1313131312",//手机号
    '_content'=> "hello", 
    'userName'=> "test1", //用户名
    'password'=> "99999", //密码
    'cid'=> "123", //企业ID
    '_sendtime'=> "", //定时时间
    'smsnumber'=> "1061", //所用平台
    );$client = new nusoap_client($url,$type);
    if($err = $client->getError()) exit($err);
    $client->soap_defencoding = $charset;
    $client->decode_utf8 = false;
    $client->xml_encoding = $charset;
    $result = $client->call("SendNote",$param,'','',false,true);print_r($result);
    ?>