Building SOA-Based Composite Applications Using NetBeans IDE 6 phần 10 docx

36 310 0
Building SOA-Based Composite Applications Using NetBeans IDE 6 phần 10 docx

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Building a Sample Application [ 252 ] All this is achieved through JMS BC. In case of outbound message ow, where the JMS BC is being invoked by our business process, the JMS BC acts as an external JMS service provider. In this role, the JMS BC converts a normalized message that it receives as part of the message exchange from our process, to a JMS message. After the JMS message is created as a result of the message conversion, the JMS message is sent to JMS destination. The above screenshot shows the NetBeans output when the BPEL process is executed. The NMR message is converted into a valid JMS to send to the queue. Part E – Conditions and Sequence This part introduces the sequencing and branching properties of BPEL. When a request for a reservation is made, the BPEL process checks the destination sector. If the destination is set to 'SFO', then the itinerary is routed to NorthAirWS, otherwise the itinerary is sent to WestAir Web Service. Since WestAir Web Service is new, we create an identical web service using NorthAir Web Service and name it WestAir Web Service. They do not do any actual itinerary processing but they send a conrmation message back to the client so we can nd out which airlines' web service was invoked. So far through the earlier parts of this example, we have created a sequential process to invoke NorthAir Web Service. This process consists of storing and sending itineraries to a JMS physical destination. Ideally, updating the partner airlines repository is independent of itinerary processing. Despite of failed reservations, we update the data store for the purpose of a waiting list (Of course without a conrmed reservation ID). UpdateItinerary sequence is introduced as a ow branch to process itinerary branch, so both the sequences work in parallel. This part also shows how as part of the UpdateAirlines sequence, we send the itinerary information to a travel agent's FTP Server. Uploading itinerary information to an FTP server is done through an FTP binding component. Chapter 10 [ 253 ] Whenever a request for reservation is made, the NorthAir Web Service is invoked and the itinerary data is updated in the SouthAir database. Also, the itinerary information is updated in the le system using the JBI le binding component. This le can be constantly monitored by an external process. Now the itinerary data is sent to EastAir's JMS Queue. EastAir's JMS Queue Listener can get the itinerary information for further processing. The BPEL process also uploads the guest itinerary to a remote FTP server of a travel agent or any AirAlliance partner. Let us create another web service WestAir_WS just like we created NorthAir_WS. Create an EJB module and create a web service from that module. Drag-and-drop WestAir_WS on the BPEL diagram to create the partner link. Building a Sample Application [ 254 ] To make our example simple, let us have the same web service operation as NorthAir Web Service. Chapter 10 [ 255 ] Add an If activity to the BPEL diagram and set a condition as shown in the following screenshot. In our case, the condition returns true if the destination sector matches 'SFO'. If you are comfortable using the BPEL mapper add Equal operator as shown. For information on using BPEL Mapper, refer to Chapter 5 on BPEL Designer. Or you can manually set the condition as shown in the following screenshot: Building a Sample Application [ 256 ] Drag-and-drop Invoke calls of both NorthAir Web Service and WestAir Web Service into the appropriate branches as shown in the following gure. Chapter 10 [ 257 ] So, whenever the guest itinerary has its destination sector as 'SFO', NorthAir WS is invoked. Otherwise WestAir WS is invoked. Now, updating the SouthAir DB, storing the itinerary and sending a JMS message can happen in ow with the sector check. So, add a BPEL ow activity and drag-and-drop InvokeSA, StoreInFile, and SendItinerary invoke blocks to the secondary branch of the ow. Drag-and-drop the check sector block to the primary branch of the ow. Now, irrespective of who processes the request, all partner systems are updated. Building a Sample Application [ 258 ] In the secondary ow branch, let us add one more invoke call that uploads the guest itinerary to a partner FTP server for further processing. For this you need to create one more WSDL le of name UploadItinerary.wsdl. Follow the same steps you have learnt for creating SendItinerary.wsdl but select FTP binding as the binding type. Now let us take a look at UploadItinerary.wsdl: <?xml version="1.0" encoding="UTF-8"?> <definitions name="UploadItinerary" targetNamespace= "http://j2ee.netbeans.org/wsdl/UploadItinerary" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://j2ee.netbeans.org/wsdl/UploadItinerary" xmlns:ns="http://j2ee.netbeans.org/xsd/tableSchema" xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype" xmlns:ftp="http://schemas.sun.com/jbi/wsdl-extensions/ftp/"> <types> <xsd:schema targetNamespace= "http://j2ee.netbeans.org/wsdl/UploadItinerary"> <xsd:import namespace= "http://j2ee.netbeans.org/xsd/tableSchema" schemaLocation="ITINERARY.xsd"/> </xsd:schema> </types> <message name="UploadItineraryOperationRequest"> <part name="inputItinerary" element="ns:ITINERARY"/> </message> <portType name="UploadItineraryPortType"> <operation name="UploadItineraryOperation"> <input name="input1" message= "tns:UploadItineraryOperationRequest"/> </operation> </portType> <binding name="UploadItineraryBinding" type= "tns:UploadItineraryPortType"> <ftp:binding/> <operation name="UploadItineraryOperation"> <ftp:operation/> <input name="input1"> <ftp:message messageName="" messageNamePrefixIB="" messageNamePrefixOB= "" pollIntervalMillis="5000" archive="true" protect="true" stage="true" use="literal" encodingStyle="" messageCorrelate="true" messageRepository="itinerary"/> </input> </operation> </binding> <service name="UploadItineraryService"> Chapter 10 [ 259 ] <port name="UploadItineraryPort" binding= "tns:UploadItineraryBinding"> <ftp:address url= "ftp://userftp:userftp@localhost:21" dirListStyle="UNIX" useUserDefinedHeuristics="false" userDefDirListStyle="" userDefDirListHeuristics="" cmdChannelTimeout="45000" dataChannelTimeout="45000"/> </port> </service> <plnk:partnerLinkType name="UploadItinerary1"> <plnk:role name="UploadItineraryPortTypeRole" portType="tns:UploadItineraryPortType"/> </plnk:partnerLinkType> </definitions> As usual make changes to the binding and service parts of the WSDL document to provide your FTP server information. If you want to run this sample, set up an FTP server or provide a URL to an existing FTP server. Now, drag-and-drop UploadItinerary.wsdl on BPEL diagram to create a partner link. Just as explained in the previous sections, swap roles if necessary. Now our BPEL process diagram looks like this: Building a Sample Application [ 260 ] Now our composite application looks like the following gure. Note that the FTP WSDL port is highlighted. Chapter 10 [ 261 ] From the Source Code – Part E folder Open NorthAirEJB, WestAirEJB, ReservationBPEL and AirAlliance_CA NetBeans project les and go through the code. When you open them for the rst time, you will get a 'Resolve References' warning. You may need to set the correct target server for the EJB module and set the correct path to the ReservationBPEL jar le for the composite application. Also note ProcessReservation.wsdl. This WSDL is the web service that initiates the BPEL process. If you are making changes to the ReservationBP.bpel le in ReservationBPEL project, then you need to update the JBI module again in this project. Right-click this project and choose Edit Application Conguration. You can see seven WSDL ports are congured. Three ports use SOAP bindings, one port uses JDBC binding, one port uses File binding, one port uses JMS binding and one port uses FTP binding. In NetBeans, drill down to Services | Servers | Glasssh V[x] | JBI |Binding Components. If you do not see sun-ftp-binding, download the jar from: http://download.java.net/jbi/binaries/open-jbi-components/main/ nightly/latest/ojc/ Then right-click on Services | Servers | Glasssh V[x] | JBI |Binding Components and choose Install New Binding Components and select the binding component jar that you downloaded from the above link. Testing Part E Source Deploy the project AirAlliance_CA. In the AirAlliance_CA project, under Test | TestReservation, edit input.xml with some values. In the AirAlliance_CA project, execute the TestReservation test case under the Test folder [...]... 16 JDBC Binding Component about 66 consumer 66 necessary files 66 properties 67 provider 66 JMS Binding Component about 68 JMS Queue 68 JMS Topic 68 NetBeans Enterprise Pack support 68 properties 68 , 69 JNDI 40, 68 JSR 208 about 29 features 29 N NetBeans BPEL modules 36 IEP Process Editor 44 SQL module 39 SQL module project, artifacts 39 NetBeans 6. 0 and OpenESB 2.0 differences 22 [ 285 ] Netbeans IDE. .. Component I IEP, Netbeans IDE 6. 0 Continous Query Language 164 event processing tools, need for 160 event processor, expected functionalities 160 event processors, input endpoints 164 event processors, output endpoints 164 event processors, validating 171 IEP editor 165 IEP editor, with operator palette window 166 IEP mechanism 161 IEP module, building 167 -170 IEP palette 165 IEP process 164 IEP projects,... consumer 55 message provider 55 properties 56 properties editing, NetBeans Enterprise Pack 56 FTP Binding Component about 60 configuring 61 message consumer 60 message provider 60 properties 63 , 64 proxy servers support 61 CASA Editor about 20 endpoints, configuring 281 service units, adding 280 WSDL bindings, adding 281 compensation handlers 1 96 composite application about 15, 275, 2 76 architecture 279... differences 22 [ 285 ] Netbeans IDE 6. 0 environment, setting up 23, 24 IEP editor 165 IEP editor, tasks 165 IEP editor, with operator palette 166 installing 22 NetBeans projects about 25 Composite Application project 26 IEP Module project 26 SQL Module project 26 XSLT Module project 26 NetBeans projects, types BPEL Module project 26 NetBeans SOA tools BPEL Designer 10 features 22 Java EE 21 Web Services... create composite applications Out of these, NetBeans SOA tools and OpenESB runtime offer an elegant and intuitive way of creating and editing composite applications NetBeans Project Types NetBeans supports creating composite applications through the Composite Application project type The composite application project is an Ant-based NetBeans project system It allows users to create instances of composite. .. editing 60 SSL Support 60 SOA about 7 composite applications 15, 275 concepts 8, 9 customer service 37 license generation service 37 overview 7 WSDL editor 56 SOAP Binding Component about 64 configuring 64 consumer, providing HTTP SOAP 1.1 services 64 encoding schemes support 64 properties 65 provider 64 SQL Service Assembly 41 SQL Service Engine about 39 SQL DDL (Data Definition Language) 39 [ 2 86 ] T... element 118 about 115 benefits 1 16, 117 documents 1 16 editor 115 entities, refactoring 129, 130 simple web service, building 130-139 WSDL documents about 1 16 binding types 124, 125 creating, within NetBeans IDE 121-124 editing, within NetBeans IDE 125-129 fault, handling 180-183 format 117 Partner view 128 Source view 1 26 structure 117, 118 views 125 WSDL view 1 26 WSDL editor 115 [ 287 ] ... existing, as well as new applications This SOA concept of linking together business processes is the hub of composite applications Composite Applications What essentially is a composite application? 1 A composite application is typically an application built by combining multiple services 2 Functionality of a composite application varies based on the individual components In essence, a composite application... business process? A composite application does that How does a composite application extend SOA? SOA recommends building loosely coupled applications and treating each one of them as independent 'service units' Well-designed composite applications implement this architectural approach by providing an easy way to build business applications They also provide integration of existing applications with other... process, diagram 2 26 components 225 event processing 267 -274 itinerary information, testing 247 itinerary information, uploading to FTP server 252- 261 itinerary information, writing to files 240-247 itinerary information on FTP server, testing 261 JMS messages, sending 247-250 JMS messages, testing 251, 252 mails, sending 262 - 266 multiple web services, testing 239 multiple web services, using 231-239 notification . diagram will look now: Chapter 10 [ 265 ] Now, if you check our sample composite application, it will look like the following gure: Building a Sample Application [ 266 ] From the Source Code –. looks like this: Building a Sample Application [ 260 ] Now our composite application looks like the following gure. Note that the FTP WSDL port is highlighted. Chapter 10 [ 261 ] From the Source. partner services query operations. You should have more of these checks in your real applications. Chapter 10 [ 263 ] For this purpose, we create another web service AAPreProcessor Web Service that

Ngày đăng: 12/08/2014, 09:21

Từ khóa liên quan

Mục lục

  • Building SOA-Based Composite Applications Using NetBeans IDE 6

    • Chapter 10: Building a Sample Application

      • Part E – Conditions and Sequence

        • Testing Part E Source

        • Part F – Sending Mails

          • Testing Part F Source

          • Part G – Event Processing

          • Summary

          • Chapter 11: Composite Applications

            • Role of Composite Applications

            • NetBeans Project Types

            • Workspace

            • Non-Hierarchical Model

              • CASA Editor

              • Summary

              • Index

Tài liệu cùng người dùng

Tài liệu liên quan