{"id":2335,"date":"2014-02-10T10:31:01","date_gmt":"2014-02-10T09:31:01","guid":{"rendered":"http:\/\/www.pleus.net\/blog\/?p=2335"},"modified":"2024-07-15T08:04:03","modified_gmt":"2024-07-15T06:04:03","slug":"how-to-link-wsdl-services-to-bpmn-processes","status":"publish","type":"post","link":"https:\/\/www.pleus.net\/blog\/?p=2335","title":{"rendered":"How to Link WSDL-Services To BPMN-Processes"},"content":{"rendered":"<p>Since BPMN2.0 it is not only possible to design processes but to also execute them using a process engine. The process flow has a appropriate visual representation in the standard. But executable processes are mostly data driven. They interact with external services and exchange data with them. In addition to that processes maintain their own internal state. So a common requirement is to model the process internal state and connect to external services using the service data representation. BPMN is capable to include data definitions based on WSDL and XML Schemas, although the capabilities of the tools (that I know) to visualize data are somewhat limited.<\/p>\n<p>In this blogpost I would like to show you how data looks like in BPMN and how a process can be linked in a standardized way to existing services based on WSDL and XSD.  <\/p>\n<p>The process is as simple as possible. The service is based on a BiPRO service description. The <a href=\"http:\/\/www.bipro.net\" title=\"BiPRO\" target=\"_blank\" rel=\"noopener\">BiPRO<\/a> is a standardization organisation in the German insurance market that standardizes processes and services at a technical and business level.<\/p>\n<p><a href=\"http:\/\/www.pleus.net\/blog\/wp-content\/uploads\/2014\/02\/WSDLtoBPMN.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.pleus.net\/blog\/wp-content\/uploads\/2014\/02\/WSDLtoBPMN.png\" alt=\"WSDLtoBPMN\" width=\"444\" height=\"427\" class=\"alignnone size-full wp-image-2424\" srcset=\"https:\/\/www.pleus.net\/blog\/wp-content\/uploads\/2014\/02\/WSDLtoBPMN.png 444w, https:\/\/www.pleus.net\/blog\/wp-content\/uploads\/2014\/02\/WSDLtoBPMN-300x288.png 300w, https:\/\/www.pleus.net\/blog\/wp-content\/uploads\/2014\/02\/WSDLtoBPMN-150x144.png 150w, https:\/\/www.pleus.net\/blog\/wp-content\/uploads\/2014\/02\/WSDLtoBPMN-400x384.png 400w\" sizes=\"auto, (max-width: 444px) 100vw, 444px\" \/><\/a><\/p>\n<p>Below you see a simplyfied version in plain BPMN (when you import the bpmn below you will only see the events and tasks).<\/p>\n<pre class=\"brush:xml\">\r\n\r\n&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n&lt;definitions id=\"definitions\" xmlns=\"http:\/\/www.omg.org\/spec\/BPMN\/20100524\/MODEL\"\r\n  xmlns:bpmn=\"http:\/\/schema.omg.org\/spec\/BPMN\/2.0\"\r\n  xmlns:bpmndi=\"http:\/\/www.omg.org\/spec\/BPMN\/20100524\/DI\"  \r\n  xmlns:dc=\"http:\/\/www.omg.org\/spec\/DD\/20100524\/DC\"\r\n  xmlns:di=\"http:\/\/www.omg.org\/spec\/DD\/20100524\/DI\"  \r\n  xmlns:xs=\"http:\/\/www.w3.org\/2001\/XMLSchema\"\r\n  targetNamespace=\"http:\/\/www.pleus.net\/example\"\r\n  xmlns:tns=\"http:\/\/www.pleus.net\/example\"\r\n  xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\"  \r\n  xmlns:nachrichten=\"http:\/\/www.bipro.net\/namespace\/nachrichten\"\r\n  xmlns:bipro=\"http:\/\/www.bipro.net\/namespace\"\r\n  xsi:schemaLocation=\"http:\/\/www.omg.org\/spec\/BPMN\/20100524\/MODEL http:\/\/bpmn.sourceforge.net\/schemas\/BPMN20.xsd\">\r\n  \r\n  &lt;!-- WSDL Import -->\r\n  &lt;import importType=\"http:\/\/schemas.xmlsoap.org\/wsdl\/\"\r\n          location=\"KompsitService_2.4.3.1.1.wsdl\"\r\n          namespace=\"http:\/\/www.bipro.net\/namespace\" \/>\r\n\r\n   &lt;!-- Item definition. Link to the external WSDL\/XSD structure. structureRef: QName of input element -->\r\n   &lt;itemDefinition id=\"getQuoteRequestItem\" structureRef=\"nachrichten:getQuote\" \/>\r\n   &lt;itemDefinition id=\"getQuoteResponseItem\" structureRef=\"nachrichten:getQuoteResponse\" \/>\r\n\r\n   &lt;!-- Message definitions. Link to the item definition. Can be visualized by using DI -->\r\n   &lt;message id=\"getQuoteRequestMessage\" itemRef=\"tns:getQuoteRequestItem\" \/>\r\n   &lt;message id=\"getQuoteResponseMessage\" itemRef=\"tns:getQuoteResponseItem\" \/>\r\n\r\n   &lt;!-- Interface definition. implementationRef = QName of WSDL Port Type -->\r\n   &lt;interface name=\"Komposit Interface\" implementationRef=\"bipro:KompositServicePortType\">\r\n      &lt;!-- Operation: implementationRef = QName of WSDL Operation -->\r\n      &lt;operation id=\"getQuoteOperation\" name=\"getQuote Operation\" implementationRef=\"bipro:getQuote\">\r\n         &lt;!-- Links to the message definitions --> \r\n         &lt;inMessageRef>tns:getQuoteRequestMessage&lt;\/inMessageRef>\r\n         &lt;outMessageRef>tns:getQuoteResponseMessage&lt;\/outMessageRef>\r\n      &lt;\/operation>\r\n   &lt;\/interface>\r\n \r\n  &lt;process id=\"servicecall\">\r\n \r\n   &lt;!-- Datasources and targets for the service call (process state). Can be visualized by using DI and dataObjectReferences -->\r\n   &lt;dataObject id=\"dataInputOfProcess\" name=\"Input for webservice\" itemSubjectRef=\"xs:string\"\/>\r\n   &lt;dataObject id=\"dataOutputOfProcess\" name=\"Output for webservice\" itemSubjectRef=\"xs:string\"\/>\r\n  \r\n   &lt;!-- Process start -->\r\n   &lt;startEvent id=\"start\" \/>\r\n \r\n   &lt;sequenceFlow id=\"flow1\" sourceRef=\"start\" targetRef=\"initScript\" \/>\r\n \r\n   &lt;!-- Initialization of process data -->\r\n   &lt;scriptTask id=\"initScript\" scriptFormat=\"groovy\" name=\"Initialize process\">\r\n     &lt;script>\r\n       def temp = \"2.4.3.1.1\"\r\n       execution.setVariable(\"dataInputOfProcess\", temp)\r\n     &lt;\/script>\r\n   &lt;\/scriptTask>\r\n \r\n   &lt;sequenceFlow id=\"flow2\" sourceRef=\"initScript\" targetRef=\"webService\" \/>\r\n \r\n   &lt;!-- Web Service call -->\r\n   &lt;serviceTask id=\"webService\" name=\"Call getQuote\" implementation=\"##WebService\" operationRef=\"tns:getQuoteOperation\">\r\n       \r\n       &lt;!-- Defines the inputs and outputs and links to item definitions -->\r\n       &lt;ioSpecification>\r\n          &lt;dataInput itemSubjectRef=\"tns:getQuoteRequestItem\" id=\"dataInputOfServiceTask\" \/>\r\n          &lt;dataOutput itemSubjectRef=\"tns:getQuoteResponseItem\" id=\"dataOutputOfServiceTask\" \/>\r\n          &lt;inputSet>\r\n             &lt;dataInputRefs>dataInputOfServiceTask&lt;\/dataInputRefs>\r\n          &lt;\/inputSet>\r\n          &lt;outputSet>\r\n             &lt;dataOutputRefs>dataOutputOfServiceTask&lt;\/dataOutputRefs>\r\n          &lt;\/outputSet>\r\n       &lt;\/ioSpecification>\r\n       \r\n       &lt;!-- Defines the mapping between process data and service input -->\r\n       &lt;dataInputAssociation>\r\n          &lt;sourceRef>dataInputOfProcess&lt;\/sourceRef>\r\n          &lt;targetRef>dataInputOfServiceTask&lt;\/targetRef>\r\n          &lt;assignment>\r\n            &lt;from>\r\n             bpmn:getDataObject('dataInputOfProcess')\r\n            &lt;\/from>\r\n            &lt;to>\r\n             bpmn:getDataInput('dataInputOfServiceTask')\/BiPROVersion\/\r\n            &lt;\/to>\r\n          &lt;\/assignment>\r\n       &lt;\/dataInputAssociation>\r\n\r\n       &lt;!-- Defines the mapping between process data and service output -->\r\n       &lt;dataOutputAssociation>\r\n          &lt;sourceRef>dataOutputOfServiceTask&lt;\/sourceRef>\r\n          &lt;targetRef>dataOutputOfProcess&lt;\/targetRef>\r\n          &lt;assignment>\r\n            &lt;from>\r\n             bpmn:getDataOutput('dataOutputOfServiceTask')\/BiPROVersion\/\r\n            &lt;\/from>\r\n            &lt;to>\r\n             bpmn:getDataObject('dataOutputOfProcess')\r\n            &lt;\/to>\r\n          &lt;\/assignment>\r\n       &lt;\/dataOutputAssociation>\r\n\r\n   &lt;\/serviceTask>\r\n \r\n   &lt;sequenceFlow id=\"flow3\" sourceRef=\"webService\" targetRef=\"end\" \/>\r\n   \r\n   &lt;!-- Process end -->\r\n   &lt;endEvent id=\"end\" \/>\r\n \r\n  &lt;\/process>\r\n\r\n<\/pre>\n<p>Now let&#8217;s look at the example step-by-step.<\/p>\n<p><strong>1. Import the service:<\/strong> Line 16-18 imports the WSDL file that includes the types and messages used by the external service that we want to call from the process.<\/p>\n<p><strong>2. Define the items:<\/strong> Line 21-22 defines items that act as links to the types defined in the imported WSDL and XSD files.<\/p>\n<p><strong>3. Define the messages:<\/strong> Line 25-26 defines messages to be used in the interface definition that we see in the next step. Messages can be visualized by modeling tools provided that DI Information is present in the model.<\/p>\n<p><strong>4. Define the interface:<\/strong> The interface is the equivalent to the WSDL port type in BPMN. It is defined in line 29-36. So far we have <em>itemDefinitions<\/em> that link to the XSD-messages and an interface that links to the WSDL-port type. The <em>inMessageRef<\/em> and <em>outMessageRef <\/em>elements use the messages defined in step 3 to indirectly reference the <em>itemDefinitions<\/em>. <\/p>\n<p><strong>5. Define the process variables:<\/strong> The process maintains state. This state is defined in the form of <em>dataObjects<\/em> in line 41-42. Please note that the links to the external service are defined outside the process (which begins in line 38). The <em>dataObjects<\/em> are defined inside the process as they represent the data that is maintained by the respective process instances. By the way, when importing the process in a modeling tool, <em>dataObjects<\/em> are not visualized. To visualize <em>dataObjects<\/em> as a paper sheet, <em>dataObjectReferences<\/em> can be used. In this simple example we just use a string as input and output which transports a version information send to the BiPRO service and back. In a more complex senario this could be a type from an imported XSD.<\/p>\n<p><strong>6. Initialize the process:<\/strong> A simple BPMN script task (line 50-55) is used to initialize the dataObject <em>dataInputOfProcess<\/em>. It just sets the version to 2.4.3.1.1.<\/p>\n<p><strong>7. Link the serviceTask:<\/strong> The most complex part is the <em>serviceTask<\/em> (line 60-102). The <em>operationRef<\/em> attribute (line 60) links to the operation which is part of the interface definition (line 31). This is the web service operation to be called when the <em>serviceTask<\/em> is executed. The <em>serviceTask<\/em> comprises the elements <em>ioSpecification<\/em> (line 63-72), <em>dataInputAssociation<\/em>(line 75-86) and <em>dataOutputAssociation<\/em> (line 89-100). <em>ioSpecification<\/em> can be seen as a logical port that describes the service input and output from the perspective of the service. The <em>itemSubjectRef<\/em> attribute on the <em>dataInput<\/em> and <em>dataOutput<\/em> elements (line 64-65) link to the <em>itemDefinitions<\/em> (line 21-22) and as such to the data structures in the WSDL files. The id together with the <em>inputSet<\/em> and <em>outputSet<\/em> (line 66-71) define the connection points the serviceTask offers for sending and receiving data. <em>dataInputAssociation<\/em> and <em>dataOutputAssociation<\/em> map the <em>dataObjects<\/em> (process data) to the connection points or in other words to the request and response structures of the service (service data).<\/p>\n<p>When the <em>serviceTask<\/em> <em>webService<\/em> is called, the process data from the <em>dataObject<\/em> <em>dataInputOfProcess<\/em> is copied to the web service request message <em>nachrichten:getQuote\/BIPROVersion<\/em>. Then the service is called. After the service call finished, the version is copied from the response message <em>nachrichten:getQuoteResponse\/BIPROVersion<\/em> to the <em>dataObject<\/em> <em>dataOutputOfProcess<\/em>.<\/p>\n<p>This blogpost has shown how to link WSDL\/XSD based services to BPMN processes in a standardized way.<br \/>\nEven if automated process execution is not in focus, it can be important to unambiguously link services to processes to create an integrated view of the entire process including its data.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Since BPMN2.0 it is not only possible to design processes but to also execute them using a process engine. The process flow has a appropriate visual representation in the standard. But executable processes are mostly data driven. They interact with external services and exchange data with them. In addition to that processes maintain their own &hellip; <a href=\"https:\/\/www.pleus.net\/blog\/?p=2335\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">How to Link WSDL-Services To BPMN-Processes<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,13,3],"tags":[53,79,77,26,25,54],"class_list":["post-2335","post","type-post","status-publish","format-standard","hentry","category-bpm","category-bpmn","category-soa","tag-bipro","tag-bpmn","tag-soa","tag-wsdl","tag-xml","tag-xsd"],"_links":{"self":[{"href":"https:\/\/www.pleus.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2335","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pleus.net\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pleus.net\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pleus.net\/blog\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pleus.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2335"}],"version-history":[{"count":122,"href":"https:\/\/www.pleus.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2335\/revisions"}],"predecessor-version":[{"id":3602,"href":"https:\/\/www.pleus.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2335\/revisions\/3602"}],"wp:attachment":[{"href":"https:\/\/www.pleus.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2335"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pleus.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2335"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pleus.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2335"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}