MUEssentials3.7 StudentManual Mod03
MUEssentials3.7 StudentManual Mod03
Services
In this module, you will learn:
17
18
Note: You can set the name in the Properties view or directly in the blue banner.
10. In the Global Element Properties dialog box, review the HTTP_Listener_Configuration and click
OK.
19
17. In the Properties view, change the display name to United REST Request.
18. Click the Add button next to connector configuration.
20
19. In the Global Element Properties dialog box, set the following values and click OK.
Name: United_REST_Request_Configuration
Host: Use the value for the United web service host listed in the course snippets.txt file.
Port: Use the value for the United web service port listed in the course snippets.txt file.
Base Path: Use the value for the United web service base path listed in the course
snippets.txt file.
20. In the Properties view, set the path to / and the method to GET.
21
21. Click the Global Elements tab at the bottom of the canvas and see the new global configuration
element.
22. Return to the Message Flow view.
22
Modify the HTTP Request connector endpoint to use a URI parameter for the destination.
Set the destination to a static value.
Set the destination to a dynamic query parameter value.
Create a variable to set the destination.
Note: In a later module, you will add an HTML form to the application for destination selection.
2. Make additional requests for destinations of LAX, CLE, PDX, or PDF.
23
24
9. Modify the United REST Request endpoint and set the URI parameter value to LAX.
10. Save and redeploy the application and make another request to http://localhost:8081/united/;
you should now only get the LAX flights.
#[message.inboundProperties.'http.query.params'.code]
25
15. In the Variable Properties view, change the display name to Set Destination.
16. Set the operation to Set Variable and the name to destination.
17. Use a ternary expression to set the value to 'SFO' or the value of a query parameter called
code.
#[(message.inboundProperties.'http.query.params'.code == empty) ?
'SFO' : message.inboundProperties.'http.query.params'.code]
18. Navigate to the Properties view for the United REST connector endpoint.
19. Modify the URI parameter to use the new destination variable.
20. Save and redeploy the application and make a request to http://localhost:8081/united; you
should see only flights to SFO again.
21. Make another request to http://localhost:8081/united?code=PDX; you should now see flights to
PDX.
26
4. In the Properties view for the endpoint, set the connector configuration to the existing
HTTP_Listener_Configuration.
27
Note: If the fields did not populate, click the Reload RAML button next to the RAML location.
13. Click the Global Elements tab at the bottom of the canvas and see the new global configuration
element.
28
15. In the Bank REST Request Properties view, click the drop-down button for the path; you should
see the available resources (paths) for the RESTful web service defined by the RAML file.
16. Select the /customers path.
17. Set the method to GET.
29
30
23. Make a request and try to pass the customer ID as a URI parameter:
http://localhost:8081/bank/2; you should get a Resource not found response.
31
30. Step through the rest of the application; you should still get the account info for the customer
with an ID of 2.
31. Return to the Properties view for the HTTP Listener endpoint.
32. Change the path to specify a URI parameter called ID: /bank/{ID}.
33. Save the file to redeploy the application in debug mode.
34. Make a request to http://localhost:8081/bank/4.
32
35. In the Mule Debugger view, locate the http.request.uri and http.uri.params inbound properties.
36. Step through the rest of the application; you should still get the account info for the customer
with an ID of 2
33
34
10. In the Properties view, set the display name to Delta SOAP Request.
11. Click the Add button next to connector configuration.
12. In the Global Element Properties dialog box, change the name to
Delta_Web_Service_Consumer.
13. Set the WSDL Location to the Delta SOAP web service WSDL listed in the course snippets.txt
file.
35
14. Wait for the WSDL to be parsed and the service, port, and address fields to be automatically
populated.
19. Select the listAllFlights operation.
36
23. Save the file and debug the application.
24. Make a request to http://localhost:8081/delta.
25. In the Mule Debugger view, drill-down into the payload variable.
26. Step to the end of the application.
27. Look at the console; you should see the type of object listed.
37
28. Return to the browser; you should see the XML SOAP response displayed there.
38
32. Step to the Logger; you should see the payload is now a String.
33. Resume the application.
34. Look at the console; you should see the XML SOAP response displayed there.
35. Stop the runtime.
39