本文整理汇总了Java中org.apache.axis2.client.Stub类的典型用法代码示例。如果您正苦于以下问题:Java Stub类的具体用法?Java Stub怎么用?Java Stub使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Stub类属于org.apache.axis2.client包,在下文中一共展示了Stub类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initStub
import org.apache.axis2.client.Stub; //导入依赖的package包/类
private void initStub(Stub stub) throws AxisFault
{
if( stub != null )
{
final ServiceClient client = stub._getServiceClient();
final Options options = client.getOptions();
options.setProperty(WSHandlerConstants.PW_CALLBACK_REF, this);
options.setProperty(WSSHandlerConstants.OUTFLOW_SECURITY, ofc.getProperty());
options.setProperty(HTTPConstants.REUSE_HTTP_CLIENT, "true");
options.setProperty(HTTPConstants.HTTP_PROTOCOL_VERSION, HTTPConstants.HEADER_PROTOCOL_11);
URI uri = URI.create(bbUrl);
if( uri.getScheme().toLowerCase().startsWith("https") )
{
Protocol myhttps = new Protocol("https", new EasySSLProtocolSocketFactory(), 443);
options.setProperty(HTTPConstants.CUSTOM_PROTOCOL_HANDLER, myhttps);
}
client.engageModule("rampart-1.5.1");
}
}
示例2: authenticateStub
import org.apache.axis2.client.Stub; //导入依赖的package包/类
public static Stub authenticateStub(Stub stub, String sessionCookie, String backendURL) {
long soTimeout = 5 * 60 * 1000; // Three minutes
ServiceClient client = stub._getServiceClient();
Options option = client.getOptions();
option.setManageSession(true);
option.setTimeOutInMilliSeconds(soTimeout);
System.out.println("XXXXXXXXXXXXXXXXXXX" +
backendURL + client.getServiceContext().getAxisService().getName().replaceAll("[^a-zA-Z]", ""));
option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, sessionCookie);
option.setTo(new EndpointReference(backendURL + client.getServiceContext().getAxisService().getName().replaceAll("[^a-zA-Z]", "")));
if (log.isDebugEnabled()) {
log.debug("AuthenticateStub : Stub created with session " + sessionCookie);
}
return stub;
}
示例3: authenticateStub
import org.apache.axis2.client.Stub; //导入依赖的package包/类
public static Stub authenticateStub(Stub stub, String sessionCookie, String backendURL) {
long soTimeout = 5 * 60 * 1000; // Three minutes
ServiceClient client = stub._getServiceClient();
Options option = client.getOptions();
option.setManageSession(true);
option.setTimeOutInMilliSeconds(soTimeout);
System.out.println("XXXXXXXXXXXXXXXXXXX" +
backendURL + client.getServiceContext().getAxisService().getName().replaceAll("[^a-zA-Z]", ""));
option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, sessionCookie);
option.setTo(new EndpointReference(backendURL + client.getServiceContext().getAxisService().getName().replaceAll("[^a-zA-Z]", "")));
if (log.isDebugEnabled()) {
log.debug("AuthenticateStub : Stub created with session " + sessionCookie);
}
return stub;
}
示例4: prepareStubInternal
import org.apache.axis2.client.Stub; //导入依赖的package包/类
private void prepareStubInternal(Stub stub)
{
Options options = stub._getServiceClient().getOptions();
options.setExceptionToBeThrownOnSOAPFault(true);
options.setTimeOutInMilliSeconds(timeout);
options.setManageSession(true);
if (sessionCookie != null)
{
options.setProperty(HTTPConstants.COOKIE_STRING, sessionCookie);
}
options.setProperty(HTTPConstants.REUSE_HTTP_CLIENT, Boolean.TRUE);
if (httpUsername != null && httpUsername.length() >= 0 && httpPassword != null)
{
HttpTransportProperties.Authenticator authenticator =
new HttpTransportProperties.Authenticator();
authenticator.setUsername(httpUsername);
authenticator.setPassword(httpPassword);
options.setProperty(HTTPConstants.AUTHENTICATE, authenticator);
}
}
示例5: setBasicAuth
import org.apache.axis2.client.Stub; //导入依赖的package包/类
/**
* Ugly hack which only works due to the fact that the session server
* doesn't verifiy the user's organization role
*
* @param stub
*/
private void setBasicAuth(Stub stub) {
HttpTransportProperties.Authenticator basicAuth = new HttpTransportProperties.Authenticator();
basicAuth.setUsername(userKey);
basicAuth.setPassword(password);
basicAuth.setPreemptiveAuthentication(true);
final Options clientOptions = stub._getServiceClient().getOptions();
clientOptions.setProperty(HTTPConstants.AUTHENTICATE, basicAuth);
}
示例6: authenticateStub
import org.apache.axis2.client.Stub; //导入依赖的package包/类
/**
* Stub authentication method
*
* @param stub valid stub
* @param sessionCookie session cookie
*/
public static void authenticateStub(String sessionCookie, Stub stub) {
long soTimeout = 5 * 60 * 1000; // Three minutes
ServiceClient client = stub._getServiceClient();
Options option = client.getOptions();
option.setManageSession(true);
option.setTimeOutInMilliSeconds(soTimeout);
option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, sessionCookie);
if (log.isDebugEnabled()) {
log.debug("AuthenticateStub : Stub created with session " + sessionCookie);
}
}
示例7: cleanup
import org.apache.axis2.client.Stub; //导入依赖的package包/类
private void cleanup(Stub stub) {
if (stub != null) {
try {
stub.cleanup();
} catch (AxisFault axisFault) {
log.warn("Failed to clean the stub " + stub.getClass());
}
}
}
示例8: cleanup
import org.apache.axis2.client.Stub; //导入依赖的package包/类
private void cleanup(Stub stub) {
if (stub != null) {
try {
stub.cleanup();
} catch (AxisFault axisFault) {
//do nothing
}
}
}
示例9: setupStub
import org.apache.axis2.client.Stub; //导入依赖的package包/类
public static void setupStub(final @NotNull Stub stub, final @NotNull Credentials credentials, final @NotNull URI serverUri) {
Options options = stub._getServiceClient().getOptions();
// http params
options.setProperty(HTTPConstants.CHUNKED, Constants.VALUE_FALSE);
options.setProperty(HTTPConstants.MC_ACCEPT_GZIP, Boolean.TRUE);
options.setProperty(HTTPConstants.SO_TIMEOUT, SOCKET_TIMEOUT);
if (Registry.is("tfs.set.connection.timeout", false)) {
options.setProperty(HTTPConstants.CONNECTION_TIMEOUT, SOCKET_TIMEOUT);
}
// credentials
if (credentials.getType() == Credentials.Type.Alternate) {
String basicAuth =
BasicScheme.authenticate(new UsernamePasswordCredentials(credentials.getUserName(), credentials.getPassword()), "UTF-8");
Map<String, String> headers = new HashMap<String, String>();
headers.put(HTTPConstants.HEADER_AUTHORIZATION, basicAuth);
options.setProperty(HTTPConstants.HTTP_HEADERS, headers);
}
else {
HttpTransportProperties.Authenticator auth = new HttpTransportProperties.Authenticator();
auth.setUsername(credentials.getUserName());
auth.setPassword(credentials.getPassword() != null ? credentials.getPassword() : "");
auth.setDomain(credentials.getDomain());
auth.setHost(serverUri.getHost());
options.setProperty(HTTPConstants.AUTHENTICATE, auth);
HttpMethodParams params = new HttpMethodParams();
params.setBooleanParameter(USE_NATIVE_CREDENTIALS, credentials.getType() == Credentials.Type.NtlmNative);
options.setProperty(HTTPConstants.HTTP_METHOD_PARAMS, params);
}
// proxy
final HttpTransportProperties.ProxyProperties proxyProperties;
final HTTPProxyInfo proxy = HTTPProxyInfo.getCurrent();
if (proxy.host != null) {
proxyProperties = new HttpTransportProperties.ProxyProperties();
Pair<String, String> domainAndUser = getDomainAndUser(proxy.user);
proxyProperties.setProxyName(proxy.host);
proxyProperties.setProxyPort(proxy.port);
proxyProperties.setDomain(domainAndUser.first);
proxyProperties.setUserName(domainAndUser.second);
proxyProperties.setPassWord(proxy.password);
}
else {
proxyProperties = null;
}
options.setProperty(HTTPConstants.PROXY, proxyProperties);
}
示例10: setAuthCookie
import org.apache.axis2.client.Stub; //导入依赖的package包/类
private void setAuthCookie(boolean isExpired, Stub stub, Authenticator authenticator)
throws Exception {
ServiceClient client = stub._getServiceClient();
Options option = client.getOptions();
option.setManageSession(true);
option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING,
authenticator.getCookie(isExpired));
}
示例11: setSSLProtocolHandler
import org.apache.axis2.client.Stub; //导入依赖的package包/类
/**
* Set the custom trust manager as the ssl protocol handler for the stub
*
* @param stub
* @throws Exception
*/
public static void setSSLProtocolHandler(Stub stub) throws Exception {
init();
stub._getServiceClient()
.getOptions()
.setProperty(HTTPConstants.CUSTOM_PROTOCOL_HANDLER,
new Protocol("https", (ProtocolSocketFactory) new CustomSSLProtocolSocketFactory(sslCtx), 443));
}
示例12: configureServiceClient
import org.apache.axis2.client.Stub; //导入依赖的package包/类
private void configureServiceClient(Stub stub, HttpSession session) {
ServiceClient client;Options options;
client = stub._getServiceClient();
options = client.getOptions();
if (workListConfig.getUsername() != null
&& workListConfig.getPassword() != null && workListConfig.isRemote()) {
CarbonUtils.setBasicAccessSecurityHeaders(workListConfig.getUsername(),
workListConfig.getPassword(), client);
} else {
options.setProperty(HTTPConstants.COOKIE_STRING,
session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE));
}
options.setManageSession(true);
}
示例13: prepareStub
import org.apache.axis2.client.Stub; //导入依赖的package包/类
protected void prepareStub(Stub stub)
{
authenticate();
prepareStubInternal(stub);
}
示例14: getServiceStub
import org.apache.axis2.client.Stub; //导入依赖的package包/类
public Stub getServiceStub(){
return this.authenticationAdminStub;
}
示例15: getAuthenticationAdminStub
import org.apache.axis2.client.Stub; //导入依赖的package包/类
public Stub getAuthenticationAdminStub() {
return authenticationAdminStub;
}