【问题标题】:ASMX webserive not recieving parameters from classic ASP soap request.ASMX Web 服务未接收来自经典 ASP soap 请求的参数。
【发布时间】:2013-12-02 17:27:02
【问题描述】:

我正在尝试包装一个较新的 .net ASMX Web 服务,以便它可以被较旧的经典 asp 应用程序使用。为此,我找到了一些发送肥皂请求的代码。但是在我的测试中,似乎我的参数都没有到达服务器。

服务器测试代码

   <WebMethod()> _
    Public Function Ping1(str As String)
        If str <> "" Then
            Return str
        Else
            Return "False"
        End If
    End Function

正在发送的 xml:

<?xml version="1.0" encoding="utf-8"?>
<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">
  <soap12:Body>
    <Ping1 xmlns="http://tempuri.org">
      <str>asdf</str>
    </Ping1>
  </soap12:Body>
</soap12:Envelope>

页面不断返回“False”,但据我所知,这应该是发送参数的正确格式。任何帮助,将不胜感激。

【问题讨论】:

  • 您是否还设置了正确的标题,如here 所示?如果是这样,请尝试将命名空间从 tempuri.org 更改为其他名称。
  • 成功了,只是不能使用 tempuri,现在我如何将问题标记为已回答:-/(第一篇)
  • 您可以将答案标记为已接受,只是添加了一个。

标签: web-services soap asp-classic parameter-passing asmx


【解决方案1】:

正如this other question 中所展示的,您应该在使用服务时设置正确的标头:

oXmlHTTP.setRequestHeader "Content-Type", "application/soap+xml; charset=utf-8" 
oXmlHTTP.setRequestHeader "SOAPAction", "http://ourNameSpace/Ping1"

注意你不能使用tempuri.org命名空间,你还必须设置你自己的命名空间。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-02-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-24
    相关资源
    最近更新 更多