本文整理汇总了Java中org.apache.axis2.client.Options.setTransportInProtocol方法的典型用法代码示例。如果您正苦于以下问题:Java Options.setTransportInProtocol方法的具体用法?Java Options.setTransportInProtocol怎么用?Java Options.setTransportInProtocol使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.axis2.client.Options
的用法示例。
在下文中一共展示了Options.setTransportInProtocol方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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();
}
示例2: 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;
}
示例3: testEchoXMLSync
import org.apache.axis2.client.Options; //导入方法依赖的package包/类
public void testEchoXMLSync() throws Exception {
for (int i = 0; i < 10; i++) {
OMElement payload = createPayload();
Options clientOptions = new Options();
clientOptions.setTo(targetEPR);
clientOptions.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
clientOptions.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
ConfigurationContext configContext =
ConfigurationContextFactory
.createConfigurationContextFromFileSystem(null, null);
ServiceClient sender = new ServiceClient(configContext, null);
sender.setOptions(clientOptions);
OMElement result = sender.sendReceive(payload);
OMElement data = (OMElement)result.getFirstOMChild();
compareWithCreatedOMText(data.getText());
log.info("" + i);
UtilServer.unDeployClientService();
}
}
示例4: createServiceClient
import org.apache.axis2.client.Options; //导入方法依赖的package包/类
private ServiceClient createServiceClient() throws AxisFault {
AxisService service =
createSimpleOneWayServiceforClient(serviceName,
Echo.class.getName(),
operationName);
ConfigurationContext configcontext = UtilServer.createClientConfigurationContext();
ServiceClient sender;
Options options = new Options();
options.setTo(targetEPR);
options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
options.setAction(operationName.getLocalPart());
options.setReplyTo(replyTo);
options.setFaultTo(faultTo);
options.setProperty(AddressingConstants.WS_ADDRESSING_VERSION,
AddressingConstants.Submission.WSA_NAMESPACE);
sender = new ServiceClient(configcontext, service);
sender.setOptions(options);
sender.engageModule("addressing");
return sender;
}
示例5: testEchoXMLSync
import org.apache.axis2.client.Options; //导入方法依赖的package包/类
public void testEchoXMLSync() throws Exception {
OMElement payload = createPayload();
Options options = new Options();
options.setTo(targetEPR);
options.setTransportInProtocol(Constants.TRANSPORT_TCP);
options.setAction(Constants.AXIS2_NAMESPACE_URI+"/"+operationName.getLocalPart());
ServiceClient sender = new ServiceClient(configContext, clientService);
sender.setOptions(options);
OMElement result = sender.sendReceive(operationName, payload);
result.serialize(StAXUtils.createXMLStreamWriter(
System.out));
sender.cleanup();
}
示例6: testEchoXMLSync
import org.apache.axis2.client.Options; //导入方法依赖的package包/类
public void testEchoXMLSync() throws Exception {
OMElement payload = TestingUtils.createDummyOMElement();
Options options = new Options();
options.setTo(targetEPR);
options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
ConfigurationContext configContext =
ConfigurationContextFactory.createConfigurationContextFromFileSystem(
TestingUtils.prefixBaseDirectory(Constants.TESTING_PATH + "commons-http-enabledRepository"), null);
ServiceClient sender = new ServiceClient(configContext, null);
sender.setOptions(options);
OMElement result = sender.sendReceive(payload);
TestingUtils.compareWithCreatedOMElement(result);
sender.cleanup();
// call.close();
}
示例7: testEchoXMLSync
import org.apache.axis2.client.Options; //导入方法依赖的package包/类
public void testEchoXMLSync() throws Exception {
OMElement payload = createEnvelope();
Options options = new Options();
options.setTo(targetEPR);
options.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
options.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
ConfigurationContext configContext =
ConfigurationContextFactory.createConfigurationContextFromFileSystem(
Constants.TESTING_PATH + "commons-http-enabledRepository", null);
ServiceClient sender = new ServiceClient(configContext, null);
sender.setOptions(options);
options.setTo(targetEPR);
OMElement result = sender.sendReceive(payload);
this.campareWithCreatedOMElement(result);
}
示例8: main
import org.apache.axis2.client.Options; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
Options options = new Options();
options.setTo(targetEPR);
options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
//Blocking invocation via wsa mapping
options.setAction("urn:echo");
ServiceClient sender = new ServiceClient();
sender.setOptions(options);
OMElement result = sender.sendReceive(getBody());
StringWriter writer = new StringWriter();
result.serialize(writer);
writer.flush();
System.out.println(writer.toString());
}
示例9: testEchoXMLSync
import org.apache.axis2.client.Options; //导入方法依赖的package包/类
public void testEchoXMLSync() throws Exception {
OMElement payload = TestingUtils.createDummyOMElement();
Options options = new Options();
options.setTo(targetEPR);
options.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
ConfigurationContext configContext =
ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, null);
ServiceClient sender = new ServiceClient(configContext, null);
sender.setOptions(options);
OMElement result = sender.sendReceive(payload);
TestingUtils.compareWithCreatedOMElement(result);
}
示例10: testSendRobustException
import org.apache.axis2.client.Options; //导入方法依赖的package包/类
public void testSendRobustException() throws Exception {
EndpointReference targetEPR = new EndpointReference(
"http://127.0.0.1:" + (UtilServer.TESTING_PORT)
// "http://127.0.0.1:" + 5556
+ "/axis2/services/Echo/echoWithExeption");
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:echoWithExeption");
ConfigurationContext configContext =
ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, null);
ServiceClient sender = new ServiceClient(configContext, null);
sender.setOptions(options);
try {
sender.sendRobust(payload);
TestCase.fail("Shoud get an exception");
} catch (AxisFault axisFault) {
assertEquals("Invoked the service", axisFault.getMessage());
}
}
示例11: doEchoOM
import org.apache.axis2.client.Options; //导入方法依赖的package包/类
private void doEchoOM(String messageType, String httpMethod) throws Exception{
OMElement payload = createEnvelope();
Options options = new Options();
options.setTo(targetEPR);
options.setProperty(Constants.Configuration.MESSAGE_TYPE, messageType);
options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
options.setProperty(Constants.Configuration.HTTP_METHOD, httpMethod);
// ConfigurationContext clientConfigurationContext = ConfigurationContextFactory.createDefaultConfigurationContext();
ServiceClient sender = new ServiceClient(configurationContext, null);
options.setAction(null);
sender.setOptions(options);
options.setTo(targetEPR);
OMElement result = sender.sendReceive(payload);
OMElement ele = (OMElement)result.getFirstOMChild();
compareWithCreatedOMText(ele.getText());
}
示例12: testEchoXMLSync
import org.apache.axis2.client.Options; //导入方法依赖的package包/类
public void testEchoXMLSync() throws Exception {
OMElement payload = TestingUtils.createDummyOMElement();
Options clientOptions = new Options();
clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
ConfigurationContext configContext =
ConfigurationContextFactory
.createConfigurationContextFromFileSystem(CLIENT_HOME, null);
ServiceClient sender = new ServiceClient(configContext, null);
sender.setOptions(clientOptions);
clientOptions.setTo(targetEPR);
OMElement result = sender.sendReceive(payload);
TestingUtils.compareWithCreatedOMElement(result);
}
示例13: testEchoXMLMultipleSync
import org.apache.axis2.client.Options; //导入方法依赖的package包/类
public void testEchoXMLMultipleSync() throws Exception {
OMElement payload = TestingUtils.createDummyOMElement();
Options options = new Options();
options.setTo(targetEPR);
options.setCallTransportCleanup(true);
options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
options.setTimeOutInMilliSeconds(50000);
ConfigurationContext configContext =
ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, null);
ServiceClient sender = new ServiceClient(configContext, null);
sender.setOptions(options);
for (int i = 0; i < 5; i++) {
OMElement result = sender.sendReceive(payload);
TestingUtils.compareWithCreatedOMElement(result);
}
sender.cleanup();
configContext.terminate();
}
示例14: createServiceClient
import org.apache.axis2.client.Options; //导入方法依赖的package包/类
private ServiceClient createServiceClient() throws AxisFault {
AxisService service =
createSimpleOneWayServiceforClient(serviceName,
Echo.class.getName(),
operationName);
ConfigurationContext configcontext = UtilServer.createClientConfigurationContext();
ServiceClient sender;
Options options = new Options();
options.setTo(targetEPR);
options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
options.setAction(operationName.getLocalPart());
options.setReplyTo(replyTo);
options.setFaultTo(faultTo);
sender = new ServiceClient(configcontext, service);
sender.setOptions(options);
sender.engageModule("addressing");
return sender;
}
示例15: 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");
}