Index Changes
This is version 1. It is not the current version, and thus it cannot be edited.
[Back to current version]   [Restore this version]

Using Normalized Message Properties To Invoke a Webservice secured using basic Auth

1. Create a webservice which is secured using basic auth

Sample Code

@WebService()
public class BasicAuth {
    /**
     * Web service operation
     */
    @WebMethod(operationName = "test")
    public String test(@WebParam(name = "parameter")
    String parameter) {
        //TODO write your implementation code here:
        return "hello " + parameter;
    }

}

web.xml

<security-constraint>
        <display-name>Constraint1</display-name>
        <web-resource-collection>
            <web-resource-name>BasicAuthService</web-resource-name>
            <description/>
            <url-pattern>/BasicAuthService</url-pattern>
            <http-method>POST</http-method>
        </web-resource-collection>
        <auth-constraint>
            <description/>
            <role-name>admin</role-name>
            </auth-constraint>
        </security-constraint>
    <login-config>
        <auth-method>BASIC</auth-method>
        <realm-name>file</realm-name>
        </login-config>
    <security-role>
        <description/>
        <role-name>admin</role-name>
    </security-role>

sun-web.xml

<security-role-mapping>
    <role-name>admin</role-name>
    <principal-name>jondoe</principal-name>
  </security-role-mapping>

2. Create an bpel process which invokes the above web service

3. Test the application

try the sample

JSPWiki v2.4.100
[RSS]
« Home Index Changes Prefs
This particular version was published on 19-Nov-08 17:10 PM, -0800 by sujit