宽乐通信回调.net webservice问题? 按它的接口文档写了相应的调用后,还是无法实现调用,返回的是500错误。但是我们用java和.net的程序来实现调用也没有问题,不知何解?文档如下:http://wenku.baidu.com/view/c84059c30c22590102029d44.html 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你的回调方法有没有定义一个string 参数 connID,看起来人家是要求这么定义的。 connID 这个是用于后面发送短信的。发送的时候通过注册设置好回调网址,接收的时候是不需要的:String recvSMS(String caller, String time, String cont, String ucNum); 哈,我做过CS的,没有用这种web service方式 CS的应该只能是发送短信吧,接收的必须是webservice才能接收的。 经过仔细查看,发现正确的调用是采用GET模式,而宽乐通是采用POST模式,所以才会有500错误,不过WebService是支持POST方式呀,不知何解? webconfig中加入以下的配置节,试试 <!-- !!!以下用于防止出现js(ajax)中调 webservice 时产生 server error 错误 !!! 按说应当是1.1中才会出现的错误,不知为什么在2.0中也会出现 --> <webServices> <protocols> <add name="HttpSoap"/> <add name="HttpPost"/> <add name="HttpGet"/> <add name="Documentation"/> </protocols> </webServices> 这个是有加的,不过后来查了下不是这个问题,我用GET POST调用都没有问题:POST /WebService/SMS.asmx - 80 - 202.105.212.119 Axis/1.2 500 0 0 7 有问题POST /WebService/SMS.asmx - 80 - 58.248.217.244 - 200 0 0 189 没有问题 POST /WebService/SMS.asmx - 80 - 202.105.212.119 Axis/1.2 500 0 0 7这是什么意思?看不懂。请解释一下。202.105.212.119 是你所谓的回调网址么,为什么两个不一样?那个才是你自己注册的回调网址? 问题的原因找到了,不过暂时还不知如何解决:调用的数据为:<?xml version="1.0" encoding="UTF-8" ?> - <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">- <soapenv:Body>- <EchoOfSendSMS soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <ucNum xsi:type="xsd:string">02080774196</ucNum> <cee xsi:type="xsd:string">13500??????</cee> <msgid xsi:type="xsd:int">1002</msgid> <res xsi:type="xsd:int">1</res> <recvt xsi:type="xsd:string">20101204122400</recvt> </EchoOfSendSMS> </soapenv:Body> </soapenv:Envelope>.NET WebService返回的错误: <?xml version="1.0" encoding="utf-8" ?> - <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">- <soap:Body>- <soap:Fault> <faultcode>soap:Client</faultcode> <faultstring>System.Web.Services.Protocols.SoapException: 无法识别请求元素 <EchoOfSendSMS xmlns=''>。 在 System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest() 在 System.Web.Services.Protocols.SoapServerProtocol.RouteRequest(SoapServerMessage message) 在 System.Web.Services.Protocols.SoapServerProtocol.Initialize() 在 System.Web.Services.Protocols.ServerProtocol.SetContext(Type type, HttpContext context, HttpRequest request, HttpResponse response) 在 System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)</faultstring> <detail /> </soap:Fault> </soap:Body> </soap:Envelope>不知要如何设置才行。 <EchoOfSendSMS soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">发现它的调用缺少xmlns=属性,导至出错,加上后调用就正常了,不过由于调用没有办法改,现在还不知如何处理,真是郁闷。 采取转发的方式实现了,真是郁闷。在中间层补上xmlns=属性值调用就可以了。宽乐通信-->中间层-->WebService。 用.net开发,可以做个代理类,直接调用,我做的是WEB访问用户类型的,本地测试能正常返回random参数和connID 楼主,我也在做这个宽乐的开发。能共享下源码吗?我的邮箱:[email protected]十分感谢 楼主,你的宽乐通信webservice的回调接口怎么写可以共享一下源码吗?[email protected]谢谢! farpoin spread 的问题 asp.net(C#)进行RTX二次开发遇到RTXSAPIRootObj失败的问题 急!!!关于Excel如何导入GridView中遇到的问题 给button添加事件没反应?? 这样显示数据库记录的sql怎么样? RequiredFieldValidator的问题 在外网上运行asp.net程序出错! 关于数据库连接进程的问题! 请问是哪的错 IIS配置问题?? asp.net 如何让全站页面静态 怎么在ashx或者webservice里加载用户控件,然后获取这个用户控件的html?
String recvSMS(String caller, String time, String cont, String ucNum);
!!!以下用于防止出现js(ajax)中调 webservice 时产生 server error 错误 !!!
按说应当是1.1中才会出现的错误,不知为什么在2.0中也会出现
-->
<webServices>
<protocols>
<add name="HttpSoap"/>
<add name="HttpPost"/>
<add name="HttpGet"/>
<add name="Documentation"/>
</protocols>
</webServices>
没有问题
调用的数据为:
<?xml version="1.0" encoding="UTF-8" ?>
- <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <soapenv:Body>
- <EchoOfSendSMS soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<ucNum xsi:type="xsd:string">02080774196</ucNum>
<cee xsi:type="xsd:string">13500??????</cee>
<msgid xsi:type="xsd:int">1002</msgid>
<res xsi:type="xsd:int">1</res>
<recvt xsi:type="xsd:string">20101204122400</recvt>
</EchoOfSendSMS>
</soapenv:Body>
</soapenv:Envelope>
.NET WebService返回的错误: <?xml version="1.0" encoding="utf-8" ?>
- <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <soap:Body>
- <soap:Fault>
<faultcode>soap:Client</faultcode>
<faultstring>System.Web.Services.Protocols.SoapException: 无法识别请求元素 <EchoOfSendSMS xmlns=''>。 在 System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest() 在 System.Web.Services.Protocols.SoapServerProtocol.RouteRequest(SoapServerMessage message) 在 System.Web.Services.Protocols.SoapServerProtocol.Initialize() 在 System.Web.Services.Protocols.ServerProtocol.SetContext(Type type, HttpContext context, HttpRequest request, HttpResponse response) 在 System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)</faultstring>
<detail />
</soap:Fault>
</soap:Body>
</soap:Envelope>不知要如何设置才行。
发现它的调用缺少xmlns=属性,导至出错,加上后调用就正常了,不过由于调用没有办法改,现在还不知如何处理,真是郁闷。
宽乐通信-->中间层-->WebService。
十分感谢
[email protected]
谢谢!