Use WBSF to dynamically invoke business services in SOA development, part 2nd (top)

Source: Internet
Author: User
Tags sca web services

Introduction

In the previous article, we introduced the basic concepts and working principles of WBSF Dynamic invocation of business services. WBSF enables us to dynamically invoke business services based on service policies in SOA development. WBSF V6.02 provides an SCA programming model that makes development business services more flexible and convenient. Through a concrete example, this paper describes how to dynamically invoke business services through the WBSF V6.02 SCA programming model. We will formulate service policies based on context attributes, set up assertions based on service content in the Responselistener extension, and extend the context attributes in the update transaction through Contextextractor;

Business Scenarios and Modeling

Business Scenario:

Consider one of the following business scenarios for bank account balance queries: Users submit user names and account names to the account query system, the system first obtains the user Service level through the authorization service, then calls the Account Inquiry service, returns the account balance information to the customer. For the query through the portal channel, the authorized service adopts the HTTP Basic authentication method; For queries through the WebService channel, the authorized service uses the HTTPS client authentication method. For users of different service levels, query services with different processing capabilities will be used.

Business Modeling:

Business process:

Accountqueryprocess: Enter the username and user account. Call Authorizationservice first to obtain the user Service level, and then call the Accountqueryservice query account balance as a return.

Web Services:

Authorizationservice: Enter user name, return user Service level

Accountqueryservice: Enter as account name, return account balance

Preparing a Web Service

To create a accountquerymodule project in WID

Open WID, switch to business integration perspective, and create a new module as shown in Figure 1.

Figure 1 Creating a Accountquerymodule Project

Create Authorization Service:

Create a new Authorizaitonservice interface in Accountquerymodule, which includes the Getservicelevel method, as shown in Figure 2:

Figure 2 Creating the Authorizationservice interface

Open the Accountquerymodule Assembly Diagram and add the AUTHORIZATIONSERVICE_HTTPBA component, which simulates the authorization service using the HTTP Basic authentication method. Add the Authorizaitonservice interface to the component, as shown in Figure 3. Double-click the component to implement the type select Java. The main implementation code is shown in Example 1.

Example 1 AUTHORIZATIONSERVICE_HTTPBA Component implementation

public class AuthorizationService_HTTPBAImpl {
  public String getServiceLevel(String userId) {
 return "SILVER";
  }
  }

Figure 3 Adding the Authorizationservice interface to the component

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.