クエリ パラメーターを取得し、それらをオブジェクトに設定してから SOAP オブジェクトに設定するプロセスは、単一のトランスフォーマーを使用した単一のステップ プロセスではありません。
ステップ1:使用できます
<http-request-to-parameter-map>
トランスフォーマーを使用して、クエリ パラメータをマップとして取得します。
ステップ 2: 次に、このマップを使用して、マップの値を持つオブジェクトを作成します。
ステップ 3: 次に、オブジェクトを JAX-WS クライアント コンポーネントに送信します。
トランスフォーマーと http およびサーブレット モジュール リファレンスの詳細については、以下のリンクを参照してください。
HTTP トランスポート リファレンス。
サーブレット トランスポート リファレンス
XSLT とプロキシ クライアントを使用するように回答を更新しました。
<flow name="SOAPWebService" >
<http:inbound-endpoint address="http://localhost:8088/" exchange-pattern="request-response">
</http:inbound-endpoint>
<set-variable value="#[message.inboundProperties['id']]" variableName="paramId"></set-variable>
<set-variable value="#[message.inboundProperties['type']]" variableName="paramType"></set-variable>
<component class="com.example.components.SampleComponent" ></component>
<mule-xml:xslt-transformer
maxIdleTransformers="2" maxActiveTransformers="5"
xsl-file="C:\WorkSpace\MyProject\src\main\resources\xslt\PrepareRequestXML.xsl">
<mule-xml:context-property key="paramId"
value="#[flowVars['paramId']]" />
<mule-xml:context-property key="paramType"
value="#[flowVars['paramType']]" />
</mule-xml:xslt-transformer>
<cxf:proxy-client payload="body"
enableMuleSoapHeaders="true">
</cxf:proxy-client>
<http:outbound-endpoint exchange-pattern="request-response"
address="http://localhost:8080/ClientsDB/douane" doc:name="HTTP">
</http:outbound-endpoint>
<byte-array-to-string-transformer doc:name="Byte Array to String" />
<file:outbound-endpoint ....... .. />
</flow>
以下は正しいXSLTです
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns="http://wsdouane/">
<xsl:output method="xml" indent="yes" />
<xsl:param name="paramType"></xsl:param>
<xsl:param name="paramId"></xsl:param>
<xsl:template match="*" >
<xsl:element name="find" namespace="http://wsdouane/">
<xsl:element name="entity">
<xsl:element name="id">
<xsl:value-of select="$paramType"/>
</xsl:element>
<xsl:element name="type">
<xsl:value-of select="$paramId"/>
</xsl:element>
</xsl:element>
</xsl:element>
</xsl:template>
<xsl:template match="text()|processing-instruction()|comment()">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
SampleComponent クラスのコードは次のとおりです。
package com.example.components;
import org.mule.api.MuleEventContext;
import org.mule.api.lifecycle.Callable;
public class SampleComponent implements Callable {
@Override
public Object onCall(MuleEventContext eventContext) throws Exception {
String str = "<sample> </sample>";
return str;
}
}