我目前正在与租赁服务提供商进行集成,该提供商运行(我假设)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/