本文整理汇总了Java中org.apache.axis2.client.Options类的典型用法代码示例。如果您正苦于以下问题:Java Options类的具体用法?Java Options怎么用?Java Options使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Options类属于org.apache.axis2.client包,在下文中一共展示了Options类的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: getResponse
import org.apache.axis2.client.Options; //导入依赖的package包/类
private SOAPEnvelope getResponse(SOAPEnvelope inEnvelope) throws AxisFault {
ConfigurationContext confctx = ConfigurationContextFactory.
createConfigurationContextFromFileSystem(TestingUtils.prefixBaseDirectory("target/test-resources/integrationRepo"),
null);
ServiceClient client = new ServiceClient(confctx, null);
Options options = new Options();
client.setOptions(options);
options.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
options.setTo(targetEPR);
options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
options.setExceptionToBeThrownOnSOAPFault(false);
MessageContext msgctx = new MessageContext();
msgctx.setEnvelope(inEnvelope);
OperationClient opClient = client.createClient(ServiceClient.ANON_OUT_IN_OP);
opClient.addMessageContext(msgctx);
opClient.execute(true);
return opClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE).getEnvelope();
}
示例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: 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);
}
}
示例5: 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;
}
}
示例6: ParallelRequestHelper
import org.apache.axis2.client.Options; //导入依赖的package包/类
/**
* constructor for parallel request helper
* we can use this for the initial begin boxcarring request as well.(sending sessionCookie null)
*
* @param sessionCookie
* @param operation
* @param payload
* @param serviceEndPoint
* @throws org.apache.axis2.AxisFault
*/
public ParallelRequestHelper(String sessionCookie, String operation, OMElement payload, String serviceEndPoint) throws AxisFault {
this.payload = payload;
sender = new ServiceClient();
Options options = new Options();
options.setTo(new EndpointReference(serviceEndPoint));
options.setProperty("__CHUNKED__", Boolean.FALSE);
options.setTimeOutInMilliSeconds(45000L);
options.setAction("urn:" + operation);
sender.setOptions(options);
if (sessionCookie != null && !sessionCookie.isEmpty()) {
Header header = new Header("Cookie", sessionCookie);
ArrayList headers = new ArrayList();
headers.add(header);
sender.getOptions().setProperty(HTTPConstants.HTTP_HEADERS, headers);
}
}
示例7: 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;
}
示例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: messageStoringTest
import org.apache.axis2.client.Options; //导入依赖的package包/类
@Test(groups = { "wso2.esb" }, description = "Introduction to Message Store 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) == 1,
"Messages are missing or repeated");
}
示例10: messageStoreFIXStoringTest
import org.apache.axis2.client.Options; //导入依赖的package包/类
@Test(groups = { "wso2.esb" }, description = "Introduction to Message Sampling Processor " +
"test case")
public void messageStoreFIXStoringTest() 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");
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());
}
Assert.assertTrue(messageStoreAdminClient.getMessageCount(MESSAGE_STORE_NAME) > 0,
"Messages are not stored");
}
示例11: 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");
}
示例12: 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");
}
示例13: sendUsingMTOM
import org.apache.axis2.client.Options; //导入依赖的package包/类
public void sendUsingMTOM(String fileName, String targetEPR) throws IOException {
final String EXPECTED = "<m0:uploadFileUsingMTOMResponse xmlns:m0=\"http://services.samples\"><m0:response>" +
"<m0:image>PHByb3h5PkFCQzwvcHJveHk+</m0:image></m0:response></m0:uploadFileUsingMTOMResponse>";
OMFactory factory = OMAbstractFactory.getOMFactory();
OMNamespace ns = factory.createOMNamespace("http://services.samples", "m0");
OMElement payload = factory.createOMElement("uploadFileUsingMTOM", ns);
OMElement request = factory.createOMElement("request", ns);
OMElement image = factory.createOMElement("image", ns);
FileDataSource fileDataSource = new FileDataSource(new File(fileName));
DataHandler dataHandler = new DataHandler(fileDataSource);
OMText textData = factory.createOMText(dataHandler, true);
image.addChild(textData);
request.addChild(image);
payload.addChild(request);
ServiceClient serviceClient = new ServiceClient();
Options options = new Options();
options.setTo(new EndpointReference(targetEPR));
options.setAction("urn:uploadFileUsingMTOM");
options.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
options.setCallTransportCleanup(true);
serviceClient.setOptions(options);
OMElement response = serviceClient.sendReceive(payload);
Assert.assertTrue(response.toString().contains(EXPECTED), "Attachment is missing in the response");
}
示例14: sendUsingMTOM
import org.apache.axis2.client.Options; //导入依赖的package包/类
public void sendUsingMTOM(String fileName, String targetEPR) throws IOException {
OMFactory factory = OMAbstractFactory.getOMFactory();
OMNamespace ns = factory.createOMNamespace("http://services.samples", "m0");
OMElement payload = factory.createOMElement("uploadFileUsingMTOM", ns);
OMElement request = factory.createOMElement("request", ns);
OMElement image = factory.createOMElement("image", ns);
FileDataSource fileDataSource = new FileDataSource(new File(fileName));
DataHandler dataHandler = new DataHandler(fileDataSource);
OMText textData = factory.createOMText(dataHandler, true);
image.addChild(textData);
request.addChild(image);
payload.addChild(request);
ServiceClient serviceClient = new ServiceClient();
Options options = new Options();
options.setTo(new EndpointReference(targetEPR));
options.setAction("urn:uploadFileUsingMTOM");
options.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
options.setCallTransportCleanup(true);
serviceClient.setOptions(options);
OMElement response = serviceClient.sendReceive(payload);
Assert.assertTrue(response.toString().contains(
"<m:testMTOM xmlns:m=\"http://services.samples/xsd\">" + "<m:test1>testMTOM</m:test1></m:testMTOM>"));
}
示例15: main
import org.apache.axis2.client.Options; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
String epr = "https://" + HOST_IP + ":" + HOST_HTTPS_PORT + "/services/samples/SecureDataService";
System.setProperty("javax.net.ssl.trustStore", (new File(CLIENT_JKS_PATH)).getAbsolutePath());
ConfigurationContext ctx = ConfigurationContextFactory
.createConfigurationContextFromFileSystem(null, null);
SecureDataServiceStub stub = new SecureDataServiceStub(ctx, epr);
ServiceClient client = stub._getServiceClient();
Options options = client.getOptions();
client.engageModule("rampart");
options.setUserName("admin");
options.setPassword("admin");
options.setProperty(RampartMessageData.KEY_RAMPART_POLICY, loadPolicy(SECURITY_POLICY_PATH));
Office[] offices = stub.showAllOffices();
for (Office office : offices) {
System.out.println("\t-----------------------------");
System.out.println("\tOffice Code: " + office.getOfficeCode());
System.out.println("\tPhone: " + office.getPhone());
System.out.println("\tAddress Line 1: " + office.getAddressLine1());
System.out.println("\tAddress Line 2: " + office.getAddressLine2());
System.out.println("\tCity: " + office.getCity());
System.out.println("\tState: " + office.getState());
System.out.println("\tPostal Code: " + office.getPostalCode());
System.out.println("\tCountry: " + office.getCountry());
}
}