0

http://localhost:8088/?id=xxx&type=yyyyans のような HTTP メッセージidからパラメータを抽出するには、どのトランスフォーマーを使用すればよいでしょうか type

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsd="http://wsdouane/">
   <soapenv:Header/>
   <soapenv:Body>
      <wsd:find>
         <entity>
            <id>xxxx</id>
            <type>yyyy</type>
         </entity>
      </wsd:find>
   </soapenv:Body>
</soapenv:Envelope>

HTTP 出力

Cannot bind to address "http://127.0.0.1:8088/" No component registered on that endpoint

ファイル出力

<?xml version='1.0' encoding='UTF-8'?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns2:findResponse xmlns:ns2="http://wsdouane/"/>
</S:Body>
</S:Envelope>

JAX-WS Web サービスに渡すには?

ありがとうございました

4

1 に答える 1

1

クエリ パラメーターを取得し、それらをオブジェクトに設定してから 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;
    }
}  
于 2013-05-16T14:06:43.257 に答える