このサンプルのメッセージ・フローは、メッセージのネーム・スペースの変更方法を示します。 入力メッセージにはネーム・スペースを使用する 1 つ以上のエレメントが含まれます。 これらのエレメントでは 1 つ以上の異なるネーム・スペースが使用されることもあります。
このトピックの手順を使用して、サンプルを実行します。これらの手順には入力テスト・メッセージの例と、 それに対応した予期される出力メッセージが含まれます。 予期される出力メッセージを使用して、サンプルが機能したことを確認します。
サンプルの実行時に問題を検出した場合は、 WebSphere Message Broker 資料の『サンプル実行時の問題の解決』を参照してください。
このサンプルの実行に使用するテスト・メッセージは、以下のフォーマットに基づいています。
<?xml version="1.0" encoding="UTF-8"?> <samp:SaleListMessage xmlns:samp="http://www.samplemessage.broker.hursley.ibm.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.samplemessage.broker.hursley.ibm.com/SampleMessageNamespace1.xsd"> <SaleEnvelope> <Header> <SaleListCount>1</SaleListCount> </Header> <SaleList> <Invoice> <Initial>K</Initial> <Initial>A</Initial> <Surname>Braithwaite</Surname> <Item> ... </Item> <Balance>81.84</Balance> <Currency>EUR</Currency> </Invoice> </SaleList> <Trailer> <CompletionTime>2000-01-01 00:00:01.000000</CompletionTime> </Trailer> </SaleEnvelope> </samp:SaleListMessage>
このサンプルは CHANGENAMESPACEMF という名前のメッセージ・フローを使用します。
サンプルを実行するには、次のようにします。
メッセージ・フローは XML メッセージを解析して、ネーム・スペースを使用する XML メッセージを書き出します。 出力メッセージが CHANGENAMESPACEMF.OUT キューに書き込まれます。
すべてのステップが正常に終了したなら、サンプルは完了です。
予期される出力 XML メッセージは、以下のとおりです。
<?xml version="1.0" encoding="UTF-8"?> <NS1:SaleListMessage xmlns:NS1="http://www.samplemessage.brokertest.hursley.ibm.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.samplemessage.brokertest.hursley.ibm.com"> <SaleEnvelope> <Header> <SaleListCount>1</SaleListCount> </Header> <SaleList> <Invoice> <Initial>K</Initial> <Initial>A</Initial> <Surname>Braithwaite</Surname> <Item> <Code>00</Code> <Code>01</Code> <Code>02</Code> <Description>Twister</Description> <Category>Games</Category> <Price>00.30</Price> <Quantity>01</Quantity> </Item> <Item> <Code>02</Code> <Code>03</Code> <Code>01</Code> <Description>The Times Newspaper</Description> <Category>Books and Media</Category> <Price>00.20</Price> <Quantity>01</Quantity> </Item> <Balance>00.50</Balance> <Currency>GBP</Currency> </Invoice> <Invoice> <Initial>T</Initial> <Initial>J</Initial> <Surname>Dunnwin</Surname> <Item> <Code>04</Code> <Code>05</Code> <Code>01</Code> <Description>The Origin of Species</Description> <Category>Books and Media</Category> <Price>22.34</Price> <Quantity>02</Quantity> </Item> <Item> <Code>06</Code> <Code>07</Code> <Code>01</Code> <Description>Microscope</Description> <Category>Miscellaneous</Category> <Price>36.20</Price> <Quantity>01</Quantity> </Item> <Balance>81.84</Balance> <Currency>EUR</Currency> </Invoice> </SaleList> <Trailer> <CompletionTime>2000-01-01 00:00:01.000000</CompletionTime> </Trailer> </SaleEnvelope> </NS1:SaleListMessage>