Introduction
With more and more companies moving to the cloud, there is increased demand for integration of SaaS offerings using cloud integration platforms but also doing your B2B - Business to Business, in the cloud as a Service. But most companies do not start in the cloud by scratch, they still have systems running on premises, in a container environment, or in as cloud platform service (PaaS - Platform as a service). Usually the systems running there are not exposed as a Service or even shall not, because of security reasons. You still need to integrate those system with your new world, and this is where hybrid B2B comes into place.
In the article B2B as a Service: Connect a Partner via webMethods.io B2B I showed you how to connect to a partner via webMethids.io B2B, how to onboard the partner, define documents and rules for the exchange and how to finally send and receive business documents.
In the article Hybrid Integration: Expose a local service to webMethods.io integration you’ve seen to to expose an on premise service to webMethods.io Integration and so have it in an IPaaS (Integration Platform as a Service).
In this article I will show you how you can bring those 2 parts together, by including the exposed on premise service in a cloud hosted integration flow and calling this by the processing rule of webMethods.io B2B. There is also a video on our youtube channel showing the complete procedure: https://www.youtube.com/watch?v=FNnWlISafts&t=0s
If you want to create this demo yourself, you need a webMethods.io tenant with Integration and B2B enabled.
Prerequisites
This article relies on the assets created in the following 2 articles:
- Hybrid Integration: Expose a local service to webMethods.io Integration Hybrid Integration: Expose a local service to webMethods.io integration
- B2B as a Service: Connect a Partner via webMethods.io B2B B2B as a Service: Connect a Partner via webMethods.io B2B
Create Hybrid Integration Flow
Go to webMethods.io Integration and open your project.
In the upper pane select Recipes and below FlowServices. Recipes are prebuild standard patterns which relieve you if the tedious work of doing the same repeating parts of integrations every time. In this example we will use a recipe to receive a document from B2B and access it’s content. Select the webMethods.io B2B connector in the left pane.
From the recipes select the one to extract the content and update user status. Click Use Recipe.
webMethods.io Integration will create a flow service for you from the recipe. Select your Project (we created one in the related article Hybrid Integration: Expose a local service to webMethods.io Integration). Enter a name for the flow and click Save.
You need a runtime account for executing the connector services. If you have none yet for this connector, click the + and enter an account name.
Click Save.
The Recipe contains steps to generate a Http response. We do not need this on this demo, as use guaranteed processing in the B2B rule. Click the 3 dots in the line of the If statement and select Delete.
Do the same for the Else step. Click the last + step to add an exit step.
Select Exit and make sure the signaling is set to SUCCESS. If there is an error in the service execution later on, the error will be reported to the rule. If there is no error, this makes sure the rule recognizes the successful execution. You may want to add more sophisticated error management in real live implementation though.
Select the first parseContent step and click the map symbol.
The mappings are preconfigured from the recipe. Click the setValue symbol of the field loadContent and make sur it is set to String.
Select the first Change User Status step and click the map symbol. Click the setValue symbol of the field userStatus and make sure it is set to RECEIVED.
Hover your mouse over the connection between the changeUserStatus and the Exit step and click the appearing +.
In the field start typing “xmlStr…” to limit the list of available services. Select xmlStringToDocument.
Open the mapping by clicking the map symbol. Map the outputContent (output from the previous step) to the xmlString input. Click the + symbol in the Pipeline Output column to add a new document.
Set Type to Document Reference as we want to use the Document Type generated from out B2B Document.
In Document Reference select the document type which has been generated from our B2B Document.
Enter a name (e.g. PaymentAdvice). Click Save.
Map the document from the Output column of the service to the newly created document reference by clicking the document and dragging it to the target. Click the document in the Pipeline Output column and click the drop arrow in the toolbar.
The document gets marked with the drop value indicator.
Hover your mouse over the connection between the xmlStringToDocument and the Exit step and click the appearing +.
Select CONNECTORS in the dropdown, scroll down to On-Premise Connectors and select the on premise connector we created in the article Hybrid Integration: Expose a local service to webMethods.io Integration.
Select the Receive_demo_PaymentAdvise service.
Click the User icon and select the on-premise user we created in the same article.
Click the map icon. Expand the PaymentAdvice Document in the Pipeline Input column. Map the inner document PaymentAdvice to the corresponding document in the service input.
Hover your mouse over the connection between the connector service and the Exit step and click the appearing +.
Select CONNECTORS in the dropdown, scroll down and select the webMethodsB2B connector.
From the service selection dropdown choose changeUserStatus.
As above select the user account for the B2B action by clicking the user icon and choosing it from the dropdown.
Set the userStatus to processed. Click Save.
Save your flow.
Click on the 3 dots for your service and select Overview.
Check Enable FlowService to be invoked via HTTP. This is necessary to make this service accessible to webMethods.io B2B.
Adjust Rule to call the flow
Go to webMethods.io B2B. In Rules - processing rules select the rule we created in the related article B2B as a Service: Connect a Partner via webMethods.io B2B.
Go to Actions. Check the box “Call an Integration”. In Select mode for call out select webmethods.io Integration.
As FlowService select the service we just created. Select the user we created in the related article Hybrid Integration: Expose a local service to webMethods.io Integration. Set the Execution Mode to Reliable. Click Update.
Test the processing
Open your test client. We created th test request in the related article B2B as a Service: Connect a Partner via webMethods.io B2B. Click Send.
Go to webMethods.io B2B . Monitoring - Transaction. The Document we just sent is recognized and mapped to the trading partners. Expand the log.
Click the Date/Time field to expand the log. Compared to our first send in the article B2B as a Service: Connect a Partner via webMethods.io B2B it is now much longer. It shows the successful execution of the invoked integration flow and the additonal status changes.
All important execution steps, success as well as errors are logged in the B2B monitoring to give you one place of visibility. Nevertheless you can inspect the logging in the integration part as well for the parts executed there. Go to webMethods.io Integration, select Monitoring - FlowService Execution. Scroll down to see the Executions logged.
If we inspect the local log of the on premise Integration Server (and if we added logging to our local service), we can also see the log of the local execution
and when inspecting the database table we can see ourrecord successfully inserted:
Related articles & Videos
B2B as a Service: Connect a Partner via webMethods.io B2B
Article: B2B as a Service: Connect a Partner via webMethods.io B2B
Video: https://www.youtube.com/watch?v=Sp532ZGfOks&t=0s
Hybrid Integration: Expose a local service to webMethods.io Integration:
Article: Hybrid Integration: Expose a local service to webMethods.io integration
Video: https://www.youtube.com/watch?v=aTCTon0V1Ww&t=0s
Hybrid B2B Bring the pieces together - integrate webMethods.io B2B with webMethods.io Integration
Article: This one!
Video: https://www.youtube.com/watch?v=FNnWlISafts&t=0s