本文整理汇总了Java中org.apache.axis2.addressing.EndpointReference类的典型用法代码示例。如果您正苦于以下问题:Java EndpointReference类的具体用法?Java EndpointReference怎么用?Java EndpointReference使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EndpointReference类属于org.apache.axis2.addressing包,在下文中一共展示了EndpointReference类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sendRequest
import org.apache.axis2.addressing.EndpointReference; //导入依赖的package包/类
public void sendRequest(String eprUrl, String operation, String payload,
int numberOfInstances, List<String> expectedStrings, boolean twoWay)
throws Exception {
waitForProcessDeployment(eprUrl);
// assert !this.isServiceAvailable(eprUrl) : "Service not found";
for (int i = 0; i < numberOfInstances; i++) {
EndpointReference epr = new EndpointReference(eprUrl + "/" + operation);
if (twoWay) {
OMElement result = this.sendRequest(payload, epr);
if (expectedStrings != null) {
for (String expectedString : expectedStrings) {
Assert.assertFalse(!result.toString().contains(expectedString));
}
}
} else {
this.sendRequestOneWay(payload, epr);
}
}
}
示例2: ParallelRequestHelper
import org.apache.axis2.addressing.EndpointReference; //导入依赖的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);
}
}
示例3: authenticateStub
import org.apache.axis2.addressing.EndpointReference; //导入依赖的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: setMessageContext
import org.apache.axis2.addressing.EndpointReference; //导入依赖的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);
}
}
示例5: messageStoringTest
import org.apache.axis2.addressing.EndpointReference; //导入依赖的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");
}
示例6: messageStoreFIXStoringTest
import org.apache.axis2.addressing.EndpointReference; //导入依赖的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: messageStoringTest
import org.apache.axis2.addressing.EndpointReference; //导入依赖的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");
}
示例8: messageStoreFIXStoringTest
import org.apache.axis2.addressing.EndpointReference; //导入依赖的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");
}
示例9: sendUsingMTOM
import org.apache.axis2.addressing.EndpointReference; //导入依赖的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");
}
示例10: sendUsingMTOM
import org.apache.axis2.addressing.EndpointReference; //导入依赖的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>"));
}
示例11: authenticateStub
import org.apache.axis2.addressing.EndpointReference; //导入依赖的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;
}
示例12: getOptions
import org.apache.axis2.addressing.EndpointReference; //导入依赖的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;
}
示例13: call
import org.apache.axis2.addressing.EndpointReference; //导入依赖的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;
}
示例14: handleAddressing
import org.apache.axis2.addressing.EndpointReference; //导入依赖的package包/类
private void handleAddressing(UnifiedEndpoint uep, MessageContext msgContext) {
String addressingVersion = uep.getAddressingVersion();
if (uep.isAddressingEnabled()) {
if (addressingVersion != null
&& UnifiedEndpointConstants.ADDRESSING_VERSION_SUBMISSION.equals(addressingVersion)) {
msgContext.setProperty(AddressingConstants.WS_ADDRESSING_VERSION,
AddressingConstants.Submission.WSA_NAMESPACE);
} else if (addressingVersion != null
&& UnifiedEndpointConstants.ADDRESSING_VERSION_FINAL.equals(addressingVersion)) {
msgContext.setProperty(AddressingConstants.WS_ADDRESSING_VERSION,
AddressingConstants.Final.WSA_NAMESPACE);
}
msgContext.setProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES, Boolean.FALSE);
//Adding ReplyTo address
if (uep.getReplyToAddress() != null) {
msgContext.getOptions().setReplyTo(new EndpointReference(uep.getReplyToAddress().toString()));
}
} else {
msgContext.setProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES, Boolean.TRUE);
}
}
示例15: assertEPRHasCorrectReferenceParameters
import org.apache.axis2.addressing.EndpointReference; //导入依赖的package包/类
private void assertEPRHasCorrectReferenceParameters(EndpointReference epr) {
//<wsa:ReferenceParameters>
// <fabrikam:CustomerKey>123456789</fabrikam:CustomerKey>
// <fabrikam:ShoppingCart>ABCDEFG</fabrikam:ShoppingCart>
//</wsa:ReferenceParameters>
Map referenceParameters = epr.getAllReferenceParameters();
if (referenceParameters != null) {
OMElement refparm1 = (OMElement)referenceParameters
.get(new QName("http://example.com/fabrikam", "CustomerKey"));
assertNotNull(refparm1);
assertEquals("ReferenceParameter value incorrect.", refparm1.getText(), "123456789");
OMElement refparm2 = (OMElement)referenceParameters
.get(new QName("http://example.com/fabrikam", "ShoppingCart"));
assertNotNull(refparm2);
assertEquals("ReferenceParameter value incorrect.", refparm2.getText(), "ABCDEFG");
} else {
fail("No ReferenceParameters found in EPR");
}
}