从.net使用java wsdl时内容类型不匹配

时间:2013-07-19 17:45:36

标签: c# .net web-services wsdl

我正在尝试在我的c#项目中使用远程服务器上的apache或jboss上托管的wsdl。我在visual studio中添加了一个服务引用,它为我自动生成了一个app.config文件,其中 system.serviceModel 部分如下所示

<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;类型= “应​​用/ XOP + xml” 的;开始= “”;启动信息=“文本/ XML”; border =“---- = _ Part_386_1206794365.1374255761229”响应消息与绑定的内容类型(text / xml; charset = utf-8)不匹配。如果使用自定义编码器,请确保正确实现IsContentTypeSupported方法。

可能是什么问题?

1 个答案:

答案 0 :(得分:0)

通过将绑定的messageEncoding属性更改为“Mtom”而不是“Text”来解决问题