然而因为第二步挖的坑
当把webservice处事写好之后,用本地ip测试,完整,没有问题,颁布随处事器端,运行,有问题,无法访谒,无法运行,报错。。。。。。。。。。。。。。
第一步:呈现的问题,云处事器端开放了端口80端口,本身的端口设定的是随意的8083端口,没找到问题,询问了云处事器客服才知道没初步口,上网找资料,将本身设定的端口找到进行开放。
第二步:开了端口,继续用外网访谒,问题依旧,网页报错500.119 没有web.config的访谒权限,解决步伐,,删除了web.config,然后从头运行,会自动生成,依旧无效,查抄所有的webservice文件,权限是让user用户完全控制,但是依旧没有效果,最后,将webservice的文件夹从本身域名指向的处所移动出来,最后好了,怎么解决的很莫名其妙
第三步:可以通过外网访谒本身的webservice上的接口要领了,但是问题又来了,上一篇写的是通过http的post要领进行请求的,点开一个webservice页面上的要领,凡是呈现的是soap1.1 ,soap1.2和http post三个参考请求,然而因为第二步挖的坑,将web.config给删除了,所以默认情况下,没有开放http post请求,解决步伐,最后在网上找到了web.config的配置要领,最后解决:
在运行WebService的网站中找到web.config并改削此文件:
1)找到节点<system.web></system.web>
2)在此节点里插手以下设置:
<webServices>
<protocols>
<add />
<add />
</protocols>
</webServices>
原文链接:https://www.xuebuyuan.com/2146967.html
按照上一篇的步伐告成的请求交换到了数据
按照了解的两种访谒webservice的接口步伐,一种如上一篇
string url= ":8083/WebService1.asmx/Active"; IEnumerator Upload() { WWWForm form = new WWWForm(); form.AddField("code", "89080"); UnityWebRequest request = UnityWebRequest.Post(url, form); yield return request.SendWebRequest(); Debug.Log(request.error); Debug.Log(request.responseCode); Debug.Log(request.downloadHandler.text); }
要领对照简单,
第二种
IEnumerator SoapHandler() { StringBuilder soap = new StringBuilder(); soap.Append("<?xml version=\"1.0\" encoding=\"utf-8\"?>"); soap.Append("<soap12:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap12=\"http://www.w3.org/2003/05/soap-envelope\">"); soap.Append("<soap12:Body>"); soap.Append("<getWeather xmlns=\"http://WebXml.com.cn/\">"); soap.Append("<theCityCode>深圳</theCityCode>"); soap.Append("<theUserID></theUserID>"); soap.Append("</getWeather>"); soap.Append("</soap12:Body>"); soap.Append("</soap12:Envelope>"); WWWForm form = new WWWForm(); var headers = form.headers; headers["Content-Type"] = "text/xml; charset=utf-8"; headers["SOAPAction"] = ""; headers["User-Agent"] = "gSOAP/2.8"; WWW w = new WWW("", Encoding.UTF8.GetBytes(soap.ToString()), headers); yield return w; if (w.isDone) { if (w.error != null) { print(w.error); } else { ParsingXml(w.text, Request_Type.SOAP); } } }
也就是http post和soap post两种不需要dll,
参考链接:https://www.cnblogs.com/fyluyg/p/6047819.html
u3d:关于u3d访谒webservice处事的应用所遇到的问题
温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/file/web/32849.html