반응형
Introduction

In this chapter, you will learn to use Oracle Service Bus to

• Mediate Direct Binding service exposed by SOA Suite. You will use a Business Service with the soa-direct protocol in Oracle Service Bus.
• Use Dynamic Routing in the Proxy Service Message Flow to dynamically route between Business Services
• Use Direct Binding Reference in SOA composite to invoke OSB Proxy Service with SB transport protocol

Pega Corporation’s POProcessing application has been in production for some time. This application is being extensively leveraged by the Mega Corporation to submit purchase orders. Increasing order volumes have brought in increasing demands for customer satisfaction and/or order visibility/reliability. After extensive discussions, the IT departments of both companies agreed that having transaction (and security) context propagation between the two systems will enable meeting the growing demands for customer satisfaction through improved transaction visibility/reliability.

Luckily for Pega Corporation, the timing of this decision could not be better. Oracle recently released SOA Suite 11gR1 PS2 that supports a new binding called Direct Binding, which allows invoking SOA components over RMI with transaction and security context propagation from the client. Pega Corporation decides to upgrade to SOA Suite 11gR1 PS2 to leverage the Direct Binding for POProcessing.

Mega Corporation will test the new binding starting with orders with low value. Orders less than $1000 will be routed to the Direct Binding service, while orders of greater value will continue to be routed to the WS Binding service.

Once this section is complete the execution flow of Receive PO in the Mega Corporation will look as follows



In addition, Pega Corporation decides to use Direct Binding reference in the POProcessing composite to invoke the Credit Card validation (composite) service that is virtualized using OSB. This enables POProcessing composite to propagate transaction and security context into OSB. Pega Corporation decides to test the Direct Binding using a test credit card. Hence, logic (BPEL) in the POProcessing composite is updated to use the Direct Binding reference if the credit card number is 1234-1234-1234-1234. For other credit cards the WS Binding reference will be used as before.

Once this section is complete the credit card validation flow will look as follows






OSB to SOA Suite Direct binding

What is being done?

In this section, you will add a Direct Binding service to the POProcessing Composite. You will invoke the Direct Binding service from OSB using Business Service with soadirect protocol.

Following steps will be performed
• JDeveloper - Create Direct Binding exposed service in the POProcessing Composite.
• OSB Console - Create Business Service with soa-direct protocol using the WSDL for the Direct Binding service in SOA.
• OSB Console - Update Message Flow for the receivePO_db Proxy Service with a Dynamic Routing action to Create Direct Binding exposed service in POProcessing Composite


Create Direct Binding exposed service in POProcessing Composite

DIrect Binding 컴포넌트를 "Exposed Services" 영역에 추가합니다.



Name: receivePODirect

WSDL URL 오른쪽에 찾기 버튼 클릭.



현재 자신의 프로젝트 폴더에서 receivePO.wsdl 파일을 선택합니다.



Port Type: exeute_ppt



receivePODirect 컴포터는와 routePO 컴포넌트를 연결합니다.



연결 완료.




재배치 합니다.





Create soa-direct Business Service in Oracle Service Bus

http://hostname:7011/soa-infra 로 접속합니다.

아이디 비밀번호 입력.



receivePODirect 의 wsdl 주소를 복사해 놓습니다.



OSB 콘솔로 접속합니다.

POProcessing - Resources 폴더에서 리소스를 만듭니다. (Resources from URL)



URL/Path: 붙여넣기
Resource Name: receivePODirect
Resource Type: WSDL



Import 버튼 클릭.



POProecssing - BusinessServies 폴더에서 비지니스 서비스(Business Service)를 만듭니다.



Service Name: receivePODirect

WSDL Web Service 오른쪽의 Browse... 버튼 클릭.



POProcessing/Resources/receivePODirect 선택.

Port: receivePODirectDirectBindingPort11

Submit 버튼 클릭.



Next 버튼 클릭.



Last 버튼 클릭.

Save 버튼 클릭.


Update receivePO_db Proxy Service Message Flow

POProcessing - ProxyServices 폴더에서 receivePO_db(Proxy Service)의 메세지 흐름을 편집합니다.



RouteNode1 수정.



기존에 있던 Route 액션을 삭제합니다.



Communication - Dynamic Routing 액션을 추가합니다.



<Expression> 클릭



네임스페이스를 추가합니다.

Prefix: ord
URI: http://xmlns.oracle.com/ns/order



XQuery 입력.

let $total := $body/ord:PurchaseOrder/ord:price * $body/ord:PurchaseOrder/ord:quantity
return
  <ctx:route>
     {
       <ctx:service isProxy="false">
         {
           if ($total < 1000)
           then "POProcessing/BusinessServices/receivePODirect"
           else "POProcessing/BusinessServices/receivePO"
         }
        </ctx:service>,
        <ctx:operation>execute</ctx:operation>
     }
  </ctx:route>

Save All 버튼 클릭.



Save All 버튼 클릭.

수정사항 적용(Activate)


Test 1

Requisition - ProxyServices 폴더에서 createRequisition 서비스를 테스트 합니다.



$1000 미만으로 데이터를 입력합니다.

<cre:OsbRequisitionCollection
 xmlns:cre="http://xmlns.oracle.com/pcbpel/adapter/db/top/createRequisition">
    <cre:OsbRequisition>
        <cre:requisitioner>Bob</cre:requisitioner>
        <cre:reqid>2222</cre:reqid>
        <cre:productname>iPod Shuffle</cre:productname>
        <cre:item>1GB</cre:item>
        <cre:itemtype>Electronics</cre:itemtype>
        <cre:reqDate>March 16, 2010</cre:reqDate>
        <cre:description>string</cre:description>
        <cre:quantity>1.00</cre:quantity>
        <cre:price>500.00</cre:price>
        <cre:currency>USD</cre:currency>
        <cre:deliverydate>April 16, 2010</cre:deliverydate>
        <cre:plant>Boulder</cre:plant>
        <cre:cctype>Mastercard</cre:cctype>
        <cre:ccnumber>8765-8765-8765-8765</cre:ccnumber>
    </cre:OsbRequisition>
</cre:OsbRequisitionCollection>


EM에서 실행된 인스턴스(POProcessing)를 확인해보면 receivePODirect 다이렉트 바인딩 서비스가 실행되었습니다.



Test 2

$1000 이상의 데이터를 입력하면 receivePO 웹서비스가 실행됩니다.




SOA SUite to OSB Direct Binding

What is being done?

In this section, you will expose the virtualized validationForCC Composite service using the SB transport protocol (This is in addition to the HTTP Proxy Service that virtualized the same service in Chapter 1). SB Protocol allows invoking (from SOA Suite or OSB) OSB Proxy Service over RMI. POProcessing composite will use the Direct Binding reference to invoke the Proxy Service with SB transport protocol.

Following steps will be performed
• OSB Console - Create Proxy Service with SB transport protocol routing to validationForCC Business Service.
• JDeveloper – Create Direct Binding reference, pointing to the SB transport protocol Proxy Service, in the POProcessing composite
• JDeveloper - Update approveLargeOrder BPEL to invoke Direct Binding reference when credit card number is 1234-1234-1234-1234. Otherwise, the WS Binding reference is invoked.


Create SB transport protocol Proxy Service in OSB

Credit_Services - ProxyServices 폴더에서 Proxy Service 를 만듭니다.



Service Name: ValidateCredit_SB

Business Service 오른쪽의 Browse... 버튼 클릭.



Credit_Services/BusinessServices/validationForCC 선택 후 Submit 버튼 클릭.



Next 버튼 클릭.


Protocol: sb

Next 버튼 클릭.



Last 버튼 클릭.



Save 버튼 클릭.



추가한 ValidateCredit_SB(Proxy Service) 서비스의 메세지 흐름을 수정합니다.



Pipeline Pair 추가.



요청 파이프라인(Request Pipeline)에 Stage 추가



stage1 수정.



Reporting - Report 액션 추가.



Report: $body
Key Name: CCNumber-SB
XPath: ./cca:creditcardStatusRequest/cca:CCNumber
variable: body



Save All 버튼 클릭.

모든 수정사항 적용.(Activate)


Create Direct Binding reference in POProcessing Composite

JDeveloper 실행 후 POProcessing의 comsoite.xml 파일을 열어 수정합니다.

Direct Binding 컴포넌트를 추가합니다.



Name: DirectGetCCStatus
Reference Target: Oracle Service Bus

WSDL URL 오른쪽의 찾기 버튼 클릭.



ValidateCredit_SB (direct) 선택.



OK 클릭.



아래와 같이 추가되었습니다.



approveLargeOrder 컴포넌트(BPEL) 과 DirectGetCCStatus 컴포넌트를 연결합니다.



아래와 같이 연결 되었습니다.




Update approveLargeOrder BPEL to selectively invoke Direct Binding reference

approveLargeOrder(BPEL)를 수정합니다.



기존에 있던 "invokeCCStatusService" 액티브티를 삭제합니다.



assignCCNumber 액티브티 아래에 Switch 액티브티를 추가합니다.



<condition> 클릭 후 XPath Expression Builder... 버튼을 클릭합니다.



bpws:getVariableData('inputVariable','payload','/ns2:Order/ns2:creditCardInfo/ns2:cardNumber') = '1234-1234-1234-1234'



OK 클릭.



조건 분기쪽에 Invock 액티브티를 추가합니다.



Invoke1 액티브티와 DirectGetCCStatus 레퍼런스를 연결합니다.



Name: directGetCCStatus

Variables - Input 오른쪽에 찾기 버튼 클릭.



기존에 만들어져 있던 "invokeCCStatusService_execute_InputVariable" 선택



Output 오른쪽의 찾기 버튼 클릭.



"invokeCCStatusService_execute_OutputVariable" 선택



OK 버튼 클릭.



otherwise 분기에 Invoke 액티브티를 추가합니다.



Invoke1 액티브티와 getCreditCardStatus 레버런스를 연결합니다.



Name: getGreditCardStatus
Input: invokeCCStatusService_execute_InputVariable
Output: invokeCCStatusService_execute_OutputVariable

OK 버튼 클릭.



모두 저장합니다.



재배치 합니다.



덮어쓰기 옵션 채크.



Taskflow 프로젝트는 포함하지 않습니다.



Test 1

Requisition - ProxyServices 폴더에서 createRequisition 서비스를 테스트합니다.

금액(quantity * price)이 $1000 를 넘게 하고 카드 번호는 "1234-1234-1234-1234" 로 입력합니다.

테스트 후의 Report 입니다.



EM 에서 확인해보면 카드 조회하는 부분이 다이렉트 바인딩(Direct Binding)으로 실행되었습니다.




Test 2

똑같이 금액은 $1000가 넘게 하고, 카드번호를 다른걸 넣어봅시다.

테스트 후 Report 입니다.



EM 에서 확인해보면 웹서비스(Web Service)로 실행된 것을 볼 수 있습니다.






반응형
//