简体   繁体   English

Axis2接收MTOM附件找不到数据处理程序错误

[英]Axis2 receive MTOM attachment no datahandler found error

For a project I'm implementing a SOAP service using Apache Axis2 1.6.2. 对于一个项目,我正在使用Apache Axis2 1.6.2实现SOAP服务。 I have a service which needs to receive a file using MTOM. 我有一项需要使用MTOM接收文件的服务。 But sadly I keep having issues with receiving a MTOM attached file. 但是可悲的是,我在接收MTOM附件时仍然遇到问题。 I keep getting the exception: 我不断收到异常:

org.apache.axiom.om.OMException: A data handler was not found for content id cid:491414508823

.... ....

I've tried to search the web for an answer, but was not succesful. 我试图在网上搜索答案,但没有成功。 I hope someone can get me in the right direction. 我希望有人可以指引我正确的方向。 My wsdl contains the following snippet: 我的wsdl包含以下代码段:

...
<xs:element minOccurs="0" name="PDF_Attachment">
  <xs:complexType>
     <xs:all>
         <xs:element minOccurs="0" name="PDF_AttachmentName" type="xs:string"/>
         <xs:element name="PDF_AttachmentContent" type="xs:base64Binary"/>
     </xs:all>
   </xs:complexType>
</xs:element>
...

I use SoapUI to generate the request and have set the property 'use MTOM' to true. 我使用SoapUI生成请求,并将属性“ use MTOM”设置为true。

Is there anyone who has encountered the same problem or knows how to solve this. 是否有人遇到相同的问题或知道如何解决。 Help would be greatly appreciated! 帮助将不胜感激!

Richard 理查德

UPDATE 更新

I think I've tackled the problem. 我想我已经解决了这个问题。 The issue was within my xsd/wsdl definitions. 问题在我的xsd / wsdl定义之内。 I used jaxb to convert my business objects defined in external xsd's to POJO with JAXB annotations. 我使用jaxb将外部xsd中定义的业务对象转换为带有JAXB批注的POJO。 But the xs:base64Binary was converted as byte[]. 但是xs:base64Binary被转换为byte []。 Changing the xsd with: 使用以下方法更改xsd:

<xs:schema ... xmlns:xmime="http://www.w3.org/2005/05/xmlmime"> ...

And changing the element to: 并将元素更改为:

<xs:element name="PDF_AttachmentContent" minOccurs="1" maxOccurs="1" type="xs:base64Binary" xmime:expectedContentTypes="application/octet-stream">

JAXB now created a DataHandler as return type in the getPDF_AttatchmentContent. JAXB现在在getPDF_AttatchmentContent中创建了一个DataHandler作为返回类型。 The only issue I have to tackle is to allow SOAPUI to send the MTOM attachments. 我要解决的唯一问题是允许SOAPUI发送MTOM附件。 Somehow A testclient I've created works perfectly, but SOAPUI does not send the attachment... 我以某种方式创建的testclient可以正常工作,但是SOAPUI不会发送附件...

Source for the solution above: http://cxf.apache.org/docs/mtom-attachments-with-jaxb.html 上述解决方案的来源: http : //cxf.apache.org/docs/mtom-attachments-with-jaxb.html

UPDATE 2: http://ssagara.blogspot.nl/2012/03/test-axis2-jax-ws-mtom-service-using.html solved my SOAPUI issues with MTOM. 更新2: http ://ssagara.blogspot.nl/2012/03/test-axis2-jax-ws-mtom-service-using.html解决了MTOM的SOAPUI问题。 I did not edit the correct cid in my soap message. 我没有在肥皂消息中编辑正确的CID。 I assumed that SOAPUI would assist me with that, but it didn't. 我以为SOAPUI可以帮助我,但事实并非如此。

The details of the solution are in the original message above. 解决方案的详细信息在上面的原始消息中。 The issues were resolved using the following two sites: 使用以下两个站点解决了问题:

  1. DataHandler issue: http://cxf.apache.org/docs/mtom-attachments-with-jaxb.html DataHandler问题: http : //cxf.apache.org/docs/mtom-attachments-with-jaxb.html
  2. SoapUI issue: http://ssagara.blogspot.nl/2012/03/test-axis2-jax-ws-mtom-service-using.html SoapUI问题: http ://ssagara.blogspot.nl/2012/03/test-axis2-jax-ws-mtom-service-using.html

I hope this is helpful for some of you. 希望对您中的某些人有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM