Temel SOAP WS
HR Self Service WS
http://host:port/logo/services/HRSelfService?wsdl
SOAP WS Java Client
WS Client Main in Java
private static String m_RootURL = "http://localhost:8080/logo/services/";
public static void main(java.lang.String args[])
{
try
{
ConfigurationContext cfg =
ConfigurationContextFactory.createConfigurationContextFromFileSystem("D:\\WS",null);
DataQueryServiceStub stub = new
DataQueryServiceStub(cfg, m_RootURL+"DataQueryService" );
DataQueryServiceStub service = stub;
ServiceClient sc = stub._getServiceClient();
sc.engageModule("addressing");
sc.engageModule("rampart");
OutflowConfiguration outflowConfig = new OutflowConfiguration();
outflowConfig.setActionItems("UsernameToken");
outflowConfig.setUser("admin");
outflowConfig.setPasswordCallbackClass("com.lbs.ws.Test.SampleCallBackHandler");
sc.getOptions().setProperty(WSSHandlerConstants.OUTFLOW_SECURITY, outflowConfig.getProperty());
getRowCount(stub);
}
catch(RemoteException e)
{
e.printStackTrace();
}
}
WS Client CallBackHandler in Java
package com.acme.ws.test;
import java.io.IOException;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.UnsupportedCallbackException;
import javax.security.auth.callback.Callback;
import org.apache.ws.security.WSPasswordCallback;
public class SampleCallBackHandler implements CallbackHandler {
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException
{
for (int i = 0; i < callbacks.length; i++)
{
WSPasswordCallback pwcb = (WSPasswordCallback) callbacks[i];
String id = pwcb.getIdentifier();
if ("admin".equals(id))
{
pwcb.setPassword("logo");
}
}
}
}
Copyright © 2018 Logo Yazılım