rpcliteral SOAP不支持命名空间.包装器元素必须是不合格的

本文关键字:元素 不合格 包装 literal SOAP 不支持 命名空间 rpc | 更新日期: 2023-09-27 18:27:58

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

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

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

假设我使用错误的参数getCalculation调用服务,得到JSON响应JSONException。问题是,Visual Studio抛出异常There was an error reflecting 'JSONException'.,并作为InnerException:{"Namespace='http://service.ecommerce.cetelem.hu/' is not supported with rpc''literal SOAP. The wrapper element has to be unqualified."}

这是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作为用户的"前端"。

谢谢你的回答!

rpcliteral SOAP不支持命名空间.包装器元素必须是不合格的

我最终明白了这一点,但在.net 中另一篇关于SO:SOAP请求的文章的帮助下

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

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

收件人:

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