C#客户端使用java-websphere SOAP服务

时间:2013-07-11 10:45:08

标签: c# java soap websphere

我正在尝试使用.Net 4.0中的基于java的服务。 (C#Console / Windows服务)
我使用VS的Add Service Reference对话框添加了服务引用。

服务托管在WebSphere 8上,WSDL定义使用cxf生成 客户端应用程序正在Windows Server 2008 R2 SP1上运行。但我不认为在SP1之后应用任何Windows更新。

问题是不时所有对服务方法的调用都会返回异常。错误如下:

The content type text/xml;charset=UTF8 of the response message does not match the content type of the binding (application/soap+xml; charset=utf-8).  
If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly.  
The first 1024 bytes of the response were: '<?xml version="1.0" encoding="UTF-8"?><wsdl:definitions name="MyServiceImplService" targetNamespace="http://impl.webService.myService.com/" xmlns:ns1="http://webService.myService.com/" xmlns:ns2="http://cxf.apache.org/bindings/xformat" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:tns="http://impl.webService.myService.com/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">  
<wsdl:import location="http://10.1.1.1/myService/webService/myService?wsdl=myService.wsdl" namespace="http://webService.myService.com/"></wsdl:import>  
<wsdl:binding name="MyServiceImplServiceSoapBinding" type="ns1:myService">
<soap12:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"></soap12:binding>
<wsdl:operation name="disableCard">
  <soap12:operation soapAction="" style="documen'..  

这是我的客户端应用程序的WCF配置:

<system.serviceModel>
   <bindings>
      <customBinding>
         <binding name="MyServiceImplServiceSoapBinding">
            <textMessageEncoding messageVersion="Soap12" />
            <httpTransport />
         </binding>
      </customBinding>
    </bindings>
    <client>
       <endpoint address="http://10.1.1.1/myService/webService/myService?wsdl"
           binding="customBinding" bindingConfiguration="MyServiceImplServiceSoapBinding"
           contract="MyServiceReference.myService" name="MyServiceImplPort" />
    </client>
</system.serviceModel>
  • 我认为这与WCF配置无关,因为所有方法都可以正常工作,所有这些方法都会返回此异常。

  • 错误似乎随机出现,没有明显的原因。有时2天后~1,000,000次请求,有时半小时后。但是当出现此异常时,对服务的每次调用都会返回此异常。

  • 在服务方面,没有日志,呼叫甚至到达java应用程序。似乎WebSphere发送wsdl定义而不是将我的调用传递给服务。

  • 关闭并重新启动客户端应用程序不会使错误消失。只有完整的系统重启才能使错误消失。 (更新:似乎从端点地址中删除?wsdl,删除了重新启动系统并重新启动客户端应用程序的需要就足以让它再次运行。)

  • 当遇到错误时,我已经使用Soap UI调用了服务方法并且没有异常地获得了结果。所以服务方面可能没有任何问题。

我唯一的猜测是,这是.Net Framework 4.0中的一个错误。 非常感谢任何帮助。

0 个答案:

没有答案