Wow*_*wca 6 .net c# 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/' 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>
Run Code Online (Sandbox Code Playgroud)
如果这有任何帮助,我将WebAPI
用于用户"前端".
谢谢你的所有答案!
我最终想出了这个问题,但是在SO的另一个帖子的帮助下:.net中的SOAP请求
我需要在服务refence文件中更改的是:
[System.ServiceModel.XmlSerializerFormatAttribute(Style = System.ServiceModel.OperationFormatStyle.Rpc, SupportFaults = true)]
Run Code Online (Sandbox Code Playgroud)
至:
[System.ServiceModel.XmlSerializerFormatAttribute(Style = System.ServiceModel.OperationFormatStyle.Document, SupportFaults = true)]
Run Code Online (Sandbox Code Playgroud)