Sidebar

How can I post a response in a mapping node?

0 votes
510 views
asked Mar 3, 2016 by rich-c-2789 (17,490 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 Node to route the request for the WSDL to a mapping node to handle returning it.  e.g.

//Example 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 in a Mapping Node

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

 

See also:

Handling HTTP requests and responses

Posting Responses via qie.postMessageResponse() in a channel that uses an HTTP Listener source node

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