Apr 9, 2012

DataPower get WSDL from MPGW - make it work with ?wsdl

I needed to make the GET method work with POST on MPGW (Multiple Protocol Gateway). I made a proxy service which does some WTX COBOL <==> XML mapping ( on that I will expand in another post) over WMQ. The proxy exposed over SOAP.
I wanted to enable the service consumers an option to get the WSDL from the DP on the same URL with the "?wsdl" method. Customer doesn't have WSRR or other registry solution on site.
On the way I encountered on a strange issue in DP when tried to make the GET and POST methods enabled at the same time on the MPG. It just didn't worked at the same time. POST or GET not together.
No error at all, after some investigation of the probe log I noticed the following information message :

"Event Code 0x80e0010e - The configuration has disabled rule processing in one direction.
The configuration has disabled rule processing in one direction. This may be due to an 'unprocessed' rule setting, or a dataflow which is inherently unidirectional, such as HTTP GET transactions which only have databodies in the response path."

The issue was that by default the policy rule can handle only one method at a time like GET or POST and not together. IBM likes to hide stuff.

To handle this issue you need to enable non xml processing on the processing rule under the Objects --> Xml Processing --> Processing Rule --> [Your Rule], set the "Non-XML Processing" to on. This will solve the parallel processing of SOAP (POST) and HTML (GET) in the same policy.

The Solution pattern :

  • Set the MPG back end to dynamic proxy back end type. It need to be dynamic to enable basic Content Base Routing (CBR) on the response flow. One handles the WS request and the other the WSDL. The distinction will be made in the match pattern on the back end URI.

  • Create a Client to Server processing rule which would handle the GET ?wsdl (also the match pattern "*?wsdl|WSDL) request.
    I did simple fetch to the WSDL file from local store, It can be handled differently with registry/repository on site :-). Or it can be evolved to dynamic xslt which will generate WSDL with environment context like the address.
    in the rule you need to set the back end URL to different from the original service so you can match on it in the response rule. I set it to loopback, you need to set the var://service/routing-url = 
    Also because no back end processing needed set the var://service/mpgw/skip-backside = 1, by this the rule won't pass the request to the back end at all. loopback pattern.
  • Create the Server to Client rule to handle the WSDL response flow. Nothing special there, only  the match pattern which set to "*loopback". Thus handling only the WSDL requests.
That's it.
Hope it would help someone.