| By Roland Barcia, Jeff Brent | Article Rating: |
|
| January 30, 2006 09:45 AM EST | Reads: |
19,473 |
In the previous article (part 1 in WebSphere Journal vol: 3. iss: 4) we began to build an SCA project in WebSphere Process Server. Here in part 2 we pick up the discussion. To see the associated images, please view the article online at www.ibm.com/developerWorks/websphere.
d. The business object is defined using standard XML schema type. You can open the business object using an XML editor to see it. (You can open the business object in a text editor by right clicking it and selecting Open with => and the editor of your choice.)
e. Save and close the Business Object Editor.
f. The XML schema should look something like the code in Listing 1.
3. We will now create a second business object to represent the response.
a. Create another business object following the same steps above. This business object will have three fields:
- customerId of type string
- creditScore of type int
- creditLimit of type double
c. Save and close the Business Object Editor
You now have two business objects created.
Define the service interface
You are now ready to create your SCA Interface. Again, the credit approval service is a request-response service that receives a credit application and returns a credit rating synchronously. The service interface defines the interaction between the service client and the service provider. There are several ways to create an interface. If you choose a Java interface, you can use the Java Eclipse tools within WebSphere Integration Developer to do this. In our example, we will create a WSDL interface from the Business Integration perspective. You can do this using the Assembly Editor or you can do it using the Business Integraiton view. We will use the latter. (We will use the Assembly Editor later to create the implementation.)
1. First, we will create the Interface using the Business Integration view menu.
a. Right-click on the Interfaces menu item and select New => Interfaces as shown in Figure 20 (See online version).
b. On the New Interface menu, enter the name CreditApproval. (Keep in mind that we are using the default package and folders in our example for illustration purposes. You can select a folder to easily group different interfaces by functionality.)
2. The CreditApproval Interface is a simple WSDL file. WebSphere Integration Developer comes with a simple WSDL editor that you can use to build up your interface.
a. The Interface Editor should have opened when you created the Interface. If it is not open already, you can double click the interface in the business integration view to open it.
b. We will first create a simple request-response operation. (You can also create one-way operations that can be used with asynchronous invocations, but for now, we are only creating a simple synchronous request.) Press the Add Request Response Operation icon as shown in Figure 22.
c. An operation will be created on the editor. Name the operation calculateCreditRating. (Figure 23)
d. Now we need to define the parameters. Remember, we created two business objects, one for input and the other for output. With the operation created, select the Add Input icon as shown in Figure 24.
e. Name the input CreditApplication.
f. Select the Type column and find the CreditApplicaiton business object. As you can see, the business object is now a valid type that you can use to build up the interface, as shown in Figure 25. (Optionally, you can select to create a new business object here.)
g. Next, select the Add Output icon as shown in Figure 26.
h. Select CreditRating as the type, similar to what we did with the input.
i. Save and close the Interface Editor.
j. If you wish to inspect the WSDL file, you can right click the CreditApproval.wsdl file in the Physical Resources view and open it with a text editor. (Figure 28)
The WSDL file should look like the code in Listing 2.
Generate the component and provide an implementationWe are now ready to create our SCA implementation. At this point, we have created standard interfaces and business objects. We will now define our SCA component. You will use the SCA Assembly Editor to do this.
1. First, we will define the SCA component.
a. Open the SCA Assembly Editor by double clicking the CreditApprovalSCAModule menu item, as shown in Figure 29.
b. The SCA Assembly Editor has a palette you can use to create SCA artifacts. You can also drag certain artifacts from various views. Simply drag the CreditApproval interface onto the Assembly Editor as shown in Figure 30. (Alternatively, you could also drag a Java component from the palette and associate the interface afterwards.)
c. A text box will appear. Select Component with No Implementation Type as shown in Figure 31.
d. You should now see an SCA component on the Assembly Editor named Component1. (Figure 32)
e. You can change the name by selecting the component and typing the name, or you can change it using the Properties Editor as shown in Figure 33. Change the Display Name to CreditApproval. The Name field should change automatically.
2. We now have an SCA component with an interface, but no implementation. We will now use the Assembly Editor to generate the implementation.
a. Generate a skeleton implementation by right-clicking the component in the Assembly Editor and selecting Generate Implementation => Java. (Figure 34)
b. The new Java implementation should open in a Java Editor; you will see the calculateCreditRating. A simple code snippet is provided in the download file, in C:\SCA_ArticleSeries\Part1\CodeSnippet1.txt. The method is shown in Listing 3.
3. The code uses the SCA service manager to locate the Business Object Factory, which is used to create business objects from XML schemas. In our demonstration purposes, we create the Response Data Object and return hard coded data.
4. If you pasted in the code, you should have some compile errors. You can resolve the these by right clicking in the editor and selecting Source => Organize Imports as shown in Figure 35.
5. Save and close the Java file, but leave the Assembly Editor open.
Unit test the SCA componentWebSphere Integration Developer provides the ability to unit test components using a unit test tool. Depending on the type of SCA implementation, you can test SCA components in a J2SE environment, which enables you to test components without a full application server; of course, this greatly depends on the type of component you have. A Java implementation can be easily tested in a J2SE environment, but an SCA component realized by a BPEL flow would need a BPEL engine like WebSphere Process Server. In our example, we will use the Test Component feature to test our SCA component.
To launch the Test Component feature:
- Right click the CreditApproval component in the SCA Assembly Editor and select Test Component. (Figure 36)
- This will launch the Test Component Editor. On the right side of the tool, enter the test data as shown in Figure 37, then press Continue.
- A list of available run times will display. Select Eclipse 1.4 JVM, then Finish. (Figure 38)
- To begin the test, select the Return item as shown in Figure 39. Monitor the Events window to see the flow.
- On the right side, you will see the result. (Figure 40)
Published January 30, 2006 Reads 19,473
Copyright © 2006 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Roland Barcia
Roland Barcia is a consulting IT specialist for IBM Software Services for WebSphere in the New York/New Jersey Metro area. He is the author of one of the most popular article series on the developerWorks WebSphere site, www-106.ibm.com/developerworks/websphere/techjournal/0401_barcia/barcia.html, and is also a coauthor of IBM WebSphere: Deployment and Advanced Configuration. You can find more information about him at http://web.njit.edu/~rb54
More Stories By Jeff Brent
Jeff Brent is an Advisory Software Engineer for the WebSphere Business Integration Competency Center (WBICC). His responsibilities include helping independent software vendors develop integration strategies for WebSphere products.
![]() |
prabhavathy 03/12/08 12:15:22 PM EDT | |||
Please upload the CreditApprovalClient.war.Since it is not available C:\SCA_ArticleSeries\Part1\CreditApprovalClient.war. |
||||
![]() |
prabhavathy 03/12/08 12:14:04 PM EDT | |||
Please upload the CreditApprovalClient.war.Since it is not available C:\SCA_ArticleSeries\Part1\CreditApprovalClient.war. |
||||
![]() |
SYS-CON Australia News Desk 01/30/06 11:09:59 AM EST | |||
In the previous article (part 1 in WebSphere Journal vol: 3. iss: 4) we began to build an SCA project in WebSphere Process Server. Here in part 2 we pick up the discussion. To see the associated images, please view the article online at www.ibm.com/developerWorks/websphere. |
||||
- The Top 150 Players in Cloud Computing
- Commercial vs Federal Cloud Computing
- Why IBM’s Server Chief Got Busted
- Industry Experts Discuss the State of Cloud Computing
- Cloud Expo New York Call for Papers Now Open
- Cloud Computing on Gartner's Top 10 List and SYS-CON Events' 2010 Calendar
- US Federal Government is Major Cloud Computing Innovator
- Google Wave
- Ulitzer.com Named Exclusive "New Media" Sponsor of Cloud Computing Conference & Expo
- Tactical Cloud Computing Panel at 1st Annual GovIT Expo
- Adaptivity & Cloud Computing: Exclusive Q&A with CEO Tony Bishop
- 4th International Cloud Expo: Photo Album
- The Top 150 Players in Cloud Computing
- SYS-CON.TV: Cloud Computing Expo Power Panel
- Commercial vs Federal Cloud Computing
- Why IBM’s Server Chief Got Busted
- 1st Annual GovIT Expo: Letter from the Technical Chair
- Industry Experts Discuss the State of Cloud Computing
- Deputy CIO of the CIA to Keynote 1st Annual GovIT Expo
- SOA World Power Panel on SYS-CON.TV
- CIA was Headed to an Enterprise Cloud All Along: Jill Tummler Singer
- Cloud Expo New York Call for Papers Now Open
- 1st Annual Government IT Conference & Expo: Themes & Topics
- Stock in Focus: Dragon Capital
- The i-Technology Right Stuff
- Who Are The All-Time Heroes of i-Technology?
- Get the Message
- Where Are RIA Technologies Headed in 2008?
- i-Technology Viewpoint: Is Web 2.0 the Global SOA?
- i-Technology Viewpoint: Thinking Outside the VC Box
- ESB Myth Busters: 10 Enterprise Service Bus Myths Debunked
- i-Technology Viewpoint: When to Leave Your First IT Job
- SOA Web Services Edge Conference Coverage on SYS-CON.TV
- Five Reasons Why Web 2.0 Matters
- SYS-CON.TV's "SOA Web Services" and "Enterprise Open Source" Programs To Air in December
- SOA World Conference & Expo SYS-CON.TV Power Panel Live From Times Square










Cloud computing is a game changer. The cloud ...




















