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

本文介绍了如何把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实例运行[1]——改写源码

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

美国航空公司AmericanAirline.bpel

<? xmlversion="1.0"encoding="UTF-8" ?>
<!--
BPELProcessDefinition
EditedusingActiveBPEL(tm)DesignerVersion3.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" />
<!-- outputfromAmericanAirlines -->
< bpws:variable messageType ="aln:TravelResponseMessage" name ="FlightResponseAA" />
</ bpws:variables >
< bpws:sequence >
<!-- Receivetheinitialrequest -->
< bpws:receive createInstance ="yes" operation ="FlightAvailability" partnerLink ="AmericanAirlines" portType ="aln:FlightAvailabilityPT" variable ="FlightDetails" />
<!-- Preparetheoutput -->
< 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 >
<!-- Makeacallback -->
< bpws:invoke inputVariable ="FlightResponseAA" operation ="FlightTicketCallback" partnerLink ="AmericanAirlines" portType ="aln:FlightCallbackPT" />
</ bpws:sequence >
</ bpws:process >

达美航空公司DeltaAirline.bpel

<? xmlversion="1.0"encoding="UTF-8" ?>
<!--
BPELProcessDefinition
EditedusingActiveBPEL(tm)DesignerVersion3.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" />
<!-- outputfromDeltaAirlines -->
< bpws:variable messageType ="aln:TravelResponseMessage" name ="FlightResponseDA" />
</ bpws:variables >
< bpws:sequence >
<!-- Receivetheinitialrequest -->
< bpws:receive createInstance ="yes" operation ="FlightAvailability" partnerLink ="DeltaAirlines" portType ="aln:FlightAvailabilityPT" variable ="FlightDetails" />
<!-- Preparetheoutput -->
< 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 >
<!-- Makeacallback -->
< bpws:invoke inputVariable ="FlightResponseDA" operation ="FlightTicketCallback" partnerLink ="DeltaAirlines" portType ="aln:FlightCallbackPT" />
</ bpws:sequence >
</ bpws:process >

雇员状态Employee.bpel

<? xmlversion="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 >
<!-- inputforthisprocess -->
< variable name ="EmployeeTravelStatusRequest" messageType ="emp:EmployeeTravelStatusRequestMessage" />
<!-- outputfromtheEmployeeTravelStatuswebservice -->
< variable name ="EmployeeTravelStatusResponse" messageType ="emp:EmployeeTravelStatusResponseMessage" />
</ variables >

< sequence >

<!-- Receivetheinitialrequestforbusinesstravelfromclient -->
< receive partnerLink ="employeeTravelStatus"
portType
="emp:EmployeeTravelStatusPT"
operation
="EmployeeTravelStatus"
variable
="EmployeeTravelStatusRequest"
createInstance
="yes" />

<!-- Preparetheoutput -->
< assign >
< copy >
< from expression ="string('Economy')" />
< to variable ="EmployeeTravelStatusResponse" part ="travelClass" />
</ copy >
</ assign >

<!-- Sendaresponse -->
< reply partnerLink ="employeeTravelStatus"
portType
="emp:EmployeeTravelStatusPT"
operation
="EmployeeTravelStatus"
variable
="EmployeeTravelStatusResponse" />
</ sequence >

</ process >

主流程Travel.bpel

<? xmlversion="1.0"encoding="UTF-8" ?>
<!--
BPELProcessDefinition
EditedusingActiveBPEL(tm)DesignerVersion3.0.0(http://www.active-endpoints.com)
-->
<!-- AsynchrnousBPELprocess -->
< 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 >
<!-- inputforthisprocess -->
< bpws:variable messageType ="trv:TravelRequestMessage" name ="TravelRequest" />
<!-- inputfortheEmployeeTravelStatuswebservice -->
< bpws:variable messageType ="emp:EmployeeTravelStatusRequestMessage" name ="EmployeeTravelStatusRequest" />
<!-- outputfromtheEmployeeTravelStatuswebservice -->
< bpws:variable messageType ="emp:EmployeeTravelStatusResponseMessage" name ="EmployeeTravelStatusResponse" />
<!-- inputforAmericanandDeltawebservices -->
< bpws:variable messageType ="aln:FlightTicketRequestMessage" name ="FlightDetails" />
<!-- outputfromAmericanAirlines -->
< bpws:variable messageType ="aln:TravelResponseMessage" name ="FlightResponseAA" />
<!-- outputfromDeltaAirlines -->
< bpws:variable messageType ="aln:TravelResponseMessage" name ="FlightResponseDA" />
<!-- outputfromBPELprocess -->
< bpws:variable messageType ="aln:TravelResponseMessage" name ="TravelResponse" />
</ bpws:variables >
< bpws:sequence >
<!-- Receivetheinitialrequestforbusinesstravelfromclient -->
< bpws:receive createInstance ="yes" operation ="TravelApproval" partnerLink ="client" portType ="trv:TravelApprovalPT" variable ="TravelRequest" />
<!-- PreparetheinputfortheEmployeeTravelStatusWebService -->
< bpws:assign >
< bpws:copy >
< bpws:from part ="employee" variable ="TravelRequest" />
< bpws:to part ="employee" variable ="EmployeeTravelStatusRequest" />
</ bpws:copy >
</ bpws:assign >
<!-- SynchronouslyinvoketheEmployeeTravelStatusWebService -->
< bpws:invoke inputVariable ="EmployeeTravelStatusRequest" operation ="EmployeeTravelStatus" outputVariable ="EmployeeTravelStatusResponse" partnerLink ="employeeTravelStatus" portType ="emp:EmployeeTravelStatusPT" />
<!-- PreparetheinputforAAandDA -->
< 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 >
<!-- MakeaconcurrentinvocationtoAAinDA -->
< bpws:flow >
< bpws:sequence >
<!-- AsyncinvokeoftheAAwebserviceandwaitforthecallback -->
< 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 >
<!-- AsyncinvokeoftheDAwebserviceandwaitforthecallback -->
< 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 >
<!-- SelectthebestofferandconstructtheTravelResponse -->
< bpws:switch >
< bpws:case condition ="bpws:getVariableData('FlightResponseAA','confirmationData','/confirmationData/aln:Price')&lt;=bpws:getVariableData('FlightResponseDA','confirmationData','/confirmationData/aln:Price')" >
<!-- SelectAmericanAirlines -->
< bpws:assign >
< bpws:copy >
< bpws:from variable ="FlightResponseAA" />
< bpws:to variable ="TravelResponse" />
</ bpws:copy >
</ bpws:assign >
</ bpws:case >
< bpws:otherwise >
<!-- SelectDeltaAirlines -->
< bpws:assign >
< bpws:copy >
< bpws:from variable ="FlightResponseDA" />
< bpws:to variable ="TravelResponse" />
</ bpws:copy >
</ bpws:assign >
</ bpws:otherwise >
</ bpws:switch >
<!-- Makeacallbacktotheclient -->
< bpws:invoke inputVariable ="TravelResponse" operation ="ClientCallback" partnerLink ="client" portType ="trv:ClientCallbackPT" />
</ bpws:sequence >
</ bpws:process >

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

<? xmlversion="1.0"encoding="UTF-8" ?>
<!--
BPELProcessDefinition
EditedusingActiveBPEL(tm)DesignerVersion3.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/CompletedTutorial/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 >
<!-- definethelinks -->
< 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

<? xmlversion="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 >

<!-- ImplementedbytheBPELprocess -->
< 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 > AmericanAirlinesAvailability </ 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 > DeltaAirlinesAvailability </ 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 > AmericanAirliness </ 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 > AmericanAirliness </ documentation >
< port name ="SOAPPortsDA" binding ="tns:SOAPBindingb1" >
< soap:address
location ="http://localhost:8087/active-bpel/services/DeltaAirlinesServices" />
</ port >
</ service >

<!-- Partnerlinktype -->
< 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

<? xmlversion="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 > employeeTravelStatus </ documentation >
< port name ="SOAPPort" binding ="emp:SOAPBinding" >
< soap:address
location ="http://localhost:8087/active-bpel/services/employeeTravelStatusService" />
</ port >
</ service >

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

</ definitions >

查询航班服务Travel.wsdl

<? xmlversion="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 > DeltaAirlinesAvailability </ 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 > DeltaAirlinesAvailability </ 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

<? xmlversion="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文件夹下。

<? xmlversion="1.0"encoding="UTF-8" ?>
< catalog xmlns ='http://schemas.active-endpoints.com/catalog/2006/07/catalog.xsd'>
<wsdlEntrylocation ="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/CompletedTutorial/WSDL/loanServicePT.wsdl" classpath ="wsdl/activeBPEL/Samples/CompletedTutorial/WSDL/loanServicePT.wsdl" />
< schemaEntry location ="file:/E:/activeBPEL/Samples/CompletedTutorial/WSDL/error-messages.xsd" classpath ="wsdl/activeBPEL/Samples/CompletedTutorial/WSDL/error-messages.xsd" />
</ catalog >

你可能感兴趣的:(源码)