Skip to main content

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

1 reply [Last post]
jpanelli
Offline
Joined: 2008-10-13
Points: 0

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

        <wsp:ExactlyOne>

            <wsp:All>

                <sc:CallbackHandlerConfiguration wspp:visibility="private" xmlns:sc="http://schemas.sun.com/2006/03/wss/client">

                    <sc:CallbackHandler name="xwssCallbackHandler" classname="com.intuit.spc.IamSecurityCallbackHandler"/>

                </sc:CallbackHandlerConfiguration>

            </wsp:All>

        </wsp:ExactlyOne>

    </wsp:Policy>

How do I do the same thing in code?

Thanks

Reply viewing options

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

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;
}