为信封设置namepsace并在标记

时间:2017-07-12 15:27:13

标签: c# xml soap

SOAP服务要求我发送这样一种XML信封格式:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://myNamespace.com">
    <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <typ:pushData>
            ...

但我的客户发送的内容如下:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <pushData xmlns="http://myNamespace.com">
            ...

我的客户发送的步骤如下:

pushDataResp = ServiceProxyProvider<IServiceBinding>.Invoke(Program.ServiceEndpoint, x => x.pushData(xxx, yyy));

[ServiceContract(Namespace = "http://myNamespace.com")]
public interface IServiceBinding
{
    [OperationContract]
    [FaultContract(typeof(ServiceException), Action = "", Name = "ServiceException")]
    [XmlSerializerFormat(SupportFaults = true)]
    int pushData(Xxx xxx, Yyy yyy);
}

如何在C#代码中实现请求的格式?

0 个答案:

没有答案