c# - rpc\\literal SOAP 不支持 namespace 。包装器元素必须是不合格的

标签 c# .net wcf soap asp.net-web-api

我目前正在与租赁服务提供商进行集成,该提供商运行(我假设)Java 服务。

当我在 Visual Studio 2012 中添加服务引用时,引用已正确创建,我可以调用服务中指定的方法。

当我收到服务的响应时,问题就出现了。

假设我用错误的参数 getCalculation 调用了服务,我得到了 JSON 响应 JSONException。问题是,Visual Studio 抛出异常 There was an error reflecting 'JSONException'. 和 InnerException: {"Namespace='http://service.ecommerce.cetelem.hu/' rpc\\literal SOAP 不支持。包装器元素必须是非限定的。”

这是 web.config 代码:

<system.serviceModel>  
    <bindings>  
        <basicHttpBinding>  
            <binding name="EcommerceServiceImplPortBinding">  
                <security mode="Transport" />  
            </binding>  
            <binding name="EcommerceServiceImplPortBinding1" />  
        </basicHttpBinding>  
    </bindings>  
    <client>  
        <endpoint address="https://ecomdemo.cetelem.hu:443/ecommerce/EcommerceService"
          binding="basicHttpBinding" bindingConfiguration="EcommerceServiceImplPortBinding"
          contract="CetelemInstallmentsService.EcommerceService" name="EcommerceServiceImplPort" />  
    </client>  
</system.serviceModel>

如果这有任何帮助,我正在为用户“前端”使用 WebAPI

谢谢大家的回答!

最佳答案

我最终想通了这件事,但在另一篇关于 SO 的帖子的帮助下:SOAP Requests in .net

我需要在服务引用文件中更改的是:

[System.ServiceModel.XmlSerializerFormatAttribute(Style = System.ServiceModel.OperationFormatStyle.Rpc, SupportFaults = true)]

收件人:

[System.ServiceModel.XmlSerializerFormatAttribute(Style = System.ServiceModel.OperationFormatStyle.Document, SupportFaults = true)]

关于c# - rpc\\literal SOAP 不支持 namespace 。包装器元素必须是不合格的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18269794/

相关文章:

c# - 存储 .NET 应用程序的用户设置的最佳方式是什么?

c# - 如何创建返回对象属性并具有此属性名称的 lambda 表达式?

c# - 如何在 Windows Phone 8.1 中使用 WCF 服务

c# - 如何通过互联网实现发布/订阅通信

javascript - 使用 WCF 服务的 Angular JS 中的 405(不允许的方法)

c# - Exasol Ado.Net 提供商的自定义连接池

c# - 使用十六进制而不是十进制更有效率吗?

c# - 绑定(bind)到字典的 DataGridView

c# - 将 header 添加到 .Net 3.5 WCF 客户端

c# - NullReferenceException 'Object reference not set to an instance of an object' 统一 2D