【发布时间】:2013-08-16 09:12:01
【问题描述】:
我目前正在与一家租赁服务提供商进行集成,该服务提供商运行(我假设)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 用于用户“前端”。
谢谢大家的回答!
【问题讨论】:
-
无法理解这是 json 还是 xml 服务。对于 json - 可能想要使用 web api 或者只是发送原始 json。对于 xml - 您可以通过使用“添加 Web 引用”而不是“添加服务引用”来使用 .net 2 Web 服务
-
感谢您的评论。问题是,服务是用 WSDL 定义的,但它返回 JSON。
标签: c# .net wcf soap asp.net-web-api