In my previous post I blogged about release of Azure Service Bus EAI/EDI December 2011 CTP last Friday and now I like to demonstrate an EAI solution involving Oracle. First I discuss the installation, labs environment, then the solution setup, deployment and test.
Installation
Installation of Azure Service Bus EAI/EDI 2011 CTP requires attention as I found out the hard way and I advice to carefully read and study the installation article on MSDN. Previous installed SDK need to be removed.
If you fail to do so you will receive error like below.
Note: You can run the RelayConfigurationInstaller.exe tool (which shipped with the previous versions of the Windows Azure AppFabric SDK) with the /u option to remove the WCF Extensions from machine.config.
Labs Environment
After you’ve installed the SDK and ServiceConnect both available through here, you can sign in to the labs environment using a Windows Live ID. Once you signed in you need to click AppFabric position left hand corner of dashboard. Then expand Services and click Service Bus.Click on New in upper left corner of dashboard. A new pop-up Window will appear.
Here you will fill in your Namespace and click Check Availability. Currently you cannot choose another Country/Region or Subscription. Click Create Namespace if it is available. You will then see in the Namespace being activated in LabSubscriptions node.
Once the Namespace is activated, you will able to expand the namespace and see that it is active.
When install ServiceBusConnect you want to see this screen in the end.
EAI Solution
To be able to create the same kind of solution you will need an Oracle 11g XE installed on your environment, you can read this post for guidance. In Oracle you have to create a new workspace and once you have logged in into Oracle click object browser and navigate to Demo_Customers table.
Next step after setting up Oracle is to open Visual Studio 2010, and select Create Project. In the list of project templates, select ServiceBus, and Enterprise Application Integration. Give it a descriptive name and click Ok.
Next create an new schema by right clicking the project and then select New item. Choose schema and give it a descriptive name.
When clicking Add the following Windows might pop up.
Choose Trust. Rename the Root node to Customer and add the following elements to schema as depicted below.
Now a LOB Relay and Target for Insert Operation will be created. In Server Explorer, right-click ServiceBus Connect Servers, and then click Add Server. This will prompt for the ServiceBus Connect Server Management URL. Specify the management URL. The ServiceBus Connect Server Management URL is path to the ManagementService.svc WCF service hosted in IIS. Runtime: ServiceBus Connect Service Runtime Components provides more information on the Service Bus Connect components within IIS. The Service Bus Connect Runtime is installed locally with the default settings, enter: http://localhost:8080/SBConnect/ManagementService.svc/ (or what you have defined).
Right-click the Oracle DB LobTarget and click Add Oracle DB Target… Click the Configure button. In the Security tab, configure the following properties:
- In the Security Properties tab, configure the following properties:
- UserName provide username and password (i.e. SYSTEM)
- In the URI Properties tab, configure the following properties:
- ServerAddress: name of your server
- ServiceName: XE
- ServiceType: Dedicated
Click Connect.In category select SCHEMA and table CUSTOMERS_DEMO, select INSERT operation and click Add.In Target Path, click Configure. The following window displays:
You will have to choose your service namespace (one that you have activated) and provide Issuer Name and Key.
Click Ok. Once the LobRelay is configured, configure the Enter LOB Target Sub-Path property, which can be any name you prefer. Click OK. You will now see the Oracle DB LobTarget in Server Explorer. The new LobTarget can be stopped and started.
—
If you look into the AFConnect database tabels on your database server you will information back:
Right click the created entity in Server Explorer, and then click Add schemas to OracleEAI.
The Schema generation dialog pops up.
Select credential Type as Username, and provide the Oracle credentials that you used install Oracle 11g XE. Click OK. The schemas are now created in the OracleEAI project.
Next steps involve mapping, right click the OracleEAI project, point to Add, and then click New Item and in the Add New Item dialog box, select Map, specify the map name as Customer_Oracle.trfm, and then click OK. The transform window will appear, select the source schema to Customer.xsd and the destination schema to generated schema. This is a new mapper and see Kent his post for more elaboration on it. Drag lines between the fields as depicted below.
You can test the mapping by providing an input instance like below.
Click Test Map and view outcome.
Now that mapping is done the next step is setting up xml request-reply bridge. You can double click on the .bcs file in the OracleEAI project to open the bridge configuration surface. Subsequently right-click anywhere on the bridge configuration surface and click Properties and then for the Service Namespace property, specify the registered service namespace.
Drag and drop an XML Request-Reply Bridge from toolbox to the bridge configuration surface. Open Server Explorer and navigate to created relay (in my case ordinaaim/customer/ordinaaim) and right click it and click Properties. Under Operations tab, copy the value of the first operation and save it to a notepad for later use (see picture below).
Ensure the value for Security is set to ConfiguredUserName. If not, set it now and provide the Oracle credentials that you used to setup Oracle (i.e. SYSTEM account).
Drag and drop the created relay to the bridge configuration surface and click on the connection in toolbox and configure a connection between XML Request-Reply Bridge and created relay through following steps:
- Double click the XML Request-Reply Bridge on the bridge configuration surface.
- Add the request and response schemas to the Message Type box as depicted below:
- Add a transform to the Transform stage. Click the XmlTransform activity under Transform stage. In the Properties window, click the ellipsis (…) button against the Maps property. In the Maps Selection dialog box, select Customer_Oracle.trfm transform and click OK. The selected map will now be reflected in the bridge configuration.
- Leave everything else in the bridge configuration to its default value.
Now you need to go back to bridge configuration surface (.bcs file) and click the connection between XML Request-Reply Bridge and the created relay entity (customer_ordinaaim in my case). In the Properties Window, click the ellipsis (…) button for Filter Condition and in the Route Filter Configuration dialog box, set the filter condition to Match All and click Ok.
Final steps is to set the Route action so that the outgoing message to the LOB application has a SOAP action header. Onthe bridge configuration surface, click the connection between XML Request-Reply Bridge and the created entity (i.e. customer_ordinaaim). In the Properties Window, click the ellipsis (…) button for Route Action and under Destination (Write-To) section, set the Type to SOAP and the Identifier to Action. Then under the Property (Read From) section, select Expression (i.e. in my case http://Microsoft.LobServices.OracleDB/2007/03/AZURE/Table/DEMO_CUSTOMERS/Insert) and specify the value that you saved (operation). Click plus to add the property definition to the property definition table. Click OK in the Property Definition dialog box and then click Save to save changes to an Enterprise Application Integration project.
Note: Expression (i.e. soap action) in single quotes.
Last step is to enable the LOB relay by right clicking it and select enable. If you forget then you will this error when testing the solution.
Deploy EAI Solution
Once you have finished developing your solution you can build it and when it successfully builds deploy the solution. Right click the solution and click Deploy. Window below will pop-up
In the deployment window, the Service Namespace is a read only entity, and this value is reflected from the namespace set in the bridge configuration surface. The Service Namespace and Issuer name are present and you have to provide the Shared Secret. Click Deploy.
Test EAI Solution
Now that the solution has been deployed you want to test it.You first need to locate the MessageSender project in ToolsMessageSender folder under the base directory of samples. Samples can be download from same location as SDK and ServiceBusConnect. You need to open this project and build it. Then you use the resulting MessageSender command line executable to send messages to the deployed bridge end points. This tool accepts command line parameter, and the sequence and usage of those parameters is given below:
MessageSender.exe <ServiceBusNamespace> <IssuerName> <Issuerkey> <RuntimeAddress> <MessageFilepath> <ContentType>
In my case I used the following parameters:
MessageSender.exe OrdinaAIM owner aKSi+p2uiITDK+YUXieOe7iadzC1TauQU6DwW2gsaVo= https://ordinaaim.servicebus.appfabriclabs.com/XmlRequestReplyBridge1 “C:A Lap Around Windows Azure Service BusProjectsOracleEAICustomer.xml” “application/xml”
note: key above is not real!
This console application sends the message to the deployed end point and prints the success/failure message. In my case a failure!
Upon successful completion, the DEMO_CustomerOrder table in Schema you created in Oracle 11g XE would have a new entry created. Not in my case yet!
I hope you have enjoyed reading this example of using Azure Service Bus EAI/EDI CTP with Oracle. I have followed the guidance provided from Microsoft for their sample using SQL Server. I have leveraged their tutorial for this post and extended it with many screenshots to make it more vivid and clear what is happening. Unfortunately until now I have not got it working as I am experiencing an error:
The server was unable to process the request due to an internal error.
For more information about the error, either turn on IncludeExceptionDetailInFaults
(either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior)
on the server in order to send the exception information back to the client,
or turn on tracing as per the Microsoft .NET Framework 3.0 SDK documentation
and inspect the server trace logs.
This is the first CTP of this very promising technology and there is still a lot work to be done. You will not find any features like errorhandling (bumper could have used it here), rules (i.e. BizTalk BRE), monitoring or dashboards yet, but these might come with many other features in future releases. I have certainly enjoyed exploring this technology as some other MVP’s like Mikael Håkansson with his post on content based routing and Mick Badran with his post on Azure AppFabric Labs–EAI, Service Bus in the Cloud.
Cheers.