BPEL实例运行[1]——改写源码

本文详细介绍了一种将Oracle上的BPEL实例移植到ActiveBPEL平台的方法,并概述了实例涉及的服务及流程。该实例关注于雇员出差安排流程,包括与不同航空公司的交互和服务调用。

本文介绍了如何把Oracle的一个BPEL实例改写后部署到ActiveBpel上,并运行该实例。欢迎大家对其中的错误给予指正~

该实例的业务逻辑详见http://searchwebservices.techtarget.com.cn/tips/4/2551504.shtml,此教程详细描述了实例所涉及到的3个wsdl文件以及4个bpel文件,并介绍如何部署到Oracle的BPEL服务器。实例的运行需要用到Oracle BPEL Process Manager ,它提供了一个 BPEL 控制台,通过它可以在 BPEL 服务器域中执行、监视、管理和调试 BPEL 流程。

实例简介:

定义雇员出差安排的简化业务流程:客户端调用此业务流程,指定雇员姓名、目的地、出发日期以及返回日期。此 BPEL 业务流程首先检查雇员出差状态。假设存在一个可用于进行此类检查的 Web 服务。然后,此 BPEL 流程将检查以下两家航空公司的机票价格:美国航空公司和达美航空公司。再次假设这两家航空公司均提供了可用于进行此类检查的 Web 服务。最后,此 BPEL 流程将选择较低的价格并将出差计划返回给客户端。

Oracle版的实例源码可以下到,为了使它可以运行到ActiveBpel之下,首先要改变其文件目录结构。

ActiveBPEL Designer(V3.0)下新建一个工程,命名为AirLine

新建四个文件夹,分别命名为bpel,META-INF,pdd,wsdl.

在bpel文件夹下新建5个BPEL流程文件,这5个中,client.bpel是Oracle的实例中原来没有的,其他4个原先都有。现把它们的代码粘贴如下:

美国航空公司AmericanAirline.bpel

 

<? xml version="1.0" encoding="UTF-8" ?>
<!--
BPEL Process Definition
Edited using ActiveBPEL(tm) Designer Version 3.0.0 (http://www.active-endpoints.com)
-->
<!--  Airline  -->
< bpws:process  xmlns:aln ="http://packtpub.com/service/airline/"  xmlns:bpws ="http://schemas.xmlsoap.org/ws/2003/03/business-process/"  xmlns:ns1 ="http://packtpub.com/service/employee/"  xmlns:xsd ="http://www.w3.org/2001/XMLSchema"  name ="AmericanAirline"  targetNamespace ="http://packtpub.com/service/airline/" >
   
< bpws:partnerLinks >
      
< bpws:partnerLink  myRole ="airlineService"  name ="AmericanAirlines"  partnerLinkType ="aln:flightLT"  partnerRole ="airlineCustomer" />
   
</ bpws:partnerLinks >
   
< bpws:variables >
      
<!--  input  -->
      
< bpws:variable  messageType ="aln:FlightTicketRequestMessage"  name ="FlightDetails" />
      
<!--  output from American Airlines  -->
      
< bpws:variable  messageType ="aln:TravelResponseMessage"  name ="FlightResponseAA" />
   
</ bpws:variables >
   
< bpws:sequence >
      
<!--  Receive the initial request  -->
      
< bpws:receive  createInstance ="yes"  operation ="FlightAvailability"  partnerLink ="AmericanAirlines"  portType ="aln:FlightAvailabilityPT"  variable ="FlightDetails" />
      
<!--  Prepare the output  -->
      
< bpws:assign >
         
< bpws:copy >
            
< bpws:from >
               
< confirmationData  xmlns ="http://packtpub.com/service/airline/" >
             
< FlightNo > 123 </ FlightNo >
             
< TravelClass > Economy </ TravelClass >
             
< Price > 120 </ Price >
             
< DepartureDateTime > 2004-01-01T12:12:12+08:00 </ DepartureDateTime >
             
< ReturnDateTime > 2004-01-05T12:12:12+08:00 </ ReturnDateTime >
             
< Approved > true </ Approved >
            
</ confirmationData >
            
</ bpws:from >
            
< bpws:to  part ="confirmationData"  variable ="FlightResponseAA" />
         
</ bpws:copy >
      
</ bpws:assign >
      
<!--  Make a callback  -->
      
< bpws:invoke  inputVariable ="FlightResponseAA"  operation ="FlightTicketCallback"  partnerLink ="AmericanAirlines"  portType ="aln:FlightCallbackPT" />
   
</ bpws:sequence >
</ bpws:process >

达美航空公司DeltaAirline.bpel

 

<? xml version="1.0" encoding="UTF-8" ?>
<!--
BPEL Process Definition
Edited using ActiveBPEL(tm) Designer Version 3.0.0 (http://www.active-endpoints.com)
-->
<!--  Airline  -->
< bpws:process  xmlns:aln ="http://packtpub.com/service/airline/"  xmlns:bpws ="http://schemas.xmlsoap.org/ws/2003/03/business-process/"  xmlns:ns1 ="http://packtpub.com/service/employee/"  xmlns:xsd ="http://www.w3.org/2001/XMLSchema"  name ="DeltaAirline"  targetNamespace ="http://packtpub.com/service/airline/" >
   
< bpws:partnerLinks >
      
< bpws:partnerLink  myRole ="airlineService"  name ="DeltaAirlines"  partnerLinkType ="aln:flightLT"  partnerRole ="airlineCustomer" />
   
</ bpws:partnerLinks >
   
< bpws:variables >
      
<!--  input  -->
      
< bpws:variable  messageType ="aln:FlightTicketRequestMessage"  name ="FlightDetails" />
      
<!--  output from Delta Airlines  -->
      
< bpws:variable  messageType ="aln:TravelResponseMessage"  name ="FlightResponseDA" />
   
</ bpws:variables >
   
< bpws:sequence >
      
<!--  Receive the initial request  -->
      
< bpws:receive  createInstance ="yes"  operation ="FlightAvailability"  partnerLink ="DeltaAirlines"  portType ="aln:FlightAvailabilityPT"  variable ="FlightDetails" />
      
<!--  Prepare the output  -->
      
< bpws:assign >
         
< bpws:copy >
            
< bpws:from >
               
< confirmationData  xmlns ="http://packtpub.com/service/airline/" >

             
< FlightNo > 123 </ FlightNo >
             
< TravelClass > Economy </ TravelClass >
             
< Price > 140 </ Price >
             
< DepartureDateTime > 2004-01-01T12:12:12+08:00 </ DepartureDateTime >
             
< ReturnDateTime > 2004-01-05T12:12:12+08:00 </ ReturnDateTime >
             
< Approved > true </ Approved >
            
</ confirmationData >
            
</ bpws:from >
            
< bpws:to  part ="confirmationData"  variable ="FlightResponseDA" />
         
</ bpws:copy >
      
</ bpws:assign >
      
<!--  Make a callback  -->
      
< bpws:invoke  inputVariable ="FlightResponseDA"  operation ="FlightTicketCallback"  partnerLink ="DeltaAirlines"  portType ="aln:FlightCallbackPT" />
   
</ bpws:sequence >
</ bpws:process >

 

 雇员状态Employee.bpel

 

<? xml version="1.0" encoding="utf-8" ?>  

<!--  Employee  -->

< process  name ="Employee"  
         targetNamespace
="http://packtpub.com/service/employee/"  
         xmlns
="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
         xmlns:emp
="http://packtpub.com/service/employee/"   >
   
   
< partnerLinks >
      
< partnerLink  name ="employeeTravelStatus"  
                   partnerLinkType
="emp:employeeLT"
                   myRole
="employeeTravelStatusService" />

   
</ partnerLinks >

   
< variables >
      
<!--  input for this process  -->       
      
< variable  name ="EmployeeTravelStatusRequest"  messageType ="emp:EmployeeTravelStatusRequestMessage" />
      
<!--  output from the Employee Travel Status web service  -->
      
< variable  name ="EmployeeTravelStatusResponse"  messageType ="emp:EmployeeTravelStatusResponseMessage" />
   
</ variables >

   
< sequence >

      
<!--  Receive the initial request for business travel from client  -->
      
< receive  partnerLink ="employeeTravelStatus"  
               portType
="emp:EmployeeTravelStatusPT"  
               operation
="EmployeeTravelStatus"  
               variable
="EmployeeTravelStatusRequest"
               createInstance
="yes"   />

      
<!--  Prepare the output  -->
      
< assign >
        
< copy >
          
< from  expression ="string('Economy')" />
          
< to  variable ="EmployeeTravelStatusResponse"  part ="travelClass" />
        
</ copy >
      
</ assign >
      
      
<!--  Send a response  -->
      
< reply  partnerLink ="employeeTravelStatus"  
             portType
="emp:EmployeeTravelStatusPT"  
             operation
="EmployeeTravelStatus"  
             variable
="EmployeeTravelStatusResponse" />
   
</ sequence >

</ process >

 

主流程Travel.bpel

 

<? xml version="1.0" encoding="UTF-8" ?>
<!--
BPEL Process Definition
Edited using ActiveBPEL(tm) Designer Version 3.0.0 (http://www.active-endpoints.com)
-->
<!--  Asynchrnous BPEL process  -->
< bpws:process  xmlns:aln ="http://packtpub.com/service/airline/"  xmlns:bpws ="http://schemas.xmlsoap.org/ws/2003/03/business-process/"  xmlns:emp ="http://packtpub.com/service/employee/"  xmlns:ns1 ="http://example.com/loan-approval/wsdl/"  xmlns:trv ="http://packtpub.com/bpel/travel/"  xmlns:xsd ="http://www.w3.org/2001/XMLSchema"  name ="BusinessTravelProcess"  targetNamespace ="http://packtpub.com/bpel/travel/" >
   
< bpws:partnerLinks >
      
< bpws:partnerLink  myRole ="travelService"  name ="client"  partnerLinkType ="trv:travelLT"  partnerRole ="travelServiceCustomer" />
      
< bpws:partnerLink  name ="employeeTravelStatus"  partnerLinkType ="emp:employeeLT"  partnerRole ="employeeTravelStatusService" />
      
< bpws:partnerLink  myRole ="airlineCustomer"  name ="AmericanAirlines"  partnerLinkType ="aln:flightLT"  partnerRole ="airlineService" />
      
< bpws:partnerLink  myRole ="airlineCustomer"  name ="DeltaAirlines"  partnerLinkType ="aln:flightLT"  partnerRole ="airlineService" />
   
</ bpws:partnerLinks >
   
< bpws:variables >
      
<!--  input for this process  -->
      
< bpws:variable  messageType ="trv:TravelRequestMessage"  name ="TravelRequest" />
      
<!--  input for the Employee Travel Status web service  -->
      
< bpws:variable  messageType ="emp:EmployeeTravelStatusRequestMessage"  name ="EmployeeTravelStatusRequest" />
      
<!--  output from the Employee Travel Status web service  -->
      
< bpws:variable  messageType ="emp:EmployeeTravelStatusResponseMessage"  name ="EmployeeTravelStatusResponse" />
      
<!--  input for American and Delta web services  -->
      
< bpws:variable  messageType ="aln:FlightTicketRequestMessage"  name ="FlightDetails" />
      
<!--  output from American Airlines  -->
      
< bpws:variable  messageType ="aln:TravelResponseMessage"  name ="FlightResponseAA" />
      
<!--  output from Delta Airlines  -->
      
< bpws:variable  messageType ="aln:TravelResponseMessage"  name ="FlightResponseDA" />
      
<!--  output from BPEL process  -->
      
< bpws:variable  messageType ="aln:TravelResponseMessage"  name ="TravelResponse" />
   
</ bpws:variables >
   
< bpws:sequence >
      
<!--  Receive the initial request for business travel from client  -->
      
< bpws:receive  createInstance ="yes"  operation ="TravelApproval"  partnerLink ="client"  portType ="trv:TravelApprovalPT"  variable ="TravelRequest" />
      
<!--  Prepare the input for the Employee Travel Status Web Service  -->
      
< bpws:assign >
         
< bpws:copy >
            
< bpws:from  part ="employee"  variable ="TravelRequest" />
            
< bpws:to  part ="employee"  variable ="EmployeeTravelStatusRequest" />
         
</ bpws:copy >
      
</ bpws:assign >
      
<!--  Synchronously invoke the Employee Travel Status Web Service  -->
      
< bpws:invoke  inputVariable ="EmployeeTravelStatusRequest"  operation ="EmployeeTravelStatus"  outputVariable ="EmployeeTravelStatusResponse"  partnerLink ="employeeTravelStatus"  portType ="emp:EmployeeTravelStatusPT" />
      
<!--  Prepare the input for AA and DA  -->
      
< bpws:assign >
         
< bpws:copy >
            
< bpws:from  part ="flightData"  variable ="TravelRequest" />
            
< bpws:to  part ="flightData"  variable ="FlightDetails" />
         
</ bpws:copy >
         
< bpws:copy >
            
< bpws:from  part ="travelClass"  variable ="EmployeeTravelStatusResponse" />
            
< bpws:to  part ="travelClass"  variable ="FlightDetails" />
         
</ bpws:copy >
      
</ bpws:assign >
      
<!--  Make a concurrent invocation to AA in DA  -->
      
< bpws:flow >
         
< bpws:sequence >
            
<!--  Async invoke of the AA web service and wait for the callback  -->
            
< bpws:invoke  inputVariable ="FlightDetails"  operation ="FlightAvailability"  partnerLink ="AmericanAirlines"  portType ="aln:FlightAvailabilityPT" />
            
< bpws:receive  operation ="FlightTicketCallback"  partnerLink ="AmericanAirlines"  portType ="aln:FlightCallbackPT"  variable ="FlightResponseAA" />
         
</ bpws:sequence >
         
< bpws:sequence >
            
<!--  Async invoke of the DA web service and wait for the callback  -->
            
< bpws:invoke  inputVariable ="FlightDetails"  operation ="FlightAvailability"  partnerLink ="DeltaAirlines"  portType ="aln:FlightAvailabilityPT" />
            
< bpws:receive  operation ="FlightTicketCallback"  partnerLink ="DeltaAirlines"  portType ="aln:FlightCallbackPT"  variable ="FlightResponseDA" />
         
</ bpws:sequence >
      
</ bpws:flow >
      
<!--  Select the best offer and construct the TravelResponse  -->
      
< bpws:switch >
         
< bpws:case  condition ="bpws:getVariableData('FlightResponseAA', 'confirmationData', '/confirmationData/aln:Price')&lt;= bpws:getVariableData('FlightResponseDA', 'confirmationData', '/confirmationData/aln:Price')" >
            
<!--  Select American Airlines  -->
            
< bpws:assign >
               
< bpws:copy >
                  
< bpws:from  variable ="FlightResponseAA" />
                  
< bpws:to  variable ="TravelResponse" />
               
</ bpws:copy >
            
</ bpws:assign >
         
</ bpws:case >
         
< bpws:otherwise >
            
<!--  Select Delta Airlines  -->
            
< bpws:assign >
               
< bpws:copy >
                  
< bpws:from  variable ="FlightResponseDA" />
                  
< bpws:to  variable ="TravelResponse" />
               
</ bpws:copy >
            
</ bpws:assign >
         
</ bpws:otherwise >
      
</ bpws:switch >
      
<!--  Make a callback to the client  -->
      
< bpws:invoke  inputVariable ="TravelResponse"  operation ="ClientCallback"  partnerLink ="client"  portType ="trv:ClientCallbackPT" />
   
</ bpws:sequence >
</ bpws:process >

 

调用主流程的客户端Client.bpel

 

<? xml version="1.0" encoding="UTF-8" ?>
<!--
BPEL Process Definition
Edited using ActiveBPEL(tm) Designer Version 3.0.0 (http://www.active-endpoints.com)
-->
< bpel:process  xmlns:aln ="http://packtpub.com/service/airline/"  xmlns:bpel ="http://docs.oasis-open.org/wsbpel/2.0/process/executable"  xmlns:cli ="http://packtpub.com/bpel/client/"  xmlns:emp ="http://packtpub.com/service/employee/"  xmlns:ns1 ="http://example.com/loan-approval/wsdl/"  xmlns:trv ="http://packtpub.com/bpel/travel/"  xmlns:xsd ="http://www.w3.org/2001/XMLSchema"  name ="Client"  suppressJoinFailure ="yes"  targetNamespace ="http://Client" >
   
< bpel:import  importType ="http://schemas.xmlsoap.org/wsdl/"  location ="../wsdl/Airline.wsdl"  namespace ="http://packtpub.com/service/airline/" />
   
< bpel:import  importType ="http://schemas.xmlsoap.org/wsdl/"  location ="../wsdl/Employee.wsdl"  namespace ="http://packtpub.com/service/employee/" />
   
< bpel:import  importType ="http://schemas.xmlsoap.org/wsdl/"  location ="../wsdl/Travel.wsdl"  namespace ="http://packtpub.com/bpel/travel/" />
   
< bpel:import  importType ="http://schemas.xmlsoap.org/wsdl/"  location ="../wsdl/Client.wsdl"  namespace ="http://packtpub.com/bpel/client/" />
   
< bpel:import  importType ="http://schemas.xmlsoap.org/wsdl/"  location ="file:/E:/activeBPEL/Samples/Completed Tutorial/WSDL/loanServicePT.wsdl"  namespace ="http://example.com/loan-approval/wsdl/" />
   
< bpel:partnerLinks >
      
< bpel:partnerLink  myRole ="travelService"  name ="client"  partnerLinkType ="cli:clientLT" />
      
< bpel:partnerLink  myRole ="travelServiceCustomer"  name ="travel"  partnerLinkType ="trv:travelLT"  partnerRole ="travelService" />
   
</ bpel:partnerLinks >
   
< bpel:variables >
      
< bpel:variable  messageType ="trv:TravelRequestMessage"  name ="travelRequest" />
      
< bpel:variable  messageType ="aln:TravelResponseMessage"  name ="travelResponse" />
   
</ bpel:variables >
   
< bpel:flow >
      
< bpel:links >
         
< bpel:link  name ="receive-to-invoke" />
         
< bpel:link  name ="invoke-to-receive" />
         
< bpel:link  name ="receive-to-reply" />
      
</ bpel:links >
      
< bpel:receive  createInstance ="yes"  operation ="TravelApproval"  partnerLink ="client"  portType ="cli:TravelApprovalPT"  variable ="travelRequest" >
         
< bpel:sources >
            
< bpel:source  linkName ="receive-to-invoke" />
         
</ bpel:sources >
      
</ bpel:receive >
      
< bpel:reply  operation ="TravelApproval"  partnerLink ="client"  portType ="cli:TravelApprovalPT"  variable ="travelResponse" >
         
< bpel:targets >
            
< bpel:target  linkName ="receive-to-reply" />
         
</ bpel:targets >
      
</ bpel:reply >
      
< bpel:invoke  inputVariable ="travelRequest"  operation ="TravelApproval"  partnerLink ="travel"  portType ="trv:TravelApprovalPT" >
         
< bpel:targets >
            
< bpel:target  linkName ="receive-to-invoke" />
         
</ bpel:targets >
         
< bpel:sources >
            
< bpel:source  linkName ="invoke-to-receive" />
         
</ bpel:sources >
      
</ bpel:invoke >
      
< bpel:receive  operation ="ClientCallback"  partnerLink ="travel"  portType ="trv:ClientCallbackPT"  variable ="travelResponse" >
         
< bpel:targets >
            
< bpel:target  linkName ="invoke-to-receive" />
         
</ bpel:targets >
         
< bpel:sources >
            
< bpel:source  linkName ="receive-to-reply" />
         
</ bpel:sources >
      
</ bpel:receive >
   
</ bpel:flow >
</ bpel:process >

       Client.bpel,该流程用于调用Travel.bpel流程,接收Travel.bpel的回调,并将结果返回。

在这个流程的<partnerLines>的部分定义了两个partnerLink,一个是用于接收客户端调用的”client”,这是一个同步调用,因此只指定一个角色,另一个是用于调用Travel.bpel流程和接收回调的”travel”,这个调用是异步的,因此指定两个角色。

    < bpel:partnerLinks >
       
< bpel:partnerLink  myRole ="travelService"  name ="client"  partnerLinkType ="cli:clientLT" />
       
< bpel:partnerLink  myRole ="travelServiceCustomer"  name ="travel"  partnerLinkType ="trv:travelLT"  partnerRole ="travelService" />
    
</ bpel:partnerLinks >

 

<variables> 标签中定义了两个变量,用于接收数据和返回数据,其 messageType 分别为 trv:TravelRequestMessage aln:TravelResponseMessage
这个流程在活动定义的部分没有使用 sequence 标签而使用了 flow 标签,因而为了让一个活动在结束以后可以跳转到下一个活动,在开始的部分定义了 3 个链接 (link) ,分别用于四个活动之间的跳转。

 

  < bpel:flow >
<!-- define the links -->
       
< bpel:links >
          
< bpel:link  name ="receive-to-invoke" />
          
< bpel:link  name ="invoke-to-receive" />
          
< bpel:link  name ="receive-to-reply" />
       
</ bpel:links >

 

 
      在活动中,如果需要跳转,则完成 <source> 标签,指明所使用的 linkName 表示此活动为该链接的源。而如果该活动需要由别的活动跳转到,则需要完成 <targer> 标签,指明所使用的 linkName ,表示此活动为该链接的目标。如下 :

 

       < bpel:receive  createInstance ="yes"  operation ="TravelApproval"  partnerLink ="client"  portType ="cli:TravelApprovalPT"  variable ="travelRequest" >
          
< bpel:sources >
             
< bpel:source  linkName ="receive-to-invoke" />
          
</ bpel:sources >
       
</ bpel:receive >
       
< bpel:reply  operation ="TravelApproval"  partnerLink ="client"  portType ="cli:TravelApprovalPT"  variable ="travelResponse" >
         
< bpel:targets >
            
< bpel:target  linkName ="receive-to-reply" />
          
</ bpel:targets >
       
</ bpel:reply >
       
< bpel:invoke  inputVariable ="travelRequest"  operation ="TravelApproval"  partnerLink ="travel"  portType ="trv:TravelApprovalPT" >
          
< bpel:targets >
             
< bpel:target  linkName ="receive-to-invoke" />
          
</ bpel:targets >
          
< bpel:sources >
             
< bpel:source  linkName ="invoke-to-receive" />
          
</ bpel:sources >
       
</ bpel:invoke >

 

4个WSDL文件,分别描述了四种服务,其中,AmericanAirline和DeltaAirline用的是同一个WSDL文件,统称航空公司Airline。

航空公司Airline.wsdl

 

<? xml version="1.0" encoding="utf-8"  ?>  
< definitions  xmlns:http ="http://schemas.xmlsoap.org/wsdl/http/"  
             xmlns:soap
="http://schemas.xmlsoap.org/wsdl/soap/"  
             xmlns:xs
="http://www.w3.org/2001/XMLSchema"  
             xmlns:soapenc
="http://schemas.xmlsoap.org/soap/encoding/"  
             xmlns:emp
="http://packtpub.com/service/employee/"  
             xmlns:tns
="http://packtpub.com/service/airline/"  
             targetNamespace
="http://packtpub.com/service/airline/"  
             xmlns
="http://schemas.xmlsoap.org/wsdl/"
             xmlns:plnk
="http://schemas.xmlsoap.org/ws/2003/05/partner-link/"   >

< import  namespace ="http://packtpub.com/service/employee/"  
        
        location
="./Employee.wsdl" />

< types >
  
< xs:schema  elementFormDefault ="qualified"  
             targetNamespace
="http://packtpub.com/service/airline/" >

    
< xs:complexType  name ="FlightRequestType" >
      
< xs:sequence >
        
< xs:element  name ="OriginFrom"  type ="xs:string"   />  
        
< xs:element  name ="DestinationTo"  type ="xs:string"   />  
        
< xs:element  name ="DesiredDepartureDate"  type ="xs:date"   />  
        
< xs:element  name ="DesiredReturnDate"  type ="xs:date"   />  
      
</ xs:sequence >
    
</ xs:complexType >
    
    
< xs:simpleType  name ="TravelClassType" >
      
< xs:restriction  base ="xs:string" >
        
< xs:enumeration  value ="Economy" />
        
< xs:enumeration  value ="Business" />
        
< xs:enumeration  value ="First" />
      
</ xs:restriction >
    
</ xs:simpleType >
    

    
< xs:complexType  name ="FlightConfirmationType" >
      
< xs:sequence >
        
< xs:element  name ="FlightNo"  type ="xs:string"   />  
        
< xs:element  name ="TravelClass"  type ="tns:TravelClassType"   />  
        
< xs:element  name ="Price"  type ="xs:float"   />  
        
< xs:element  name ="DepartureDateTime"  type ="xs:dateTime"   />  
        
< xs:element  name ="ReturnDateTime"  type ="xs:dateTime"   />  
        
< xs:element  name ="Approved"  type ="xs:boolean"   />  
      
</ xs:sequence >
    
</ xs:complexType >

  
</ xs:schema >
  
  
< xs:schema  elementFormDefault ="qualified"  
             targetNamespace
="http://packtpub.com/service/employee/" >
    
    
< xs:simpleType  name ="TravelClassType" >
      
< xs:restriction  base ="xs:string" >
        
< xs:enumeration  value ="Economy" />
        
< xs:enumeration  value ="Business" />
        
< xs:enumeration  value ="First" />
      
</ xs:restriction >
    
</ xs:simpleType >

  
</ xs:schema >
</ types >

< message  name ="FlightTicketRequestMessage" >
  
< part  name ="flightData"  type ="tns:FlightRequestType"   />  
  
< part  name ="travelClass"  type ="emp:TravelClassType"   />
</ message >

< message  name ="TravelResponseMessage" >
  
< part  name ="confirmationData"  type ="tns:FlightConfirmationType"   />
</ message >

< portType  name ="FlightAvailabilityPT" >
  
< operation  name ="FlightAvailability" >
    
< input  message ="tns:FlightTicketRequestMessage"   />  
  
</ operation >
</ portType >

<!--  Implemented by the BPEL process  -->
< portType  name ="FlightCallbackPT" >
  
< operation  name ="FlightTicketCallback" >
    
< input  message ="tns:TravelResponseMessage"   />  
  
</ operation >
</ portType >

    
< binding  name ="SOAPBindingAvailabilityAA"  type ="tns:FlightAvailabilityPT" >
        
< soap:binding  style ="rpc"
            transport
="http://schemas.xmlsoap.org/soap/http"   />
        
< operation  name ="FlightAvailability" >
            
< soap:operation  soapAction =""  style ="rpc"   />
            
< input >
                
< soap:body  use ="encoded"  namespace ="http://packtpub.com/service/airline/"
                    encodingStyle
="http://schemas.xmlsoap.org/soap/encoding/"   />
            
</ input >
        
</ operation >
    
</ binding >
    
        
< service  name ="AmericanAirlinesAvailability" >
        
< documentation > American Airlines Availability </ documentation >
        
< port  name ="SOAPPortsAvailability"  binding ="tns:SOAPBindingAvailabilityAA" >
            
< soap:address
                
location ="http://localhost:8087/active-bpel/services/AmericanAirlinesAvailability"   />
        
</ port >
    
</ service >
    
    
< binding  name ="SOAPBindingAvailabilityDA"  type ="tns:FlightAvailabilityPT" >
        
< soap:binding  style ="rpc"
            transport
="http://schemas.xmlsoap.org/soap/http"   />
        
< operation  name ="FlightAvailability" >
            
< soap:operation  soapAction =""  style ="rpc"   />
            
< input >
                
< soap:body  use ="encoded"  namespace ="http://packtpub.com/service/airline/"
                    encodingStyle
="http://schemas.xmlsoap.org/soap/encoding/"   />
            
</ input >
        
</ operation >
    
</ binding >
    
        
< service  name ="DeltaAirlinesAvailability" >
        
< documentation > Delta Airlines Availability </ documentation >
        
< port  name ="SOAPPortsAvailabilityDA"  binding ="tns:SOAPBindingAvailabilityDA" >
            
< soap:address
                
location ="http://localhost:8087/active-bpel/services/DeltaAirlinesAvailability"   />
        
</ port >
    
</ service >

    
< binding  name ="SOAPBindingb"  type ="tns:FlightCallbackPT" >
        
< soap:binding  style ="rpc"
            transport
="http://schemas.xmlsoap.org/soap/http"   />
        
< operation  name ="FlightTicketCallback" >
            
< soap:operation  soapAction =""  style ="rpc"   />
            
< input >
                
< soap:body  use ="encoded"  namespace ="http://packtpub.com/service/airline/"
                    encodingStyle
="http://schemas.xmlsoap.org/soap/encoding/"   />
            
</ input >
        
</ operation >
    
</ binding >
    
        
< service  name ="AmericanAirlines" >
        
< documentation > American Airlines s </ documentation >
        
< port  name ="SOAPPortsAA"  binding ="tns:SOAPBindingb" >
            
< soap:address
                
location ="http://localhost:8087/active-bpel/services/AmericanAirlinesServices"   />
        
</ port >
    
</ service >
    
        
< binding  name ="SOAPBindingb1"  type ="tns:FlightCallbackPT" >
        
< soap:binding  style ="rpc"
            transport
="http://schemas.xmlsoap.org/soap/http"   />
        
< operation  name ="FlightTicketCallback" >
            
< soap:operation  soapAction =""  style ="rpc"   />
            
< input >
                
< soap:body  use ="encoded"  namespace ="http://packtpub.com/service/airline/"
                    encodingStyle
="http://schemas.xmlsoap.org/soap/encoding/"   />
            
</ input >
        
</ operation >
    
</ binding >
    
        
< service  name ="DeltaAirlines" >
        
< documentation > American Airlines s </ documentation >
        
< port  name ="SOAPPortsDA"  binding ="tns:SOAPBindingb1" >
            
< soap:address
                
location ="http://localhost:8087/active-bpel/services/DeltaAirlinesServices"   />
        
</ port >
    
</ service >

<!--  Partner link type  -->
< plnk:partnerLinkType  name ="flightLT" >
  
< plnk:role  name ="airlineService" >
    
< plnk:portType  name ="tns:FlightAvailabilityPT"   />
  
</ plnk:role >
  
< plnk:role  name ="airlineCustomer" >
    
< plnk:portType  name ="tns:FlightCallbackPT"   />
  
</ plnk:role >
</ plnk:partnerLinkType >

</ definitions >

 

雇员出差状态服务 Employee.wsdl

 

<? xml version="1.0" encoding="utf-8"  ?>  
< definitions  xmlns:http ="http://schemas.xmlsoap.org/wsdl/http/"  
             xmlns:soap
="http://schemas.xmlsoap.org/wsdl/soap/"  
             xmlns:xs
="http://www.w3.org/2001/XMLSchema"  
             xmlns:soapenc
="http://schemas.xmlsoap.org/soap/encoding/"  
             xmlns:emp
="http://packtpub.com/service/employee/"  
             targetNamespace
="http://packtpub.com/service/employee/"  
             xmlns
="http://schemas.xmlsoap.org/wsdl/"
             xmlns:plnk
="http://schemas.xmlsoap.org/ws/2003/05/partner-link/"   >
             
< types >
  
< xs:schema  elementFormDefault ="qualified"  
             targetNamespace
="http://packtpub.com/service/employee/" >

    
< xs:complexType  name ="EmployeeType" >
      
< xs:sequence >
        
< xs:element  name ="FirstName"  type ="xs:string"   />  
        
< xs:element  name ="LastName"  type ="xs:string"   />  
        
< xs:element  name ="Departement"  type ="xs:string"   />  
      
</ xs:sequence >
    
</ xs:complexType >

    
< xs:simpleType  name ="TravelClassType" >
      
< xs:restriction  base ="xs:string" >
        
< xs:enumeration  value ="Economy" />
        
< xs:enumeration  value ="Business" />
        
< xs:enumeration  value ="First" />
      
</ xs:restriction >
    
</ xs:simpleType >

  
</ xs:schema >
</ types >

< message  name ="EmployeeTravelStatusRequestMessage" >
  
< part  name ="employee"  type ="emp:EmployeeType"   />  
</ message >

< message  name ="EmployeeTravelStatusResponseMessage" >
  
< part  name ="travelClass"  type ="emp:TravelClassType"   />
</ message >

< portType  name ="EmployeeTravelStatusPT" >
  
< operation  name ="EmployeeTravelStatus" >
    
< input  message ="emp:EmployeeTravelStatusRequestMessage"   />  
    
< output  message ="emp:EmployeeTravelStatusResponseMessage"   />  
  
</ operation >
</ portType >

    
< binding  name ="SOAPBinding"  type ="emp:EmployeeTravelStatusPT" >
        
< soap:binding  style ="rpc"
            transport
="http://schemas.xmlsoap.org/soap/http"   />
        
< operation  name ="EmployeeTravelStatus" >
            
< soap:operation  soapAction =""  style ="rpc"   />
            
< input >
                
< soap:body  use ="encoded"  namespace ="urn:loanapprover"
                    encodingStyle
="http://schemas.xmlsoap.org/soap/encoding/"   />
            
</ input >
            
< output >
                
< soap:body  use ="encoded"  namespace ="urn:loanapprover"
                    encodingStyle
="http://schemas.xmlsoap.org/soap/encoding/"   />
            
</ output >
        
</ operation >
    
</ binding >

    
< service  name ="employeeTravelStatus" >
        
< documentation > employee Travel Status </ documentation >
        
< port  name ="SOAPPort"  binding ="emp:SOAPBinding" >
            
< soap:address
                
location ="http://localhost:8087/active-bpel/services/employeeTravelStatusService"   />
        
</ port >
    
</ service >

<!--  Partner link type  -->
< plnk:partnerLinkType  name ="employeeLT" >
  
< plnk:role  name ="employeeTravelStatusService" >
    
< plnk:portType  name ="emp:EmployeeTravelStatusPT"   />
  
</ plnk:role >
</ plnk:partnerLinkType >

</ definitions >

 

查询航班服务Travel.wsdl

 

<? xml version="1.0" encoding="UTF-8" ?>
< definitions  targetNamespace ="http://packtpub.com/bpel/travel/"  xmlns:tns ="http://packtpub.com/bpel/travel/"  xmlns:http ="http://schemas.xmlsoap.org/wsdl/http/"  xmlns:soapenc ="http://schemas.xmlsoap.org/soap/encoding/"  xmlns:aln ="http://packtpub.com/service/airline/"  xmlns:plnk ="http://schemas.xmlsoap.org/ws/2003/05/partner-link/"  xmlns:xsd ="http://www.w3.org/2001/XMLSchema"  xmlns:emp ="http://packtpub.com/service/employee/"  xmlns:xs ="http://www.w3.org/2001/XMLSchema"  xmlns:soap ="http://schemas.xmlsoap.org/wsdl/soap/"  xmlns ="http://schemas.xmlsoap.org/wsdl/" >
  
< import  namespace ="http://packtpub.com/service/airline/"  location ="./Airline.wsdl" />
  
< import  namespace ="http://packtpub.com/service/employee/"  location ="./Employee.wsdl" />
  
< types >
    
< xs:schema  elementFormDefault ="qualified"  targetNamespace ="http://packtpub.com/service/airline/"  xmlns:xs ="http://www.w3.org/2001/XMLSchema" >

    
< xs:complexType  name ="FlightRequestType" >
      
< xs:sequence >
        
< xs:element  name ="OriginFrom"  type ="xs:string" />  
        
< xs:element  name ="DestinationTo"  type ="xs:string" />  
        
< xs:element  name ="DesiredDepartureDate"  type ="xs:date" />  
        
< xs:element  name ="DesiredReturnDate"  type ="xs:date" />  
      
</ xs:sequence >
    
</ xs:complexType >
    
    
< xs:simpleType  name ="TravelClassType" >
      
< xs:restriction  base ="xs:string" >
        
< xs:enumeration  value ="Economy" />
        
< xs:enumeration  value ="Business" />
        
< xs:enumeration  value ="First" />
      
</ xs:restriction >
    
</ xs:simpleType >
    

    
< xs:complexType  name ="FlightConfirmationType" >
      
< xs:sequence >
        
< xs:element  name ="FlightNo"  type ="xs:string" />  
        
< xs:element  name ="TravelClass"  type ="tns:TravelClassType" />  
        
< xs:element  name ="Price"  type ="xs:float" />  
        
< xs:element  name ="DepartureDateTime"  type ="xs:dateTime" />  
        
< xs:element  name ="ReturnDateTime"  type ="xs:dateTime" />  
        
< xs:element  name ="Approved"  type ="xs:boolean" />  
      
</ xs:sequence >
    
</ xs:complexType >
  
</ xs:schema >
    
< xs:schema  elementFormDefault ="qualified"  targetNamespace ="http://packtpub.com/service/employee/"  xmlns:xs ="http://www.w3.org/2001/XMLSchema" >

    
< xs:complexType  name ="EmployeeType" >
      
< xs:sequence >
        
< xs:element  name ="FirstName"  type ="xs:string" />  
        
< xs:element  name ="LastName"  type ="xs:string" />  
        
< xs:element  name ="Departement"  type ="xs:string" />  
      
</ xs:sequence >
    
</ xs:complexType >

    
< xs:simpleType  name ="TravelClassType" >
      
< xs:restriction  base ="xs:string" >
        
< xs:enumeration  value ="Economy" />
        
< xs:enumeration  value ="Business" />
        
< xs:enumeration  value ="First" />
      
</ xs:restriction >
    
</ xs:simpleType >

  
</ xs:schema >
  
</ types >
  
< message  name ="TravelRequestMessage" >
    
< part  name ="employee"  type ="emp:EmployeeType" />
    
< part  name ="flightData"  type ="aln:FlightRequestType" />
  
</ message >
  
< portType  name ="ClientCallbackPT" >
    
< operation  name ="ClientCallback" >
      
< input  message ="aln:TravelResponseMessage" />
    
</ operation >
  
</ portType >
  
< portType  name ="TravelApprovalPT" >
    
< operation  name ="TravelApproval" >
      
< input  message ="tns:TravelRequestMessage" />
    
</ operation >
  
</ portType >
  
< binding  name ="SOAPBindingCCB"  type ="tns:ClientCallbackPT" >
    
< soap:binding  style ="rpc"  transport ="http://schemas.xmlsoap.org/soap/http"  xmlns:soap ="http://schemas.xmlsoap.org/wsdl/soap/" />
    
< operation  name ="ClientCallback" >
    
< soap:operation  soapAction =""  style ="rpc"  xmlns:soap ="http://schemas.xmlsoap.org/wsdl/soap/" />
      
< input >
    
< soap:body  encodingStyle ="http://schemas.xmlsoap.org/soap/encoding/"  namespace ="http://packtpub.com/service/airline/"  use ="encoded"  xmlns:soap ="http://schemas.xmlsoap.org/wsdl/soap/" />
      
</ input >
    
</ operation >
  
</ binding >
  
< binding  name ="SOAPBindingTAPT"  type ="tns:TravelApprovalPT" >
    
< soap:binding  style ="rpc"  transport ="http://schemas.xmlsoap.org/soap/http"  xmlns:soap ="http://schemas.xmlsoap.org/wsdl/soap/" />
    
< operation  name ="TravelApproval" >
    
< soap:operation  soapAction =""  style ="rpc"  xmlns:soap ="http://schemas.xmlsoap.org/wsdl/soap/" />
      
< input >
    
< soap:body  encodingStyle ="http://schemas.xmlsoap.org/soap/encoding/"  namespace ="http://packtpub.com/service/airline/"  use ="encoded"  xmlns:soap ="http://schemas.xmlsoap.org/wsdl/soap/" />
      
</ input >
    
</ operation >
  
</ binding >
  
< service  name ="ClientCB" >
< documentation > Delta Airlines Availability </ documentation >
    
< port  name ="SOAPPortsCCB"  binding ="tns:SOAPBindingCCB" >
    
< soap:address  location ="http://localhost:8087/active-bpel/services/ClientCB"  xmlns:soap ="http://schemas.xmlsoap.org/wsdl/soap/" />
    
</ port >
  
</ service >
  
< service  name ="TravelApprovalService" >
< documentation > Delta Airlines Availability </ documentation >
    
< port  name ="SOAPPortsTAPT"  binding ="tns:SOAPBindingTAPT" >
    
< soap:address  location ="http://localhost:8087/active-bpel/services/TravelApprovalService"  xmlns:soap ="http://schemas.xmlsoap.org/wsdl/soap/" />
    
</ port >
  
</ service >
< plnk:partnerLinkType  xmlns:plnk ="http://schemas.xmlsoap.org/ws/2003/05/partner-link/"  name ="travelLT" >
   
< plnk:role  name ="travelService" >
      
< plnk:portType  name ="tns:TravelApprovalPT" />
   
</ plnk:role >
   
< plnk:role  name ="travelServiceCustomer" >
      
< plnk:portType  name ="tns:ClientCallbackPT" />
   
</ plnk:role >
</ plnk:partnerLinkType >
< bpws:property  xmlns:bpws ="http://schemas.xmlsoap.org/ws/2003/03/business-process/"  name ="DA"  type ="xsd:string" />
< bpws:property  xmlns:bpws ="http://schemas.xmlsoap.org/ws/2003/03/business-process/"  name ="AAT"  type ="xsd:string" />
< vprop:propertyAlias  xmlns:vprop ="http://docs.oasis-open.org/wsbpel/2.0/varprop"  messageType ="aln:TravelResponseMessage"  part ="confirmationData"  propertyName ="tns:AAT" >
   
< vprop:query > /confirmationData </ vprop:query >
</ vprop:propertyAlias >
< vprop:propertyAlias  xmlns:vprop ="http://docs.oasis-open.org/wsbpel/2.0/varprop"  messageType ="aln:TravelResponseMessage"  part ="confirmationData"  propertyName ="tns:DA" >
   
< vprop:query > /confirmationData </ vprop:query >
</ vprop:propertyAlias >
</ definitions >

 

客户端服务Client.wsdl

 

<? xml version="1.0" encoding="UTF-8" ?>
< definitions  targetNamespace ="http://packtpub.com/bpel/client/"  xmlns:tns ="http://packtpub.com/bpel/client/"  xmlns:http ="http://schemas.xmlsoap.org/wsdl/http/"  xmlns:soapenc ="http://schemas.xmlsoap.org/soap/encoding/"  xmlns:aln ="http://packtpub.com/service/airline/"  xmlns:plnk ="http://schemas.xmlsoap.org/ws/2003/05/partner-link/"  xmlns:xsd ="http://www.w3.org/2001/XMLSchema"  xmlns:emp ="http://packtpub.com/service/employee/"  xmlns:trv ="http://packtpub.com/bpel/travel/"  xmlns:xs ="http://www.w3.org/2001/XMLSchema"  xmlns:soap ="http://schemas.xmlsoap.org/wsdl/soap/"  xmlns ="http://schemas.xmlsoap.org/wsdl/" >
  
< import  namespace ="http://packtpub.com/service/airline/"  location ="./Airline.wsdl" />
  
< import  namespace ="http://packtpub.com/bpel/travel/"  location ="./Travel.wsdl" />
  
< import  namespace ="http://packtpub.com/service/employee/"  location ="./Employee.wsdl" />
  
< types >
    
< xs:schema  elementFormDefault ="qualified"  targetNamespace ="http://packtpub.com/service/airline/"  xmlns:xs ="http://www.w3.org/2001/XMLSchema" >

    
< xs:complexType  name ="FlightRequestType" >
      
< xs:sequence >
        
< xs:element  name ="OriginFrom"  type ="xs:string" />  
        
< xs:element  name ="DestinationTo"  type ="xs:string" />  
        
< xs:element  name ="DesiredDepartureDate"  type ="xs:date" />  
        
< xs:element  name ="DesiredReturnDate"  type ="xs:date" />  
      
</ xs:sequence >
    
</ xs:complexType >
    
    
< xs:simpleType  name ="TravelClassType" >
      
< xs:restriction  base ="xs:string" >
        
< xs:enumeration  value ="Economy" />
        
< xs:enumeration  value ="Business" />
        
< xs:enumeration  value ="First" />
      
</ xs:restriction >
    
</ xs:simpleType >
    

    
< xs:complexType  name ="FlightConfirmationType" >
      
< xs:sequence >
        
< xs:element  name ="FlightNo"  type ="xs:string" />  
        
< xs:element  name ="TravelClass"  type ="tns:TravelClassType" />  
        
< xs:element  name ="Price"  type ="xs:float" />  
        
< xs:element  name ="DepartureDateTime"  type ="xs:dateTime" />  
        
< xs:element  name ="ReturnDateTime"  type ="xs:dateTime" />  
        
< xs:element  name ="Approved"  type ="xs:boolean" />  
      
</ xs:sequence >
    
</ xs:complexType >
  
</ xs:schema >
    
< xs:schema  elementFormDefault ="qualified"  targetNamespace ="http://packtpub.com/service/employee/"  xmlns:xs ="http://www.w3.org/2001/XMLSchema" >

    
< xs:complexType  name ="EmployeeType" >
      
< xs:sequence >
        
< xs:element  name ="FirstName"  type ="xs:string" />  
        
< xs:element  name ="LastName"  type ="xs:string" />  
        
< xs:element  name ="Departement"  type ="xs:string" />  
      
</ xs:sequence >
    
</ xs:complexType >

    
< xs:simpleType  name ="TravelClassType" >
      
< xs:restriction  base ="xs:string" >
        
< xs:enumeration  value ="Economy" />
        
< xs:enumeration  value ="Business" />
        
< xs:enumeration  value ="First" />
      
</ xs:restriction >
    
</ xs:simpleType >

  
</ xs:schema >
    
< xs:schema  elementFormDefault ="qualified"  targetNamespace ="http://packtpub.com/bpel/client/"  xmlns:xs ="http://www.w3.org/2001/XMLSchema" >

    
        
< xs:complexType  name ="TestClient" >
      
< xs:sequence >
        
< xs:element  name ="FirstName"  type ="xs:string" />  
        
< xs:element  name ="LastName"  type ="xs:string" />  
        
< xs:element  name ="Departement"  type ="xs:string" />  
      
</ xs:sequence >
    
</ xs:complexType >

  
</ xs:schema >
  
</ types >
  
< message  name ="TestClientMessage" >
    
< part  name ="testinfo"  type ="emp:EmployeeType" />
  
</ message >
  
< portType  name ="TravelApprovalPT" >
    
< operation  name ="TravelApproval" >
      
< input  message ="trv:TravelRequestMessage" />
      
< output  message ="aln:TravelResponseMessage" />
    
</ operation >
  
</ portType >
< plnk:partnerLinkType  xmlns:plnk ="http://schemas.xmlsoap.org/ws/2003/05/partner-link/"  name ="clientLT" >
   
< plnk:role  name ="travelService" >
      
< plnk:portType  name ="tns:TravelApprovalPT" />
   
</ plnk:role >
</ plnk:partnerLinkType >
< vprop:property  xmlns:vprop ="http://docs.oasis-open.org/wsbpel/2.0/varprop"  name ="travelresponse"  type ="xsd:string" />
< vprop:propertyAlias  xmlns:vprop ="http://docs.oasis-open.org/wsbpel/2.0/varprop"  messageType ="aln:TravelResponseMessage"  part ="confirmationData"  propertyName ="tns:travelresponse" >
   
< vprop:query > . </ vprop:query >
</ vprop:propertyAlias >
</ definitions >

 

流程配置文件catalog.xml,放在META-INF文件夹下。

 

 

<? xml version="1.0" encoding="UTF-8" ?>
< catalog  xmlns ='http://schemas.active-endpoints.com/catalog/2006/07/catalog.xsd'>
   
<wsdlEntry location ="project:/airline/wsdl/Airline.wsdl"  classpath ="wsdl/airline/wsdl/Airline.wsdl"   />
   
< wsdlEntry  location ="project:/airline/wsdl/Client.wsdl"  classpath ="wsdl/airline/wsdl/Client.wsdl"   />
   
< wsdlEntry  location ="project:/airline/wsdl/Employee.wsdl"  classpath ="wsdl/airline/wsdl/Employee.wsdl"   />
   
< wsdlEntry  location ="project:/airline/wsdl/Travel.wsdl"  classpath ="wsdl/airline/wsdl/Travel.wsdl"   />
   
< wsdlEntry  location ="file:/E:/activeBPEL/Samples/Completed Tutorial/WSDL/loanServicePT.wsdl"  classpath ="wsdl/activeBPEL/Samples/Completed Tutorial/WSDL/loanServicePT.wsdl"   />
   
< schemaEntry  location ="file:/E:/activeBPEL/Samples/Completed Tutorial/WSDL/error-messages.xsd"  classpath ="wsdl/activeBPEL/Samples/Completed Tutorial/WSDL/error-messages.xsd"   />
</ catalog >

 

 

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值