标签: mtom

MTOM如何运作?

MTOM是W3C消息传输优化机制,一种有效地向Web服务发送二进制数据和从Web服务发送二进制数据的方法.

它一般如何运作?

w3c mtom

64
推荐指数
3
解决办法
5万
查看次数

basicHttpBinding vs wsHttpBinding

在WCF端点中,basicHttpBinding和wsHttpBinding有什么区别?什么时候应该使用?

.net wcf web-services mtom wcf-binding

39
推荐指数
2
解决办法
3万
查看次数

java.lang.NoSuchFieldError:REFLECTION

我正在使用CXF创建一个项目,并使用具有一定安全性的MTOM(我不知道该信息是否相关).

当我尝试初始化我的服务器时,我收到了这个错误:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'example': Invocation of init method failed; nested exception is java.lang.NoSuchFieldError: REFLECTION
Run Code Online (Sandbox Code Playgroud)

这是我的cxf-servlet.xml文件:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jee="http://www.springframework.org/schema/jee" xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
     http://www.springframework.org/schema/beans 
     http://www.springframework.org/schema/beans/spring-beans.xsd
     http://cxf.apache.org/jaxws
     http://cxf.apache.org/schemas/jaxws.xsd">

<jaxws:endpoint 
    id="example" 
    address="/example"
    implementor="br.com.arthur.services.ExampleService">

    <!-- Uncomment only if using WS-SecurityPolicy -->
    <jaxws:properties>
        <entry key="mtom-enabled" value="true" />
        <entry key="ws-security.callback-handler" value-ref="myPasswordCallback" />
    </jaxws:properties>

    <!-- Uncomment only if using standard WSS4J interceptors -->
    <!--jaxws:inInterceptors> <bean class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor"> 
        <constructor-arg> <map> <entry key="action" value="UsernameToken"/> <entry 
        key="passwordType" value="PasswordText"/> <entry key="passwordCallbackRef" 
        value-ref="myPasswordCallback"/> </map> </constructor-arg> …
Run Code Online (Sandbox Code Playgroud)

spring cxf mtom maven

23
推荐指数
2
解决办法
4万
查看次数

使用Python调用SOAP MTOM

我目前正在使用web toolkitpython,我必须进行大量的SOAP调用.对我来说不幸的是,有几个电话使用MTOM.我目前正在使用SUDS,我想知道是否可以用它进行MTOM调用(我在文档中找不到任何内容,所以我认为答案是否定的).

如果SUDS不是解决方案,还有其他选择吗?

python soap mtom suds

20
推荐指数
1
解决办法
1347
查看次数

如何从WCF服务中止流而不读取它?

这是我上周一直在调查的问题,无法找到任何解决方案.发现帖子问同样但从未得到答案,希望这也会帮助其他人.

我有一个WCF服务,返回一个包含stream内部对象的服务.我使用basicHttpBinding流式传输和Mtom将其发送给客户端.

客户端WCF在收到响应对象后立即调用服务并关闭代理.

接下来,客户端读取从WCF服务获取的流并将其写入本地磁盘上的文件.所有这一切都很好.

我的问题是客户端想要中止操作并停止从WCF服务下载数据.如果我.close()在流上调用,例如:serverReply.DataStream.Close();那么它会阻塞并从WCF服务读取整个流,直到它结束,然后再继续.流可能非常大,网络并不总是很快.

这对于网络资源使用都是非常不合需要的,这基本上浪费在不再使用的数据上.并且由于basicHttpBinding只允许两个并发TCP连接(默认情况下)到WCF服务服务器,因此它会阻止其他连接尝试,直到读取流直到结束.

我可以增加并发连接的数量,但这将是一个糟糕的解决方案,因为它会创建一个麻烦的开放.

例如,20个中止的下载仍在下载数据以将其丢弃.我需要完全停止转移.

在客户端上,流对象只是一个常规Stream类,因此它只有close方法,没有别的.

调用.close().abort()代理对象没有帮助,也没有使用.dispose()或任何其他方法销毁它.在服务器端,我处理OperationContext.OperationCompleted事件,但是直到stream读取数据直到结束才会触发.

所以问题是,如何在不完全读取流的情况下关闭/中止流?

c# wcf mtom stream wshttpbinding

17
推荐指数
1
解决办法
1630
查看次数

MTOM与SAAJ提供的附件功能有什么区别?

SAAJ: SOAP with Attachments API for Java

MTOM: SOAP消息传输优化机制

我的简单理解是:它们处理SOAP附件,MTOM是SAAJ 的更优化版本.它是否正确?

它们只是两种不同的方式来做同样的事情吗?或者我想在这里比较苹果和橘子?

我可以一起使用SAAJ和MTOM吗?

soap mtom jax-ws saaj

15
推荐指数
1
解决办法
1万
查看次数

如何使用WCF(或WSE 3)在Web服务客户端应用程序的请求和响应中混合消息编码类型(Text/MTOM)?

这是我的问题.我正在访问一个Web服务(托管在基于Java的服务器上),它只接受文本编码的请求,但它返回MTOM响应.我发现如果我将Web服务设置为RequireMtom,它会发送一个Mtom请求!不幸的是,服务器在Mtom请求上窒息并返回500错误.但是,如果我将其设置为文本消息编码,则响应会使用多部分MIME(MTOM)响应正确返回,该响应会使Microsoft Web服务API出错(下面的示例错误).它期望文本编码响应,因为请求是文本编码的.我想仅在响应中使用RequireMtom.有人能帮我一下吗?

正如您在下面的错误中看到的那样(使用标准Web服务API,WCF或WSE3),当我使用文本编码发送请求时,响应会正确返回多部分/相关响应中的所有数据,但是.net框架扼流圈!

WSE的错误消息:

Client found response content type of 'multipart/related; type="text/xml"; start="<1AE0B46A85B0186B5D136D12E1EE286E>";  boundary="----=_Part_209564_1891070135.1226526701833"', but expected 'text/xml'.
The request failed with the error message:

 at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
   at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
   at TestWseService.AdesaJasperWse.ManagementServiceService.runReport(String requestXmlString) in C:\Documents and Settings\xxx\My Documents\Visual Studio 2005\Projects\TestWseService\Web References\AdesaJasperWse\Reference.cs:line 229
   at TestWseService.Form1.buttonRunService_Click(Object sender, EventArgs e) in C:\Documents and Settings\xxx\My Documents\Visual Studio 2005\Projects\TestWseService\Form1.cs:line 42
Run Code Online (Sandbox Code Playgroud)

WCF的错误消息

The content type multipart/related; type="text/xml"; start="<30ED8FE3004CDA67723CC7164A6CFEEC>";    boundary="----=_Part_209545_389093169.1226526546805" of the response message does not match the content …
Run Code Online (Sandbox Code Playgroud)

.net wcf wse web-services mtom

13
推荐指数
1
解决办法
3万
查看次数

WCF存在并且部分工作但是对于某些调用返回"没有端点侦听 - (404)未找到".

我们的服务使用从小到大的数据集(文档生成),并且它适用于某些调用,但对于某些特定请求(完全相同的方法,不同的参数),它只返回:

System.ServiceModel.EndpointNotFoundException:在http:// localhost:8010/MyService/MyService.svc上没有可以接受该消息的端点.这通常是由错误的地址或SOAP操作引起的.有关更多详细信息,请参阅InnerException(如果存在).---> System.Net.WebException:远程服务器返回错误:(404)Not Found.

请注意,该服务正在运行,文档已生成,但正如我所说的并非全部......(并且可以从浏览器打开服务)

我已经在web.config中打开了跟踪(system.diagnostics),并且没有在svclog中获得更多信息.

绑定(wsHttp)配置为:

    <binding name="wsHttpWithTrans" transactionFlow="True" messageEncoding="Mtom"  maxReceivedMessageSize="65536000" maxBufferPoolSize="124288000">
      <readerQuotas maxDepth="32" maxStringContentLength="819200" maxArrayLength="16384000" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
      <security mode="None">
        <transport clientCredentialType="Windows" proxyCredentialType="None" realm="" />
        <message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default" establishSecurityContext="true" />
      </security>
    </binding>
Run Code Online (Sandbox Code Playgroud)

而且,还有:

<configuration>
  <system.web>
    <httpRuntime maxRequestLength="124288000" />
  </system.web>
</configuration>
Run Code Online (Sandbox Code Playgroud)

我相信这个消息应该在maxReceivedMessageSize其他属性的范围内.

目前我对消息的大小持怀疑态度,但不能确定 - 您是否知道如何进一步调试?

c# wcf mtom .net-4.0 http-status-code-404

12
推荐指数
1
解决办法
8588
查看次数

Powershell:使用MTOM消息编码消耗WCF服务时出错

我目前正在探索powershell功能,但我遇到了一个我无法解决的问题.任何快速提示将不胜感激=)

我的目标:从powershell v2.0调用WCF服务(使用MTOM消息编码配置)中的方法(希望使用new-webserviceproxy cmdlet)

我的问题:当消息编码设置为Mtom时,new-webserviceproxy cmdlet无法正确解析服务的响应.我收到以下错误:

PowerShell:

$proxyObject = New-WebServiceProxy -URI "http://myserver.com/AccessService.svc?wsdl"
$proxyObject.TestWebServiceConnection()

使用"0"参数调用"TestWebServiceConnection"的异常:"客户端发现响应内容类型为'multipart/related; type ="application/xop + xml"; start ="<http://tempuri.org/0> "; boundary ="uuid:
4001d529-32b9-4560-9f4b-550c35c67b03 + id = 4"; start-info ="text/xml"',但预期'text/xml'.
请求失败并显示错误消息:
- -
--uuid:4001d529-32b9-4560-9f4b-550c35c67b03 + ID = 4
的Content-ID:<http://tempuri.org/0>
内容传送编码:8位
内容类型:应用/ XOP + xml的; charset = utf-8; type ="text/xml"
<s:Envelope xmlns:s ="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<TestWebServiceConnectionResponse xmlns ="http: //myserver.com /">
<TestWebServiceConnectionResult>成功</ TestWebServiceConnectionResult>
</ TestWebServiceConnectionResponse>
</ S:身体>
</秒:信封>
--uuid:4001d529-32b9-4560-9f4b-550c35c67b03 + ID = 4- -
- ."
在行:1 char:38
+ $ …

powershell wcf mtom

10
推荐指数
1
解决办法
3350
查看次数

JAX-WS始终以内联方式发送MTOM附件

基本上我想创建一个Web服务客户端,通过代理方法发送一个mtom soap消息.我已经从Web服务wsdl创建了我的服务工件.消息是正确创建的,但是当我启用mtom并添加附件时,附件始终是内联发送的,而不是单独的mime部分.它像mtom一样启用但由于某种原因它决定不优化消息,因此将其发送到内联.通过soapui运行相同的代码会得到正确的结果,所以我知道服务本身会接受它.

这是我创建soap请求并发送它的基本代码.我启用了mtomfeature,但也尝试过这样做.soapBinding.setMTOMEnabled(true); 对于我调试它的两种方法((SOAPBinding) binding).isMTOMEnabled(),检查它是否设置为启用.

// initiate services....

// create service and enable mtom
WebServiceBlah service = new WebServiceBlah(new URL(wsdlURL), SERVICE_NAME);
WebServiceBlahPort port = service.getWebServiceBlahPort(new MTOMFeature(true, 3072));

// load file
File file = new File("/home/mypdf.pdf");
FileInputStream fileinputstream = new FileInputStream(file);
int numberBytes = fileinputstream.available();
byte bytearray[] = new byte[numberBytes];
fileinputstream.read(bytearray);
fileinputstream.close();

// create uploadResult
UploadResult request = new UploadResult();

// create attachment
AttachmentType attachment = new AttachmentType();
attachment.setContentType("application/doc");
attachment.setValue(bytearray);

// create result and add attachment to it …
Run Code Online (Sandbox Code Playgroud)

java client soap web-services mtom

10
推荐指数
1
解决办法
6447
查看次数