本文整理汇总了Java中org.apache.axis2.client.Options.setProperty方法的典型用法代码示例。如果您正苦于以下问题:Java Options.setProperty方法的具体用法?Java Options.setProperty怎么用?Java Options.setProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.axis2.client.Options
的用法示例。
在下文中一共展示了Options.setProperty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initStub
import org.apache.axis2.client.Options; //导入方法依赖的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: setBasicAccessSecurityHeaders
import org.apache.axis2.client.Options; //导入方法依赖的package包/类
public static void setBasicAccessSecurityHeaders(String userName, String password, boolean rememberMe,
Options options) throws AxisFault {
String userNamePassword = userName + ":" + password;
String encodedString = Base64Utils.encode(userNamePassword.getBytes());
String authorizationHeader = "Basic " + encodedString;
List<Header> headers = new ArrayList<Header>();
Header authHeader = new Header("Authorization", authorizationHeader);
headers.add(authHeader);
if (rememberMe) {
Header rememberMeHeader = new Header("RememberMe", "true");
headers.add(rememberMeHeader);
}
options.setProperty(HTTPConstants.HTTP_HEADERS, headers);
}
示例3: setupValidationService
import org.apache.axis2.client.Options; //导入方法依赖的package包/类
/**
*
* @param stub
* @return receives a non prepared stub and set up it
*/
private OAuth2TokenValidationServiceStub setupValidationService(OAuth2TokenValidationServiceStub stub) {
AuthProperties props = AuthProperties.inst();
ServiceClient client = stub._getServiceClient();
Options options = client.getOptions();
CarbonUtils.setBasicAccessSecurityHeaders(props.getWso2User(), props.getWso2Password(), true, client);
options.setTimeOutInMilliSeconds(TIMEOUT_IN_MILLIS);
options.setProperty(HTTPConstants.SO_TIMEOUT, TIMEOUT_IN_MILLIS);
options.setProperty(HTTPConstants.CONNECTION_TIMEOUT, TIMEOUT_IN_MILLIS);
options.setCallTransportCleanup(true);
options.setManageSession(true);
return stub;
}
示例4: authenticateStub
import org.apache.axis2.client.Options; //导入方法依赖的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;
}
示例5: messageStoringTest
import org.apache.axis2.client.Options; //导入方法依赖的package包/类
@Test(groups = { "wso2.esb" }, description = "Introduction to Message Forwarding Processor " +
"test case")
public void messageStoringTest() throws Exception {
// The count should be 0 as soon as the message store is created
Assert.assertTrue(messageStoreAdminClient.getMessageCount(MESSAGE_STORE_NAME) == 0,
"Message store should be initially empty");
// refer within a sequence through a store mediator, mediate messages
// and verify the messages are stored correctly in the store.
ServiceClient serviceClient = new ServiceClient();
Options options = new Options();
options.setTo(new EndpointReference(getBackEndServiceUrl("SimpleStockQuoteService")));
options.setAction("urn:placeOrder");
options.setProperty(Constants.Configuration.TRANSPORT_URL, getMainSequenceURL());
serviceClient.setOptions(options);
serviceClient.sendRobust(createPayload());
Thread.sleep(30000);
Assert.assertTrue(messageStoreAdminClient.getMessageCount(MESSAGE_STORE_NAME) == 0,
"Messages are not forwarded");
}
示例6: ApplicationManagementServiceClient
import org.apache.axis2.client.Options; //导入方法依赖的package包/类
/**
* @param cookie
* @param backendServerURL
* @param configCtx
* @throws AxisFault
*/
public ApplicationManagementServiceClient(String cookie, String backendServerURL,
ConfigurationContext configCtx) throws AxisFault {
String serviceURL = backendServerURL + "IdentityApplicationManagementService";
String userAdminServiceURL = backendServerURL + "UserAdmin";
stub = new IdentityApplicationManagementServiceStub(configCtx, serviceURL);
userAdminStub = new UserAdminStub(configCtx, userAdminServiceURL);
ServiceClient client = stub._getServiceClient();
Options option = client.getOptions();
option.setManageSession(true);
option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie);
ServiceClient userAdminClient = userAdminStub._getServiceClient();
Options userAdminOptions = userAdminClient.getOptions();
userAdminOptions.setManageSession(true);
userAdminOptions.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie);
if (debugEnabled) {
log.debug("Invoking service " + serviceURL);
}
}
示例7: messageStoreFIXStoringTest
import org.apache.axis2.client.Options; //导入方法依赖的package包/类
@Test(groups = { "wso2.esb" }, description = "RESTful Invocations with Message Forwarding" +
" Processor test case")
public void messageStoreFIXStoringTest() throws Exception {
ServiceClient serviceClient = new ServiceClient();
Options options = new Options();
options.setTo(new EndpointReference(getBackEndServiceUrl("StockQuoteProxy")));
options.setAction("urn:placeOrder");
options.setProperty(Constants.Configuration.TRANSPORT_URL, getMainSequenceURL());
serviceClient.setOptions(options);
for (int i = 0; i < 10; i++) {
serviceClient.sendRobust(createPayload());
}
Thread.sleep(2000);
Assert.assertTrue(messageStoreAdminClient.getMessageCount(MESSAGE_STORE_NAME) == 0,
"Messages are stored");
}
示例8: setMessageContext
import org.apache.axis2.client.Options; //导入方法依赖的package包/类
/**
* creating the message context of the soap message
*
* @param addUrl
* @param trpUrl
* @param action
*/
private void setMessageContext(String addUrl, String trpUrl, String action) {
outMsgCtx = new MessageContext();
//assigning message context’s option object into instance variable
Options options = outMsgCtx.getOptions();
//setting properties into option
if (trpUrl != null && !"null".equals(trpUrl)) {
options.setProperty(Constants.Configuration.TRANSPORT_URL, trpUrl);
}
if (addUrl != null && !"null".equals(addUrl)) {
options.setTo(new EndpointReference(addUrl));
}
if(action != null && !"null".equals(action)) {
options.setAction(action);
}
}
示例9: UserProfileCient
import org.apache.axis2.client.Options; //导入方法依赖的package包/类
public UserProfileCient(String cookie, String url,
ConfigurationContext configContext) throws java.lang.Exception {
try {
this.serviceEndPoint = url + "UserProfileMgtService";
stub = new UserProfileMgtServiceStub(configContext, serviceEndPoint);
ServiceClient client = stub._getServiceClient();
Options option = client.getOptions();
option.setManageSession(true);
option
.setProperty(
org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING,
cookie);
} catch (java.lang.Exception e) {
log.error(e);
throw e;
}
}
示例10: getOptions
import org.apache.axis2.client.Options; //导入方法依赖的package包/类
protected Options getOptions(String action, boolean enableMTOM, String url) {
Options options = new Options();
options.setAction(action);
options.setProperty(WSDL2Constants.ATTRIBUTE_MUST_UNDERSTAND,"1");
options.setTo( new EndpointReference(url) );
options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
// try {
// String from = InetAddress.getLocalHost().getHostAddress();
// options.setFrom(new EndpointReference(from));
// }catch(UnknownHostException e) {
// //ignore From
// }
if (enableMTOM)
options.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
else
options.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_FALSE);
//use SOAP12,
options.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
return options;
}
示例11: ResourceServiceClient
import org.apache.axis2.client.Options; //导入方法依赖的package包/类
public ResourceServiceClient(ServletConfig config, HttpSession session)
throws RegistryException {
String cookie = (String)session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE);
String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(), session);
ConfigurationContext configContext = (ConfigurationContext) config.
getServletContext().getAttribute(CarbonConstants.CONFIGURATION_CONTEXT);
epr = backendServerURL + "ResourceAdminService";
try {
stub = new ResourceAdminServiceStub(configContext, epr);
ServiceClient client = stub._getServiceClient();
Options option = client.getOptions();
option.setManageSession(true);
option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie);
} catch (AxisFault axisFault) {
String msg = "Failed to initiate resource service client. " + axisFault.getMessage();
log.error(msg, axisFault);
throw new RegistryException(msg, axisFault);
}
}
示例12: PropertiesServiceClient
import org.apache.axis2.client.Options; //导入方法依赖的package包/类
public PropertiesServiceClient(ServletConfig config, HttpSession session)
throws RegistryException {
String cookie = (String)session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE);
String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(), session);
ConfigurationContext configContext = (ConfigurationContext) config.
getServletContext().getAttribute(CarbonConstants.CONFIGURATION_CONTEXT);
epr = backendServerURL + "PropertiesAdminService";
try {
stub = new PropertiesAdminServiceStub(configContext, epr);
ServiceClient client = stub._getServiceClient();
Options option = client.getOptions();
option.setManageSession(true);
option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie);
} catch (AxisFault axisFault) {
String msg = "Failed to initiate resource service client. " + axisFault.getMessage();
log.error(msg, axisFault);
throw new RegistryException(msg, axisFault);
}
}
示例13: ResourceImpactAdminClient
import org.apache.axis2.client.Options; //导入方法依赖的package包/类
public ResourceImpactAdminClient(ServletConfig config, HttpSession session,
HttpServletRequest request) throws AxisFault {
String backendServerURL = CarbonUIUtil.getServerURL(config
.getServletContext(), session);
ConfigurationContext configContext = (ConfigurationContext) config
.getServletContext().getAttribute(
CarbonConstants.CONFIGURATION_CONTEXT);
String cookie = (String) session
.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE);
String serviceURL = backendServerURL + "ResourceImpactAdminService";
stub = new ResourceImpactAdminServiceStub(configContext, serviceURL);
ServiceClient client = stub._getServiceClient();
Options option = client.getOptions();
option.setManageSession(true);
option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie);
}
示例14: ResourceServiceClient
import org.apache.axis2.client.Options; //导入方法依赖的package包/类
public ResourceServiceClient(String cookie, ServletConfig config, HttpSession session)
throws RegistryException {
String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(), session);
ConfigurationContext configContext = (ConfigurationContext) config.
getServletContext().getAttribute(CarbonConstants.CONFIGURATION_CONTEXT);
epr = backendServerURL + "ResourceAdminService";
try {
stub = new ResourceAdminServiceStub(configContext, epr);
ServiceClient client = stub._getServiceClient();
Options option = client.getOptions();
option.setManageSession(true);
option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie);
} catch (AxisFault axisFault) {
String msg = "Failed to initiate resource service client. " + axisFault.getMessage();
log.error(msg, axisFault);
throw new RegistryException(msg, axisFault);
}
}
示例15: searchYahoo
import org.apache.axis2.client.Options; //导入方法依赖的package包/类
public String searchYahoo(String query, String format) {
try {
snippet = beginHTML;
String epr = "http://search.yahooapis.com/WebSearchService/V1/webSearch";
ServiceClient client = new ServiceClient();
Options options = new Options();
client.setOptions(options);
options.setTo(new EndpointReference(epr));
options.setProperty(Constants.Configuration.ENABLE_REST, Constants.VALUE_TRUE);
options.setProperty(Constants.Configuration.HTTP_METHOD, Constants.Configuration.HTTP_METHOD_GET);
options.setProperty(Constants.Configuration.MESSAGE_TYPE,org.apache.axis2.transport.http.HTTPConstants.MEDIA_TYPE_X_WWW_FORM);
//if post is through GET of HTTP
OMElement response = client.sendReceive(getPayloadForYahooSearchCall(query, format));
generateSnippet(response);
return snippet;
} catch (Exception e) {
e.printStackTrace();
snippet = "<H2>Error occurred during the invocation to Yahoo search service</H2>" +
"<p>" + e.getMessage() + "</p>" + endHTML;
}
return null;
}