| By Chris Schalk, Michael O'Neill | Article Rating: |
|
| May 1, 2006 03:00 PM EDT | Reads: |
45,442 |
We'll now modify it to call our BPEL Web Service. Before we can call the service, we must create a Web Service proxy class which will provide a way to call the service from Java.
To create the proxy class, you can use the Web Service Proxy wizard in JDeveloper (File->New...->Business-Tier->Web Services->Web Service Proxy). As the wizard commences, all that is needed to generate the necessary proxy to call the BPEL Web Service is to supply the WSDL URL http://localhost:9700/orabpel/default/LoanCompare/1.0/LoanCompare?wsdl (Figure 16).
Accept the remaining defaults and click Finish to generate the Proxy code. As the code generates you will see a Java Proxy client, LoanCompareWSHttpPortClient.java which is a runnable Java client with a main method. The main method looks like:
public static void main(String[] args) {
try {
proxy.CheaploansWSSoapHttpPortClient myPort = new
proxy.CheaploansWSSoapHttpPortClient();
System.out.println("calling " + myPort.getEndpoint());
// Add your own code here
} catch (Exception ex) {
ex.printStackTrace();
}
}
You can issue a test call to the Web Service by adding the line:
System.out.println(myPort.getLoanrate("123-45-6789"));
To the location denoted by the comment "// Add your own code here".
The next step is to modify the action method linked our button with code to call the BPEL Web Service using the Proxy class, "LoanCompareWSSoapHttpPortClient".
Jumping back into the backing bean code, "Form.java", we will edit the action method, "" as follows:
public String commandButton1_action() {
// Call BPEL Web service through Proxy Class
float returnedRate = 0;
try {
proxy.CheaploansWSSoapHttpPortClient myPort = new proxy.CheaploansWSSoapHttpPortClient();
returnedRate = myPort.invokeCompareLoan((String)inputText1.getValue());
}
catch (Exception e) {
e.printStackTrace();
};
// Display the returned value in the outputText field.
outputText1.setValue(returnedRate);
return "Success";
}
Now when the button is clicked at runtime, the proxy class, myPort, will be instantiated and the invokeCompareLoan( ) method is invoked and the Social Security value passed from the form is supplied as an argument. The BPEL Web service initiates on the BPEL Process Manager server and determines the lowest loan rate and returns it into the returnedRate float variable. This variable is then applied to the Output Text (outputText1) Faces UI component and a "success" String is returned (Figure 17).
When the JSF application is run, the form will appear in a browser, and when a Social Security number is entered and the button is clicked, the BPEL Process Web Service would be called and the lowest returned rate determined by the BPEL process will be displayed in the JSF form.
Summary
With SOA comes the unique possibility to easily couple vastly different sets of services together into single, cohesive business service. When accompanied with a JSF-based user interface, a BPEL process can then offer its services through a rich user interface.
As our example has shown, building a composite SOA application with an included JSF-based user interface is actually a straightforward process. When a tool such as Oracle JDeveloper 10g is used, it can easily be accomplished in an entirely visual manner.
Published May 1, 2006 Reads 45,442
Copyright © 2006 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Chris Schalk
Chris Schalk is a Tech Lead in the Developer API Evangelism group at Google. He is also one of the original members of the OpenAjax Alliance. Prior to Google, Chris was a Principal Product Manager and Java Evangelist for Oracle's application server and development tools division. While at Oracle, he worked to define the overall web development experience for Oracle JDeveloper and ADF Faces (Trinidad). He is also the co-author of JavaServer Faces: The Complete Reference published through McGraw-Hill Osborne (ISBN: 0072262400) and maintains a popular Blog on J2EE Web development at www.jroller.com/page/cschalk.
More Stories By Michael O'Neill
Michael O'Neill is manager of developer programs at Oracle, with six years of experience in Web and UI development utilizing both Java and Microsoft technologies.
![]() |
Mark 05/01/07 12:47:16 PM EDT | |||
Hi, I have attempted to use the example (http://java.sys-con.com/read/192427.htm)with JDeveloper 10.1.3, and Any comments/suggestions regarding how I can fix this issue would be most appreciated. Details from JDeveloper below. Error(84): Error(84): Thank you |
||||
![]() |
Fred Holahan 03/17/06 10:39:59 AM EST | |||
Guys, I enjoyed your piece entitled "Putting a Face on Web Services and SOA". With regard to BPEL, you really should check out Active Endpoints. We offer a world-class, Eclipse based BPEL designer FOR FREE, and servers that range from our open source ActiveBPEL Engine all the way up to enterprise class BPEL solutions for popular J2EE containers. Readers who want to download the free ActiveBPEL Designer can do so at http://www.active-endpoints.com/products/activebpeldes/index.html. Readers who need access to commercial grade open source BPEL engine can visit http://www.activebpel.org. Fred |
||||
![]() |
SYS-CON Italy News Desk 03/16/06 08:23:04 PM EST | |||
Service-Oriented Architecture (SOA) is a hot topic among analysts, CIOs, and technology marketers, but the path from high-level architectural principles to programming a functioning, real-world service isn't always clear, especially since, in the end, you still need to create a clean user interface that's as flexible as the services it consumes. |
||||
- Kindle 2 vs Nook
- Why IBM’s Server Chief Got Busted
- Is Cloud Computing Like Teenage Sex?
- Industry Experts Discuss the State of Cloud Computing
- Performance Tuning Essentials for Java
- Confessions of a Ulitzer Addict
- Tactical Cloud Computing Panel at 1st Annual GovIT Expo
- It's the Java vs. C++ Shootout Revisited!
- Cloud Computing Can Revitalize Your Career as Software Developer
- IBM Could "Reinvent" Java: Mills
- Oracle & Cloud Computing: Exclusive Q&A with SVP Richard Sarwal
- A Brief History of Cloud Computing
- Kindle 2 vs Nook
- Cloud CEOs, CTOs & SVPs to Speak at 4th International Cloud Computing Expo
- Why IBM’s Server Chief Got Busted
- Is Cloud Computing Like Teenage Sex?
- Industry Experts Discuss the State of Cloud Computing
- Performance Tuning Essentials for Java
- The Difference Between Web Hosting and Cloud Computing
- Cloud Computing Expo: Exclusive Q&A with Yahoo! SVP Cloud Computing
- Ajax in RichFaces 3.3, JSF 2 and RichFaces 4
- Confessions of a Ulitzer Addict
- My Thoughts on Ulitzer
- Tactical Cloud Computing Panel at 1st Annual GovIT Expo
- A Cup of AJAX? Nay, Just Regular Java Please
- Java Developer's Journal Exclusive: 2006 "JDJ Editors' Choice" Awards
- The i-Technology Right Stuff
- JavaServer Faces (JSF) vs Struts
- Rich Internet Applications with Adobe Flex 2 and Java
- Java vs C++ "Shootout" Revisited
- Bean-Managed Persistence Using a Proxy List
- Reporting Made Easy with JasperReports and Hibernate
- Creating a Pet Store Application with JavaServer Faces, Spring, and Hibernate
- What's New in Eclipse?
- Why Do 'Cool Kids' Choose Ruby or PHP to Build Websites Instead of Java?
- i-Technology Predictions for 2007: Where's It All Headed?









































