本文整理汇总了Java中org.apache.axis2.client.Options.setTo方法的典型用法代码示例。如果您正苦于以下问题:Java Options.setTo方法的具体用法?Java Options.setTo怎么用?Java Options.setTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.axis2.client.Options
的用法示例。
在下文中一共展示了Options.setTo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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");
}
示例2: 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;
}
示例3: 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);
}
}
示例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: 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>"));
}
示例6: 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");
}
示例7: 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);
}
}
示例8: 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");
}
示例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: 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: call
import org.apache.axis2.client.Options; //导入方法依赖的package包/类
private OMElement call(OMElement metadata_ele, String endpoint)
throws XdsWSException, XdsException, AxisFault {
Options options = new Options();
options.setTo(new EndpointReference(endpoint)); // this sets the location of MyService service
ServiceClient serviceClient = new ServiceClient();
serviceClient.setOptions(options);
OMElement result;
Soap soap = new Soap();
soap.setAsync(async);
soap.soapCall(metadata_ele,
null, //Protocol
endpoint,
true, // mtom
true, // addressing
soap12, // soap12
getRequestAction(),
getResponseAction());
result = soap.getResult();
return result;
}
示例12: sendNotification
import org.apache.axis2.client.Options; //导入方法依赖的package包/类
protected void sendNotification(OMElement topicHeader,
OMElement payload,
String endpoint)
throws AxisFault {
// The parameter args is used as a mechanism to pass any argument into this method, which
// is used by the implementations that extend the behavior of the default Carbon Event
// Dispatcher.
ServiceClient serviceClient = new ServiceClient();
Options options = new Options();
options.setTo(new EndpointReference(endpoint));
options.setAction(EventingConstants.WSE_PUBLISH);
serviceClient.setOptions(options);
serviceClient.addHeader(topicHeader);
serviceClient.fireAndForget(payload);
}
示例13: testEchoXMLSyncHttpVersion
import org.apache.axis2.client.Options; //导入方法依赖的package包/类
public void testEchoXMLSyncHttpVersion() throws Exception {
OMElement payload = TestingUtils.createDummyOMElement();
Options options = new Options();
options.setTo(targetEPR);
options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
options.setProperty(HTTPConstants.HTTP_PROTOCOL_VERSION, HTTPConstants.HEADER_PROTOCOL_10);
ConfigurationContext configContext =
ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, null);
ServiceClient sender = new ServiceClient(configContext, null);
sender.setOptions(options);
OMElement result = sender.sendReceive(payload);
TestingUtils.compareWithCreatedOMElement(result);
}
示例14: testSendRobust
import org.apache.axis2.client.Options; //导入方法依赖的package包/类
public void testSendRobust() throws Exception {
EndpointReference targetEPR = new EndpointReference(
"http://127.0.0.1:" + (UtilServer.TESTING_PORT)
// "http://127.0.0.1:" + 5556
+ "/axis2/services/Echo/echoOMElementNoResponse");
OMElement payload = createDummyOMElement();
Options options = new Options();
options.setTo(targetEPR);
options.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
options.setAction("urn:echoOMElementNoResponse");
ConfigurationContext configContext =
ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, null);
ServiceClient sender = new ServiceClient(configContext, null);
sender.setOptions(options);
sender.sendRobust(payload);
String value = System.getProperty("echoOMElementNoResponse");
System.setProperty("echoOMElementNoResponse", "");
assertEquals(value, "echoOMElementNoResponse");
}
示例15: callUpdateOperation
import org.apache.axis2.client.Options; //导入方法依赖的package包/类
/**
* Calls an update operation of a target web service with the given parameters and does not
* returns the result.
*
* @param epr
* End point reference of the service
* @param opName
* Operation to be called in the service
* @param params
* Parameters of the service call
* @throws AxisFault
*/
public static void callUpdateOperation(String epr, String opName,
Map<String, String> params) {
EndpointReference targetEPR = new EndpointReference(epr);
OMElement payload = getPayload(opName, params);
Options options = new Options();
options.setTo(targetEPR);
options.setAction("urn:" + opName);
ServiceClient sender = null;
try {
sender = new ServiceClient();
sender.setOptions(options);
sender.sendRobust(payload);
} catch (AxisFault axisFault) {
axisFault.printStackTrace();
}
}