我正在修补一个C#Webservice,它从XML文件中读取预定义的SOAP响应。我们使用它来模拟高效的Web服务。 XML文件包含直接子节点''的节点。但是,我当前的代码将一个节点添加到'',从而导致格式错误。
我得到了什么:
<soap:Body>
<Security_AuthenticateResponse xmlns="http://xml.tempuri.com/">
<Security_AuthenticateReply xmlns="http://xml.tempuri.com/VLSSLR_06_1_1A">
<processStatus>
...
</processStatus>
</Security_AuthenticateReply>
</Security_AuthenticateReply>
</soap:Body>
我们需要什么:
<soap:Body>
<Security_AuthenticateReply xmlns="http://xml.tempuri.com/VLSSLR_06_1_1A">
<processStatus>
...
</processStatus>
</Security_AuthenticateReply>
</soap:Body>
我的代码:
[SoapDocumentMethod(Action = "http://webservices.amadeus.com/1ASIWABOAAI/VLSSLQ_06_1_1A",
RequestNamespace = "http://xml.amadeus.com/VLSSLQ_06_1_1A",
RequestElementName = "Security_Authenticate",
ResponseNamespace = "http://xml.amadeus.com/VLSSLR_06_1_1A",
ResponseElementName = "Security_AuthenticateReply")]
[WebMethod]
[return: XmlAnyElement]
[SoapHeader("sessionId", Direction = SoapHeaderDirection.Out)]
public XmlDocument Security_Authenticate()
{
.. some file magic here ...
XmlDocument rp = getFile("Security_AuthenticateReply.xml");
return rp;
}
我希望有一些指令告诉C#删除其中一个节点。作为替代方案,我想我必须提取所有子节点并返回它们。