1

网络服务代码(ASP.NET 2.0):

[WebMethod]
[return: XmlElement("TestMe")]
public string TestMe(int value)
{
  return value.ToString();
}

将导致此响应:

<?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>
    <TestMeResponse xmlns="http://example.org/WebServiceTest">
      <TestMe>7499</TestMe>
    </TestMeResponse>
  </soap:Body>
</soap:Envelope>

如果我将它保存为 XML 文件,在Liquid XML Studio中打开它并尝试验证它,我会收到以下错误消息:

Could not find schema information for the element 'http://example.org/WebServiceTest:TestMeResponse'.
Could not find schema information for the element 'http://example.org/WebServiceTest:TestMe'

那么如何添加正确的命名空间和/或架构以进行正确验证?

我的 WSDL ...asmx?WSDL 包括 TestMeResponse 和 TestMe 元素的模式定义,但我如何将它放入响应中?

4

1 回答 1

1

您不会将架构放入响应中。它在 WSDL 中。您需要从 WSDL 中提取模式(或模式)以供 Liquid XML 看到。

于 2009-04-02T01:19:49.947 回答