290.4. マルチパートメッセージ
Camel 2.8.1 から利用可能
マルチパート SOAP メッセージは、ServiceInterfaceStrategy によってサポートされます。ServiceInterfaceStrategy は、JAX-WS 2.2 に従ってアノテーションが付けられ、Document Bare スタイルの要件を満たすサービスインターフェース定義で初期化する必要があります。target メソッドは、JAX-WS 仕様に従って以下の基準を満たす必要があります。1 に おい
て、ヘッダー以外の戻り値のタイプが void
以外のタイプの場合は、最も 1 つまたは in-out または
non-header パラメーターが必要です。3 は、戻り値のタイプが out
void
である場合には、ほとんどの
non-header パラメーターが必要です。
in/out
パラメーターまたは out
ServiceInterfaceStrategy は、マッピングストラテジーがリクエストパラメーターまたは応答パラメーターに適用されるかどうかを示すブール値パラメーターを使用して初期化する必要があります。
ServiceInterfaceStrategy strat = new ServiceInterfaceStrategy(com.example.customerservice.multipart.MultiPartCustomerService.class, true); SoapJaxbDataFormat soapDataFormat = new SoapJaxbDataFormat("com.example.customerservice.multipart", strat);
290.4.1. マルチパート要求
マルチパートリクエストのペイロードパラメーターは、ターゲット操作の署名を反映する BeanInvocation
オブジェクトを使用して開始されます。camel-soap DataFormat は、marshal()
プロセッサーが呼び出されると、BeanInvocation
の内容を SOAP ヘッダーおよびボディーのフィールドにマッピングします。
BeanInvocation beanInvocation = new BeanInvocation(); // Identify the target method beanInvocation.setMethod(MultiPartCustomerService.class.getMethod("getCustomersByName", GetCustomersByName.class, com.example.customerservice.multipart.Product.class)); // Populate the method arguments GetCustomersByName getCustomersByName = new GetCustomersByName(); getCustomersByName.setName("Dr. Multipart"); Product product = new Product(); product.setName("Multiuse Product"); product.setDescription("Useful for lots of things."); Object[] args = new Object[] {getCustomersByName, product}; // Add the arguments to the bean invocation beanInvocation.setArgs(args); // Set the bean invocation object as the message body exchange.getIn().setBody(beanInvocation);