Advertisements

Archive for October, 2014



Service Bus 12c–Creating Proxy Service using Pipeline Template

In this post, you will learn to create Pipeline and expose it as Proxy Service using Pipeline Template created in previous post.

You need a WSDL to be used in Proxy Service and you can get the one used in this post from here. You can copy WSDL into any of your Service Bus project directory in file system directly. And click Refresh in Project Explorer so that these resources will be shown. We will use the following Projects.

clip_image002

Right click Pipelines folder and select New -> Pipeline.

clip_image004

Give name as CustomerPSPipeline and select the option From Template as shown below.

clip_image006

Click Search icon to bring up Resource Chooser and select Pipeline Template.

clip_image008

Click OK to go back to Create Pipeline Service window and click Next.

clip_image010

Click Browse WSDLs icon (highlighted above) and select CustomerPS.wsdl from XYZCustomer project as shown below and click OK.

clip_image012

Verify that WSDL and binding is selected. Click Search icon for Proxy Location and select ProxyServices folder as shown below.

clip_image014

Click Select and modify Proxy Name to CustomerPS. Now your Create Pipeline Service window should look like below.

clip_image016

Click Finish. Verify both Pipeline and Proxy Service are created in Pipelines and ProxyServices folders respectively as shown in Project Explorer.

clip_image018

Observe that new tab is opened showing CustomerPSPipeline had inherited all placeholders, names and properties from your Pipeline Template. You can modify/add activities in placeholders and the properties of inherited activities. Since a few of the properties to be specified mandatorily in concrete pipelines and are not mentioned in template, you will see red marks (see below) both in Project Explorer and editor.

clip_image020

Open CustomerPS and navigate to Transport configuration as shown below. Modify Endpoint URI as /entity/CustomerService. So your service consumers can access your proxy service using following URL:

http://<host>:<port>/entity/CustomerService

clip_image021

Go to Message Handling tab and select SOAPAction Header as Selection Algorithm. This would enable proxy service to determine operation at runtime based on SOAP Action sent in HTTP header. These changes should resolve errors in Proxy Service and you can observe that red marks are not seen now.

clip_image023

To resolve errors in Pipeline you should set the properties of Validate activity. In Properties tab of Validate activity, for Schema property click Search icon and select Customer element from proxy service WSDL as shown below. This would enable Service Bus validate input payload against the selected schema at runtime.

clip_image002[8]

For Location property, bring up expression editor by clicking iconclip_image003. Drag or shuttle Customer element into Expression field as shown below and click OK. Now you can observe that all red marks are gone for Pipeline as well.

clip_image005

Now your properties tab for Validate activity should look like below.

clip_image007

Now your Service Bus Overview Editor should look like below.

clip_image025

Advertisements

Service Bus 12c – Creating Pipeline Template

In this post, you will learn how to create Pipeline Templates in Service Bus 12c.

A Pipeline Template defines general shape or pattern of your message flow. We use Service Bus project XYZCustomer shown below for the demonstration purpose and we intended to create proxy service performing CRUD operations on objects like Customer.

clip_image002

Note: You can create new folders by navigating to File -> New -> From Gallery -> General -> Folder.

Right click Pipelines folder and select New -> Pipeline Template.

clip_image004

Give a meaningful name. Here we are using name CustomerPipelineTemplate.

 

clip_image006

 

Click Next. In this screen, you can choose service type depending on your requirement. Here we want to create WSDL based proxy service, so choose Service Type as WSDL SOAP as shown below.

clip_image008

Click Finish and verify that new Pipeline Template is created and opened in a separate tab as shown below.

clip_image010

Pipeline templates are the right candidates to keep common logic or enforce pattern of message flow to be followed across Proxy services. Typically, you may want to perform following common activities for different operations that your Proxy Service supports.

  • Validation of payload against schema
  • Routing to a business service (e.g: CustomerServiceBS)
  • Error Handling

Along with above functionality, your Pipeline Template needs to have nodes like Operational branch, Pipeline Pair, Stages etc…

When consumers call Proxy Service, it has to take different execution paths based on operation called. The Service Bus provides Operational Branch node serving this purpose. So drag Operational from Template Placeholders onto pipeline template where yellow circle is shown.

 

Note: All Nodes or activities used in message flow for Pipeline or Pipeline template are available in Components -> Message Flow under different sections. If you don’t see Components window, get it by selecting Window -> Components.

clip_image012

clip_image014

Click BranchNode1 and set name as CustomerOperation in Properties tab as shown below. As a best practice, always give meaningful labels for Nodes and other activities (wherever applicable).

clip_image016

Now drag Pipeline Pair from Nodes into Branch and give name as PipelinePair and rename Stage1 node in Request Pipeline to Validation in Properties tab.  Now your pipeline template should look like below.

clip_image018

Service Bus provides Validate activity to do payload validation against schema. So drag Validate activity into Validation stage from Message Processing.

clip_image020

In Properties tab, set Location property value as body and other properties as shown below. Here you will not select any schema or WSDL for validate activity as it’s just template and we will not have any payload available.

clip_image022

There may be additional validations to be performed while designing message flow in concrete Pipelines which requires a place holder. So drag Actions into Validation stage as shown below from Template Placeholders.

clip_image024

Delete Stage1 in Response Pipeline by selecting Delete option on right click. Also you may need to create several Stage nodes in your concrete Pipeline’s message flow. So create a place holder for the same in your template. Drag Stages into pipeline after Validation stage and in Response Pipeline from Template Placeholders. Now your pipeline pair node should look like below.

clip_image026

Routing node always depicts end of your message flow and you will not be able to place any other activities after this node. So drag and place Route after PipelinePair from Template Placeholders and set name as Route in Properties tab. Observe Actions placeholder which allows user to place any type of activity while designing message flow for your concrete pipelines.

clip_image028

Error handling is another aspect of message flow where you may want to follow similar approach for all Proxy Services. So drag Error Handler onto CustomerPipelineTemplate from Nodes. And in Properties tab, set name as ErrorHandler for Stage1 as shown below.

clip_image030

We will see Error Handling in detail in separate post. For the time being, you can drag Actions placeholder into ErrorHandler stage.

With this, you are done with Pipeline Template and can proceed with creation of Pipelines using this template.

Service Bus 12c – Deploying and Testing

During development, you may often deploy and test your Business and Proxy services to verify that you are able to send request and receive response as expected. And typically, if the service provider is external to your organization, you have to configure your business service to use HTTP proxy server.

Note: HTTP Proxy Server is a global resource to be created in Service Bus Application and can be attached to business service in Advanced Settings of Transport Details tab.

In Service Bus 12c, you can use either Integrated or Standalone WLS to test business/proxy services.

Integrated WLS:

Right click business/proxy service and select Run.

clip_image002

If Default Domain does not exist, JDeveloper will prompt for credentials to create Integrated WLS. Enter credentials click OK to start server.

clip_image004

Once the server starts, Test Console is opened as shown below. This Test Console shows all available operations (If it’s based on WSDL), Request Document section (to enter payload), Transport section (to enter transport headers) and Attachments section.

clip_image006

Click Execute and observe that you are able to send request and receive response as shown below. You can use Back to modify payload and repeat your test scenarios.

clip_image008

Standalone WLS:

You can also deploy your service bus project to standalone WLS from JDeveloper and test from sbconsole. Right click XYZCommon project and choose Deploy as shown below.

clip_image010

Finish deployment using steps shown below.

clip_image012

clip_image014

clip_image016

Once deployment is done, login to sbconsole using http://host:port/sbconsole. Clicking arrow icon (highlighted below) will bring up the same Test Console shown earlier.

clip_image018

Another option is exporting your projects as Configuration Jar and deploy to either Integrated or Standalone WLS. To do this, right click XYZCommon project and select Export as shown below.

clip_image019

Select Service Bus Resources option as shown below.

clip_image021

Select Configuration Jar as destination.

clip_image023

Click Next. Give Jar file name including file system path as shown below and click Finish.

clip_image025

Open sbconsle. Create new session by clicking Create to import configuration jar.

clip_image026

Click Import icon in Resources tab.

clip_image028

Select configuration jar using Choose File button as show below.

clip_image030

Click Next. Accept defaults and click Import.

clip_image032

Click Close on confirmation screen and verify new project is shown as below in Resources tab.

clip_image034

Click Activate and confirm the session so that your changes will be effective.

clip_image035

clip_image037

Similarly, you can export service bus project directly to server by choosing Server as shown below in Export Service Bus Resources window shown earlier.

clip_image039

Click Next and choose Destination Server as shown below.

clip_image041

Click Next. Accept defaults and click Finish. Once export is successful, you can launch sbconsole and test your business and proxy services as shown above.

clip_image043

Note: Developer can choose any of the above options for deploying and testing business/proxy services.

Service Bus 12c – Creating Business Services

In Service Bus, Business Services provide abstraction layer and take care of communication with Service Providers. In this post, you will see different ways of creating Business Service in Service Bus project using JDeveloper based on a WSDL. And for the demonstration purpose, we will consider the Service Bus project and WSDLs shown below.

biz1

Method 1:

Right click Service Bus project and select New -> Business Service.

clip_image002

Give a meaningful name for Business Service as shown below.

clip_image004

Click Browse WSDLs icon (shown above) and choose CustomerService WSDL as shown below.

clip_image006

Click OK to go back to Create Business Service wizard.

biz5

Method 2:

Open the Service Bus overview file (file with same name as your project) and drag HTTP adapter into from Components –> Service Bus –> Technology –> HTTP into External Services swim lane to bring up Create Business Service wizard as shown below.

adapter1

overview1

biz2

Give meaningful name for Business Service and click Next. Select the option WSDL and choose WSDL as shown in previous method by clicking Browse WSDLs icon.

biz3

biz4

Method 3:

Right click WSDL in Service Bus project and select Service Bus –> Generate Business Service as shown below.

wsdlbiz

Verify that Create Business Service wizard has come up showing WSDL and binding selected.

wsdlbiz1 

And the following steps are common irrespective of the above methods you choose to create Business Service.

Click Next and enter Endpoint URI of the service.

clip_image008

Click Finish to bring up a new tab showing CustomerServiceBS.bix.

clip_image010

Service Bus 12c – Creating Service Bus Application and Project

In Service Bus development, you make use of different resources like Proxy Service, Business Service, WSDL, XSD, XQuery, XSLT etc. Also there are other resources like SMTP Server, JNDI Provider called Global resources. Service Bus Project acts as a container for different resources and Service Bus Application is a high-level container for all these Service Bus projects and Global resources.

You usually start development activity with creation of new Service Bus Application. Create one by navigating to File -> New -> From Gallery -> Service Bus Tier. Select Service Bus Application and give meaningful name and click Finish. Here we are using ServiceBusAppl as Application Name.

 

 

Creating Service Bus Projects

Now you can proceed with the creation of Service Bus Projects considering reusability and modularity. Create new Service Bus Project by navigating to File -> New -> From Gallery -> Service Bus Tier. Select Service Bus Project and give meaningful name and click Finish. Here we are using XYZCommon as Project Name.

 

 

Now your Project Explorer should look like below showing Service Bus Application and Service Bus Project containing 2 files (pom.xml and XYZCommon). You will see a file with same name as your project called project overview file which opens up Service Bus Overview editor when opened.

 

 Now your Service Bus Overview Editor should look like below. Left swim lane is for services providing an entry point to application so limited to Proxy Services. Middle swim lane is for components providing routing and transformation so limited to Pipelines and Split-joins. Right swim lane is for references providing communication with actual service providers so limited to Business Services or Proxy Services. For more information refer to this link.

 


Advertisements

Pages

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 372 other followers

Enter your email address to follow this blog and receive notifications of new posts by email.

Advertisements