Sidebar

How can I post a response in a mapping node?

0 votes
447 views
asked Mar 3, 2016 by rich-c-2789 (16,240 points)
I have setup a System variable to hold a WSDL document.  How do I return that from my mapping?  I am using an Http Listener to implement some webservices and I need to be able to return a WSDL.

1 Answer

+1 vote
 
Best answer

1. Create the System variable containing the WSDL e.g. MyWSDL

2. Set up the appropriate condition e.g.

//WSDL URL = http://localhost:8282/my-path/?WSDL=1

var uri = source.getNode('/Request/RequestURI');
var queryString = source.getNode('/Request/QueryString');

return StringUtils.equalsIgnoreCase(uri, '/my-path/') && StringUtils.equalsIgnoreCase(queryString, 'WSDL=1');

 

3. Return the WSDL

qie.postMessageResponse(qie.getVariable('MyWSDL'));

 

This will return the contents of the MyWSDL document when the following URL is specified:

  • http://localhost:8282/my-path/?WSDL=1
answered Mar 8, 2016 by (630 points)
selected Mar 8, 2016 by rich-c-2789
commented Mar 8, 2016 by rich-c-2789 (16,240 points)
Nice.  Can you just use http://localhost:8282/my-path/?WSDL and StringUtils.equalsIgnoreCase(queryString, 'WSDL');?
...