A WSD Provider which supports any kind of request

Hi guys,

I am currently assigned a task which i am required to design a WSD provider which is able to process any kind of Request (meaning different kind of request with different xml tags) sent in by Client. In your opinion, how should i go about this? Thank you and i am looking forward to your reply!

Regards,
Ronnie She Chien Wei

Hi Ronnie,

only thing I currently can think of is to design the Request as follows:

You will then have to introspect the string for the exptected root tags and transform accordingly.

Can you explain why this design is required by your use case?

Most likely WSD providers will have different operations for different structures as this enhances and eases validation and type safety.

Regards,
Holger

Thanks Holger for your reply.

Actually there is already a WSD provider in place but it is written in JAVA. This piece of code currently supports different type of request which in each request, only the root tag is different:-

Example request 1


Example request 2


Therefore, I am required to design a WSD in ESB which can support different request like example above with only a single WSD Provider in ESB.

I wonder how to achieve this in ESB. According to my understanding, Example request 1 and 2 requires 2 different WSD provider to operate since the input request (Example request 1 & 2) are different.

Regards,
Ronnie She Chien Wei

Hi,

I’m sorry that you’ve been placed with a request which undermines any hint of good development practice.

I usually have a heavy-handed reply back to the requester which takes almost two hours and goes through all of computing history, starting from Turing (they usually never talk again to me). But my seniority and position (quality management) allows me that. You might not be so lucky.

So, what solutions do you have, which can still maintain any semblance of sanity?

Maybe you can design a WSDL where the payload can make use of the xsd:any element…

This way you can accept anything (eyes rolling).

Now, and this is the important, sanity-preserving bit: you should have some routing code which, depending on the contents of the payload, changes execution directly to the service specifically created to handled that.

Maybe you can create a content-handler service for that WSD, which enables you to capture the request’s XML before being decoded, which makes the routing logic much simpler (I suggest keeping a file with the pattern/handler service list, so you can easily find and make an invocation to the desired service).

Please check Vlad Turian’s excellent blog: https://wm-explorer.com/web-services-headers-handlers-part/

Good luck.

1 Like

Hi Ronnie,

what about this approach:
Use one WSD provider with a set of operations (one for each root tag you might receive).
In the provider service implementation point them to a service with a generic document type for content (hopefully content is using the same structure for all the root tags) and (if neccessary) with an additional input with the name of the root tag.
In this service you can then branch on the name of the root tag for further processing.

Do you know all the names of the root tags you are receiving or are they dynamic?

If you know all the names you can use xsd:choice in the WSDL when considering the approach suggested by Gerardo.
This will restrict the accepted requests to those you know of and others will be rejected to avoid security leaks in your implementation.

Regards,
Holger

Thanks Gerardo and Holder for your information :slight_smile:

Regards,
Ronnie She Chien Wei