1

1) Camel Spring-WS コンポーネントを使用して MTOM メッセージを非整列化する方法はありますか?

2) Camel JAXB データ形式で試しました。うまくいきませんでした。データハンドラーにはコンテンツがありません。JAXB データ形式は MTOM をサポートしていますか?

<dataFormats>
    <jaxb id="jaxb" contextPath="com.mycompany.hr.jaxb"/>
</dataFormats>

<route>
    <from uri="spring-ws:rootqname:{http://mycompany.com/hr/schemas}HolidayRequest?endpointMapping=#endpointMapping" />
    <unmarshal ref="jaxb"/>
    <process ref="testProcessor" />
</route>

3) JAXB データ形式では MTOM が有効になっていないと思いました。そこで、MTOM 対応の JAXB2Marshaller を使用してカスタム データ形式を作成しました。しかし、まだ同じ問題に直面しています。

import java.io.InputStream;
import java.io.OutputStream;

import javax.xml.transform.Source;

import org.apache.camel.Exchange;
import org.apache.camel.spi.DataFormat;
import org.springframework.oxm.jaxb.Jaxb2Marshaller;

public class MtomDataFormat implements DataFormat {

    public void marshal(Exchange arg0, Object arg1, OutputStream arg2)
            throws Exception {
        // TODO Auto-generated method stub

    }

    public Object unmarshal(Exchange exchange, InputStream is) throws Exception {
        Source source = exchange.getContext().getTypeConverter().mandatoryConvertTo(Source.class, is);

        Jaxb2Marshaller mar = new Jaxb2Marshaller();
        mar.setContextPath("com.mycompany.hr.jaxb");
        mar.setMtomEnabled(true);
        return mar.unmarshal(source);
    }

}

春の構成

<bean id="endpointMapping"
    class="org.apache.camel.component.spring.ws.bean.CamelEndpointMapping">
</bean>

<bean id="testProcessor" class="TestProcessor" />

<bean id="mtomDataFormat" class="MtomDataFormat" />

<camelContext xmlns="http://camel.apache.org/schema/spring">
    <route>
        <from uri="spring-ws:rootqname:{http://mycompany.com/hr/schemas}HolidayRequest?endpointMapping=#endpointMapping" />
        <unmarshal ref="mtomDataFormat"/>
        <process ref="testProcessor" />
    </route>
</camelContext>
4

0 に答える 0