Testing a Secured Mule ESB Web Service Proxy with SoapUI
Join the DZone community and get the full member experience.
Join For Free<?xml version="1.0" encoding="utf-8"?> <mule xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml" xmlns:https="http://www.mulesoft.org/schema/mule/https" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:pattern="http://www.mulesoft.org/schema/mule/pattern" xmlns:mule-ss="http://www.mulesoft.org/schema/mule/spring-security" xmlns:ss="http://www.springframework.org/schema/security" xsi:schemalocation="http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/current/mule-xml.xsd http://www.mulesoft.org/schema/mule/https http://www.mulesoft.org/schema/mule/https/current/mule-https.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.3/mule.xsd http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/3.3/mule-http.xsd http://www.mulesoft.org/schema/mule/pattern http://www.mulesoft.org/schema/mule/pattern/3.3/mule-pattern.xsd http://www.mulesoft.org/schema/mule/spring-security http://www.mulesoft.org/schema/mule/spring-security/3.3/mule-spring-security.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd"> <mule-ss:security-manager> <mule-ss:delegate-security-provider name="memory-dao" delegate-ref="authenticationmanager" /> </mule-ss:security-manager> <spring:beans> <ss:authentication-manager alias="authenticationmanager"> <ss:authentication-provider> <ss:user-service id="userservice"> <ss:user name="pascal" password="alma" authorities="role_admin" /> </ss:user-service> </ss:authentication-provider> </ss:authentication-manager> </spring:beans> <http:connector name="nosessionconnector"> <service-overrides sessionhandler="org.mule.session.nullsessionhandler" /> </http:connector> <pattern:web-service-proxy name="countries"> <http:inbound-endpoint address="http://localhost:8080" exchange-pattern="request-response"> <mule-ss:http-security-filter realm="mule-realm" /> </http:inbound-endpoint> <http:outbound-endpoint address="http://www.webservicex.net/country.asmx" exchange-pattern="request-response" /> </pattern:web-service-proxy> </mule>i think the code is quite straightforward. every request coming in at
'http://localhost:8080'
is forwarded to
'http://www.webservicex.net/country.asmx'
after the subject has been authenticated against the ‘authentication-provider’.
to test this setup i created a soapui project. also this is quite straightforward but i show it here anyway. i use soapui 4.5.1.
- create a new soapui project
- enter a name and the wsdl of the service
- test the service by making a call
- use the web service proxy
- supply username and password
until here it is all straightforward except for the result in the last call!
it seems that the username and password is not supplied in the call to
the proxy. this is a setting in soapui that you have to enable. it is
‘hidden’ in the ‘preferences’ of the tool. you have to enable the
setting like this:
while testing this code for the post i also had to uncheck the following option to get a ‘human-readable’ response in soapui:
now if you send a request you get the expected answer:
Published at DZone with permission of $$anonymous$$. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments