Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

Using Microsoft .NET in WebSphere Message Broker V8: Part 1: Using the .NETCompute node sample

Matthew Golby-Kirk (mgk@uk.ibm.com), Software Developer, IBM
Matthew Golby-Kirk photo
Matthew Golby-Kirk is a software developer working on the WebSphere Message Broker development team at the IBM Hursley Software Lab in the UK. He works on the design and implementation of the HTTP and Web services support, along with the ESQL language run time in WebSphere Message Broker. You can contact Matthew at mgk@uk.ibm.com.
Ben Thompson (bthomps@uk.ibm.com), Consulting IT Specialist, IBM
Author photo
Ben Thompson is a Consulting IT Specialist working on the WebSphere Message Broker development team at the IBM Hursley Software Lab in the UK. He is currently working on the design and implementation of .NET support in Message Broker. In the past, he has worked for IBM Software Services for WebSphere designing and implementing WebSphere solutions for IBM customers worldwide. You can contact Ben at bthomps@uk.ibm.com.

Summary:  This series of four tutorials demonstrates the new support for Microsoft .NET in WebSphere Message Broker V8. Part 1 shows you how to use the .NETCompute node to filter, modify, and create messages, and provides a sample scenario along with explanatory C# code snippets. Readers should be familiar with either Microsoft .NET or WebSphere Message Broker but need not be familiar with both.

View more content in this series

Date:  21 Dec 2011
Level:  Intermediate

Comments:  

Testing the scenario

This final section of the tutorial shows you how to test the entire scenario directly from the Message Broker Toolkit using its built-in Test Client.

  1. In order to test the top branch of the message flow, within the DotNetApplication, expand the Flow Tests folder and open the file named DotNetApplication_LoyaltyProgram.mbtest. The input data contained in the test file is shown below :

    Listing 5. LoyaltyProgram message sample input data
    
    <LoyaltyProgram
          xmlns:applicant="http://www.example.org/applicant"
          xmlns:store="http://www.example.org/store">
      <applicant:ApplicantDetails>
        <applicant:FirstName>Ben</applicant:FirstName>
        <applicant:LastName>Thompson</applicant:LastName>
        <applicant:HouseNo>1</applicant:HouseNo>
        <applicant:Street>Happiness Avenue</applicant:Street>
        <applicant:Town>Grumpyville</applicant:Town>
      </applicant:ApplicantDetails>
      <store:StoreDetails>
        <store:StoreID>001</store:StoreID>
      </store:StoreDetails>
    </LoyaltyProgram>
    

    Click the Send Message button in the bottom right corner:

    LoyaltyProgram test
  2. Once the test has run, you should see that the StoreDetails section of the message has been enriched with a StoreName, StoreStreet, and StoreTown, as shown below in the red box:

    LoyaltyProgram result
    Here is a listing of the output message:

    Listing 6. LoyaltyProgram message sample output data
    
    <?xml version="1.0" encoding="utf-8" standalone="yes"?>
    <LoyaltyProgram
          xmlns:applicant="http://www.example.org/applicant"
          xmlns:store="http://www.example.org/store">
      <applicant:ApplicantDetails>
        <applicant:FirstName>Ben</applicant:FirstName>
        <applicant:LastName>Thompson</applicant:LastName>
        <applicant:HouseNo>1</applicant:HouseNo>
        <applicant:Street>Happiness Avenue</applicant:Street>
        <applicant:Town>Grumpyville</applicant:Town>
      </applicant:ApplicantDetails>
      <store:StoreDetails>
        <store:StoreID>001</store:StoreID>
        <store:StoreName>Broker Brothers Central</store:StoreName>
        <store:StoreStreet>Exuberant Avenue</store:StoreStreet>
        <store:StoreTown>Happyville</store:StoreTown>
      </store:StoreDetails>
    </LoyaltyProgram>
    

  3. In order to test the bottom branch of the message flow, within the DotNetApplication, expand the Flow Tests folder and open the file DotNetApplication_SaleEnvelope.mbtest. The input data contained in the test file is shown below:

    Listing 7. SaleEnvelope message sample input data
    
    <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>Sterling</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>Euros</Currency>
      </Invoice>
     </SaleList>
     <Trailer>
      <CompletionTime>12.00.00</CompletionTime>
     </Trailer>
    </SaleEnvelope>
    

    Click the Send Message button in the bottom right corner:

    SaleEnvelope Test
  4. Once the test has run, you should see the output message displayed with a comma-separated format, as shown below in the red box:

    SaleEnvelope Result
    Here is a listing of the output message:

    Listing 8. SaleEnvelope message sample output data
    
    00,01,02,Twister,Games,0.30,1
    02,03,01,The Times Newspaper,Books and Media,0.20,1
    04,05,01,The Origin of Species,Books and Media,22.34,2
    06,07,01,Microscope,Miscellaneous,36.20,1
    

This is the end of the task steps for Part 1 of this tutorial series. You can continue on to the resource links and author information by clicking Next below, or you can go on to Part 2 of the tutorial series.

7 of 9 | Previous | Next

Comments



Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=WebSphere
ArticleID=781973
TutorialTitle=Using Microsoft .NET in WebSphere Message Broker V8: Part 1: Using the .NETCompute node sample
publish-date=12212011
author1-email=mgk@uk.ibm.com
author1-email-cc=
author2-email=bthomps@uk.ibm.com
author2-email-cc=

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere).

My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).