2013-07-19 44 views
1

我試圖在我的c#項目中使用遠程服務器上的apache或jboss上駐留的wsdl。我已經添加在Visual Studio中的服務引用,它會自動生成一個app.config文件對我來說,這裏的system.serviceModel部分看起來如下從.net中消費java wsdl時內容類型不匹配

<system.serviceModel> 
    <bindings> 
     <basicHttpBinding> 
      <binding name="ArtesiaWebServicesHttpBinding" closeTimeout="00:01:00" 
       openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" 
       allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" 
       maxBufferSize="655360" maxBufferPoolSize="524288" maxReceivedMessageSize="655360" 
       messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" 
       useDefaultWebProxy="true"> 
       <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 
        maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
       <security mode="None"> 
        <transport clientCredentialType="None" proxyCredentialType="None" 
         realm="" /> 
        <message clientCredentialType="UserName" algorithmSuite="Default" /> 
       </security> 
      </binding> 
     </basicHttpBinding> 
    </bindings> 
    <client> 
     <endpoint address="http://serverpath/ArtesiaWebServices" 
      binding="basicHttpBinding" bindingConfiguration="ArtesiaWebServicesHttpBinding" 
      contract="DAMService.ArtesiaWebServicesInterface" name="ArtesiaWebServicesHttpPort" /> 
    </client> 
</system.serviceModel> 

在運行時,方法調用過程中,我得到的以下錯誤:

內容類型multipart/related; type =「application/xop + xml」;開始= 「」;啓動信息=「文本/ XML」;響應消息的邊界=「---- = _ Part_386_1206794365.1374255761229」與綁定(text/xml; charset = utf-8)的內容類型不匹配。如果使用自定義編碼器,請確保IsContentTypeSupported方法正確實施。

可能是什麼問題?

回答

0

該問題已通過將綁定的messageEncoding屬性更改爲「Mtom」而不是「Text」來解決