Skip to content

This is a simple connector using a wsdl that explains why and how to start building a connector when you have a wsdl

License

Notifications You must be signed in to change notification settings

pablocabrera85/wsdl-base-connector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WSDL Base Connector

Why Would You Want to Build a WSDL Base Connector?

If you have used mule, you would know that there are great tools in it like the Web Service Consumer that can help you consume a wsdl base service, or even the CXF Component, so…​why bother building a connector?

This tools are great at consuming the services, but any business logic or api custom behavior needs to be added to the mule app.

Lets take for example this simple scenario:

I have a web service that exposes a login message.
The login give us back a token that we need send in every request.
If we wanted to use the get message to retrieve an entity,
we need to get sent that token.
Also, our session could expire and we need to issue a new token.

This simple scenario requires that:

  • Your mule app has one flow to make the login request.

  • That flow needs to save the token in a session variable or an object store.

  • Another flow that has the get request by getting the token from the place were we save it.

  • An exception strategy and somehow make the login request if the session expires.

If anyone on your organization needs to consume the same service, you will need to replicate this pieces, and if anyone finds a bug, you will need to replicate the fix everywhere.

If you build a connector, this can become a reusable component that handles this in a transparent way to the users, with only a single box that you configure once, and use it in an extremely simple flow as you will see in the demo provided.

Build a WSDL Base Connector

The steps are pretty straight foward:

  1. Using a WSDL and CXF code generation, generate a client for your web service. This is achieved by adding the CXF goal on your pom.xml

  2. Create a @ConnectionManagement configuration for your connector as shown in WsdlConfig. Here you will have all the connection logic and initialization of the client.

  3. On your @Connector class add an operation that is marked with the @ReconnectOn and specify the Exception that should trigger reconnection.

Take into account that reconnection will only work if your connection strategy specify that you want to reconnect.

What to do Next?

  • You can pick a different service that is exposed with a wsdl and try to build a connector for it.

  • Read the Anypoint Connector DevKit documentation.

About

This is a simple connector using a wsdl that explains why and how to start building a connector when you have a wsdl

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages