从经典 ASP 中使用 Rest Wcf
您好,需要将一些数据发布到 Rest Wcf 服务。 我费了很大的劲才在网上获得了一些帮助。 但是当我运行我的 asp 页面时,我收到以下错误。 “错误:WSDL 参数的处理失败。错误:运行 WSDL 导入扩展时引发异常:System.ServiceModel.Description.DataContractSerializerMessageContractImporter 错误:无法使用目标命名空间 -http://tempuri.org/- 的架构成立。” 知道我在这里犯了什么错误。我非常感谢你的帮助。 这是我的 asp 页面代码
<%
Dim wsdl, moniker, obj
wsdl = GetWsdlFromUrl("http://www.mysite.com/wcf/Service1.svc?wsdl")
moniker = "service:wsdl=" & wsdl & ", "
moniker = moniker + "http://www.mysite.com/wcf/Service1.svc,"
moniker = moniker + "contract=wcfservice1.IService1, "
moniker = moniker + "contractNamespace=http://tempuri.org/, "
moniker = moniker + "binding=webHttpBinding, "
moniker = moniker + "bindingNamespace=http://tempuri.org/"
Set objProxy = GetObject(moniker)
Dim str
str = objProxy.GetData()
`
Function GetWsdlFromUrl(strUrl)
Dim winHttpReq, resp
Set winHttpReq = CreateObject("WinHttp.WinHttpRequest.5.1")
resp = winHttpReq.Open("GET", strUrl, False)
winHttpReq.Send
GetWsdlFromUrl = winHttpReq.ResponseText
End Function
%>
<html>
Hello world:
</html>
Hi Need to post some data to a Rest Wcf Service.
With great difficulty I managed to get some help online.
But when I run my asp page I am getting the follwing error.
"Error: The processing of the WSDL parameter failed. Error: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter Error: Schema with target namespace -http://tempuri.org/- could not be found."
Any idea what mistake I am doing here.I really appreciate your help.
Here is my code for the asp page
<%
Dim wsdl, moniker, obj
wsdl = GetWsdlFromUrl("http://www.mysite.com/wcf/Service1.svc?wsdl")
moniker = "service:wsdl=" & wsdl & ", "
moniker = moniker + "http://www.mysite.com/wcf/Service1.svc,"
moniker = moniker + "contract=wcfservice1.IService1, "
moniker = moniker + "contractNamespace=http://tempuri.org/, "
moniker = moniker + "binding=webHttpBinding, "
moniker = moniker + "bindingNamespace=http://tempuri.org/"
Set objProxy = GetObject(moniker)
Dim str
str = objProxy.GetData()
`
Function GetWsdlFromUrl(strUrl)
Dim winHttpReq, resp
Set winHttpReq = CreateObject("WinHttp.WinHttpRequest.5.1")
resp = winHttpReq.Open("GET", strUrl, False)
winHttpReq.Send
GetWsdlFromUrl = winHttpReq.ResponseText
End Function
%>
<html>
Hello world:
</html>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论