肥皂发布失败 [英] Soap Post Failure

查看:94
本文介绍了肥皂发布失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我正在尝试使用肥皂与Web服务通信并出现错误.令人沮丧的是,该问题与Web服务的本地副本完全兼容(是的,我尝试关闭防火墙),并且以前与Web服务和客户端的早期版本兼容.我怀疑我可以(尽管我必须查看如何执行此操作)将操作参数添加到客户端发送的内容中.但是,我很好奇为什么以前不用它就能工作.

So, I'm trying to use soap to communicate with a webservice and getting errors. What is frustrating about this particular issue is that it works perfectly fine with my local copy of the webservice (yes, I tried turning off my firewall) and used to work fine with a previous version of the webservice and client. I suspect I could (though I'll have to look up how to do this) add an action parameter to what the client is sending. However, I am very curious why it was able to work previously without one.

编辑说明:我认为,相关代码在停止工作和工作之间是相同的(因为我检查了该程序的旧版本并拥有相同的问题和相关的代码是相同的...除非我错过了一些细微的东西).我知道,即使本地副本和远程副本仅在本地运行,实际的服务器程序也相同.因此,我怀疑有些奇怪的配置设置可以更改以使其起作用.

Edit Clarification: I think the relevant code was the same between when it stopped working and when it worked (since I checked against an old version of the program and had the same problems and the relevant code was the same...unless I missed something subtle). I know the actual server program is the same on both the local copy and the remote copy, even though it only works locally. I thus suspect there is some sort of weird configuration setting I can change to make it work.

错误消息:"soap:ClientUnable无法处理没有有效动作参数的请求.请提供有效的soap动作."

Error message: "soap:ClientUnable to handle request without a valid action parameter. Please supply a valid soap action."

VB客户代码

'WEB_SERVICE_URL_CONST = http://site.com/foo.asmx
'domDoc.xml = <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><TestConnection xmlns="http://site.com"/></soap:Body></soap:Envelope>

Dim oXml As New XMLHTTPRequest
oXml.Open "POST", WEB_SERVICE_URL_CONST, False, "\"
oXml.setRequestHeader "Content-Type", "text/xml"
oXml.send domDoc.xml

C#服务器代码

[WebMethod]
        public int TestConnection()
        {
            return 1;
        }

推荐答案

问题出在 xmlns ="http://site.com" 代码上.在本地测试时,我错误地使用了 xmlns ="http://localhost" .实际上,无论我在哪里测试,都不应在客户端或服务器上更改此名称(在服务器上,此名称为 WebService(Namespace = ...)).它确实发生了变化,客户端和服务器需要匹配.

The problem was with the xmlns="http://site.com" code. When I tested locally, I was using xmlns="http://localhost" by mistake. In fact, this should not be changed on the client or the server (in the server, this would be WebService(Namespace =...)), regardless of where I am testing...but if it does change, the client and server need to match.

这篇关于肥皂发布失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆