在wcf中阅读与java web服务相关的多部分/相关响应

时间:2013-11-22 12:22:20

标签: java .net wcf web-services soap

我们正在尝试使用wcf(添加服务引用)来使用java webservice,但是在调用服务时会抛出异常,如下所示

The content type multipart/related; type="text/xml"; boundary="----=_Part_113_846920666.1380536491947" of the response message does not match the content type of the binding (text/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: '------=_Part_113_846920666.1380536491947
Content-Type: text/xml; charset=utf-8

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header/>
<SOAP-ENV:Body>
   <brv:GBResponse xmlns:brv="urn:gamma:famma:tamma:brv">
       <gtf:errors xmlns:gtf="urn:gamma:famma:femme">
          <gtf:error>
              <gtf:id>ABCEDFHECIDGJ-1234567890</gtf:id>
              <gtf:text>Letter created.</gtf:text>
              <gtf:num>0</gtf:num>
          </gtf:error>
        </gtf:errors></brv:GBResponse>
 </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
------=_Part_113_846920666.1380536491947
Content-Type: application/dlf
Content-ID: ALPHABETA-17FASF-2013-09-30-122130269-68-GF
Content-Transfer-Encoding: binary

PK   \0 \0\b\0?b>C7?qw? \0\0?\b\0\0 \0\0\0DLF/O/29/1.bin?Vg? E ??! b@   p9N  ?<;`???; ?  3? A9@? P??,,????dVT°  sV?YQQQ1?<yX[? ???~5???==3_??
\0? z   :?Oonil?? [Z&L ?R?\b [?? ?+?G?~??<?r}?   ? J ?D C ?$&2?$%?8?IF  ??QN ?TQMcjhBSj???f1???b  ??*?q ?8???q??? C
3?T e???1?I?5?x?1 ;???S??:??3?-?Y?(S??h>??{?y?DX?'.

我们正在使用带有bindingConfiguration的basicHttpBinding,就像这样

<binding name="OurBinding"
             closeTimeout="00:01:00"
             openTimeout="00:01:00"
             receiveTimeout="00:10:00"
             sendTimeout="00:01:00"
             allowCookies="false"
             bypassProxyOnLocal="false"
             hostNameComparisonMode="StrongWildcard"
             maxBufferSize="65536"
             maxBufferPoolSize="524288"
             maxReceivedMessageSize="65536"
             messageEncoding="Text"
             textEncoding="utf-8"
             transferMode="Buffered"
             useDefaultWebProxy="true">
      <readerQuotas maxDepth="32"
                    maxStringContentLength="8192"
                    maxArrayLength="16384"
                    maxBytesPerRead="4096"
                    maxNameTableCharCount="16384" />
      <security mode="TransportCredentialOnly">
        <transport clientCredentialType="Windows"
                   proxyCredentialType="None"
                   />
      </security>
    </binding>

我们该如何解决这个问题?任何帮助将不胜感激。 感谢

1 个答案:

答案 0 :(得分:0)

WCF不支持Soap With Attachment(SwA)/ MIME附件。您可以试用此MIME encoder(WCF扩展程序)或实施自己的自定义message encoder并阅读附件。