Skip to main content

How do I add a security callback on the client side via code instead of via wsit-client.xml

Please note these forums are being decommissioned and use the new and improved forums at
1 reply [Last post]
Joined: 2008-10-13

Right now, I add our security callback via wsit-client.xml:?



                <sc:CallbackHandlerConfiguration wspp:visibility="private" xmlns:sc="">

                    <sc:CallbackHandler name="xwssCallbackHandler" classname=""/>





How do I do the same thing in code?


Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2008-10-13

I got a reply from Kumar J. on this and was able to work it out. Essentially, this code demonstrates adding both a security callback handler AND a soap callback handler programmatically:

public static AccountManager getAccountManager() {
    // Create a new service.
    AccountManager_Service accountManagerService = new AccountManager_Service();

    // Get a port from the service with the IamSecurityCallbackHandler attached.
    AccountManager accountManager = accountManagerService.getAccountManagerSOAP(new CallbackHandlerFeature(new IamSecurityCallbackHandler()));

   <span class="Apple-tab-span" style="white-space:pre"> </span>// Attach the IamSoapCallbackHandler to the port.
   <span class="Apple-tab-span" style="white-space:pre"> </span>List&lt;Handler&gt; handlerChain = new ArrayList&lt;Handler&gt;();
    handlerChain.add(new IamSoapCallbackHandler(&quot;AccountManager&quot;, &quot;IDM&quot;));
    ((BindingProvider) accountManager).getBinding().setHandlerChain(handlerChain);

    return accountManager;