Axis2 MTOM Web服务和.NET客户端使用它

Gar*_*ero 5 .net c# axis2 web-services mtom

所以我有这个新的Axis2 MTOM Web服务正确地服务于基于Java的Web服务客户端.

当我尝试将服务(或Web)引用添加到vs2008并将其与生成的代码一起使用时,问题就出现了.到现在为止,一切都好......这就是发生的事情:

  1. 我们创建必要的对象(客户端,请求和参数对象)
  2. 我们称之为服务
  3. 收到响应时,它会抛出此消息的异常:

  Client found response content type of 'multipart/related; 
  boundary=MIMEBoundaryurn_uuid_6C47CADDECCCB90D951282776406454; 
  type="application/xop+xml"; start="
  <0.urn:uuid:6C47CADDECCCB90D951282776406455@apache.org>"; start-info="text/xml"', 
  but expected 'text/xml'.

  The request failed with the error message:


MIMEBoundaryurn_uuid_6C47CADDECCCB90D951282776406454
Content-Type: application/xop+xml; charset=utf-8; type="text/xml"
Content-Transfer-Encoding: binary
Content-ID: <0.urn:uuid:6C47CADDECCCB90D951282776406455@apache.org>

<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><ns:sendImageResponse xmlns:ns="http://org/company/ws/services/filetransfer/"><ns:return xmlns:ax213="http://filetransfer.objects.ws.company.com/xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ax215="http://filetransfer.responses.objects.ws.company.com/xsd" xsi:type="ax215:SendImageResponse"><ax215:errorCode>1060</ax215:errorCode><ax215:errorMessage>Error ejecutando el servicio</ax215:errorMessage><ax215:output>1060</ax215:output></ns:return></ns:sendImageResponse></soapenv:Body></soapenv:Envelope>
MIMEBoundaryurn_uuid_6C47CADDECCCB90D951282776406454
Run Code Online (Sandbox Code Playgroud)

或者问题是

¿如何将axis2 webservice的响应设置为非mimetype?

Vin*_*ayC 4

您需要在配置中使用 MTOM 编码。请参阅 MSDN 中的简单示例,将其与 wsHttpBinding 一起使用(也应该可以与 basicHttpBinding 一起使用)。查看这篇描述使用自定义绑定使用 Oracle Web 服务的文章。如果您想尝试示例中给出的自定义绑定,您可能需要将 messageVersion 设置为 Soap11 而不是 Soap12。