本文整理汇总了Java中org.apache.axis2.client.Options.setExceptionToBeThrownOnSOAPFault方法的典型用法代码示例。如果您正苦于以下问题:Java Options.setExceptionToBeThrownOnSOAPFault方法的具体用法?Java Options.setExceptionToBeThrownOnSOAPFault怎么用?Java Options.setExceptionToBeThrownOnSOAPFault使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.axis2.client.Options
的用法示例。
在下文中一共展示了Options.setExceptionToBeThrownOnSOAPFault方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: prepareStubInternal
import org.apache.axis2.client.Options; //导入方法依赖的package包/类
private void prepareStubInternal(Stub stub)
{
Options options = stub._getServiceClient().getOptions();
options.setExceptionToBeThrownOnSOAPFault(true);
options.setTimeOutInMilliSeconds(timeout);
options.setManageSession(true);
if (sessionCookie != null)
{
options.setProperty(HTTPConstants.COOKIE_STRING, sessionCookie);
}
options.setProperty(HTTPConstants.REUSE_HTTP_CLIENT, Boolean.TRUE);
if (httpUsername != null && httpUsername.length() >= 0 && httpPassword != null)
{
HttpTransportProperties.Authenticator authenticator =
new HttpTransportProperties.Authenticator();
authenticator.setUsername(httpUsername);
authenticator.setPassword(httpPassword);
options.setProperty(HTTPConstants.AUTHENTICATE, authenticator);
}
}
示例3: getOperationClient
import org.apache.axis2.client.Options; //导入方法依赖的package包/类
private static OperationClient getOperationClient(MessageContext partnerMessageContext,
ConfigurationContext clientConfigCtx)
throws AxisFault {
AxisService anonymousService =
AnonymousServiceFactory.getAnonymousService(Constants.registrationService,
Constants.REGISTRATION_PORT,
clientConfigCtx.getAxisConfiguration(), Constants.HUMANTASK_COORDINATION_MODULE_NAME);
anonymousService.getParent().addParameter("hiddenService", "true");
ServiceGroupContext sgc = new ServiceGroupContext(clientConfigCtx, (AxisServiceGroup) anonymousService.getParent());
ServiceContext serviceCtx = sgc.getServiceContext(anonymousService);
AxisOperation axisAnonymousOperation = anonymousService.getOperation(ServiceClient.ANON_OUT_IN_OP);
Options clientOptions = cloneOptions(partnerMessageContext.getOptions());
clientOptions.setExceptionToBeThrownOnSOAPFault(false);
/* This value doesn't overrideend point config. */
clientOptions.setTimeOutInMilliSeconds(60000);
return axisAnonymousOperation.createClient(serviceCtx, clientOptions);
}
示例4: getOperationClient
import org.apache.axis2.client.Options; //导入方法依赖的package包/类
private static OperationClient getOperationClient(ServiceInvocationContext partnerMessageContext,
ConfigurationContext clientConfigCtx)
throws AxisFault {
AxisService anonymousService =
AnonymousServiceFactory.getAnonymousService(partnerMessageContext.getService(),
partnerMessageContext.getPort(),
clientConfigCtx.getAxisConfiguration(), partnerMessageContext.getCaller());
anonymousService.engageModule(clientConfigCtx.getAxisConfiguration().getModule("UEPModule"));
anonymousService.getParent().addParameter(
"hiddenService", "true");
ServiceGroupContext sgc = new ServiceGroupContext(
clientConfigCtx, (AxisServiceGroup) anonymousService.getParent());
ServiceContext serviceCtx = sgc.getServiceContext(anonymousService);
// get a reference to the DYNAMIC operation of the Anonymous Axis2 service
AxisOperation axisAnonymousOperation = anonymousService.getOperation(
partnerMessageContext.isTwoWay() ? ServiceClient.ANON_OUT_IN_OP :
ServiceClient.ANON_OUT_ONLY_OP);
Options clientOptions = cloneOptions(partnerMessageContext.getInMessageContext().getOptions());
clientOptions.setExceptionToBeThrownOnSOAPFault(false);
/* This value doesn't overrideend point config. */
clientOptions.setTimeOutInMilliSeconds(60000);
return axisAnonymousOperation.createClient(serviceCtx, clientOptions);
}
示例5: getOperationClient
import org.apache.axis2.client.Options; //导入方法依赖的package包/类
public static OperationClient getOperationClient(BPELMessageContext partnerMessageContext,
ConfigurationContext clientConfigCtx)
throws AxisFault {
AxisService anonymousService =
AnonymousServiceFactory.getAnonymousService(partnerMessageContext.getService(),
partnerMessageContext.getPort(),
clientConfigCtx.getAxisConfiguration(), partnerMessageContext.getCaller());
anonymousService.engageModule(clientConfigCtx.getAxisConfiguration().getModule("UEPModule"));
anonymousService.getParent().addParameter(
BPELConstants.HIDDEN_SERVICE_PARAM, "true");
ServiceGroupContext sgc = new ServiceGroupContext(
clientConfigCtx, (AxisServiceGroup) anonymousService.getParent());
ServiceContext serviceCtx = sgc.getServiceContext(anonymousService);
// get a reference to the DYNAMIC operation of the Anonymous Axis2 service
AxisOperation axisAnonymousOperation = anonymousService.getOperation(
partnerMessageContext.isTwoWay() ? ServiceClient.ANON_OUT_IN_OP :
ServiceClient.ANON_OUT_ONLY_OP);
Options clientOptions = cloneOptions(partnerMessageContext.getInMessageContext().getOptions());
clientOptions.setExceptionToBeThrownOnSOAPFault(false);
/* This value doesn't overrideend point config. */
clientOptions.setTimeOutInMilliSeconds(60000);
return axisAnonymousOperation.createClient(serviceCtx, clientOptions);
}
示例6: cloneOptions
import org.apache.axis2.client.Options; //导入方法依赖的package包/类
public static Options cloneOptions(Options options) {
// create new options object and set the parent
Options clonedOptions = new Options(options.getParent());
// copy general options
clonedOptions.setCallTransportCleanup(options.isCallTransportCleanup());
clonedOptions.setExceptionToBeThrownOnSOAPFault(options.isExceptionToBeThrownOnSOAPFault());
clonedOptions.setManageSession(options.isManageSession());
clonedOptions.setSoapVersionURI(options.getSoapVersionURI());
clonedOptions.setTimeOutInMilliSeconds(options.getTimeOutInMilliSeconds());
clonedOptions.setUseSeparateListener(options.isUseSeparateListener());
// copy transport related options
clonedOptions.setListener(options.getListener());
clonedOptions.setTransportIn(options.getTransportIn());
clonedOptions.setTransportInProtocol(options.getTransportInProtocol());
clonedOptions.setTransportOut(clonedOptions.getTransportOut());
// copy username and password options
clonedOptions.setUserName(options.getUserName());
clonedOptions.setPassword(options.getPassword());
// cloen the property set of the current options object
for (Object o : options.getProperties().keySet()) {
String key = (String) o;
clonedOptions.setProperty(key, options.getProperty(key));
}
return clonedOptions;
}
示例7: cloneOptions
import org.apache.axis2.client.Options; //导入方法依赖的package包/类
/**
* Clones the given {@link org.apache.axis2.client.Options} object. This is not a deep copy
* because this will be called for each and every message going out from synapse. The parent
* of the cloning options object is kept as a reference.
*
* @param options clonning object
* @return clonned Options object
*/
public static Options cloneOptions(Options options) {
// create new options object and set the parent
Options clonedOptions = new Options(options.getParent());
// copy general options
clonedOptions.setCallTransportCleanup(options.isCallTransportCleanup());
clonedOptions.setExceptionToBeThrownOnSOAPFault(options.isExceptionToBeThrownOnSOAPFault());
clonedOptions.setManageSession(options.isManageSession());
clonedOptions.setSoapVersionURI(options.getSoapVersionURI());
clonedOptions.setTimeOutInMilliSeconds(options.getTimeOutInMilliSeconds());
clonedOptions.setUseSeparateListener(options.isUseSeparateListener());
// copy transport related options
clonedOptions.setListener(options.getListener());
clonedOptions.setTransportIn(options.getTransportIn());
clonedOptions.setTransportInProtocol(options.getTransportInProtocol());
clonedOptions.setTransportOut(clonedOptions.getTransportOut());
// copy username and password options
clonedOptions.setUserName(options.getUserName());
clonedOptions.setPassword(options.getPassword());
// cloen the property set of the current options object
for (Object o : options.getProperties().keySet()) {
String key = (String) o;
clonedOptions.setProperty(key, options.getProperty(key));
}
return clonedOptions;
}
示例8: testFaultThrownByServiceUsingAxisFaultOnly
import org.apache.axis2.client.Options; //导入方法依赖的package包/类
/**
* Service throws a fault from the service impl, by just creating an AxisFault from all the
* fault information.
*/
public void testFaultThrownByServiceUsingAxisFaultOnly() {
try {
OMElement payload =
getOMElementWithText(FaultThrowingService.THROW_FAULT_AS_AXIS_FAULT);
Options options = new Options();
options.setTo(targetEPR);
options.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
options.setExceptionToBeThrownOnSOAPFault(false);
ConfigurationContext configContext =
ConfigurationContextFactory
.createConfigurationContextFromFileSystem(null, null);
ServiceClient sender = new ServiceClient(configContext, null);
sender.setOptions(options);
String result = sender.sendReceive(payload).toString();
assertTrue(result.indexOf("test:TestFault") > -1);
assertTrue(result.indexOf("FaultReason</soapenv:Text>") > -1);
assertTrue(result.indexOf("This is a test Exception") > -1);
} catch (AxisFault axisFault) {
axisFault.printStackTrace();
fail();
}
}
示例9: testFaultThrownByServiceUsingMessageContext
import org.apache.axis2.client.Options; //导入方法依赖的package包/类
/** Service sends out a fault, filling all the information to the message context */
public void testFaultThrownByServiceUsingMessageContext() {
try {
OMElement payload =
getOMElementWithText(FaultThrowingService.THROW_FAULT_WITH_MSG_CTXT);
Options options = new Options();
options.setTo(targetEPR);
options.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
options.setExceptionToBeThrownOnSOAPFault(false);
ConfigurationContext configContext =
ConfigurationContextFactory
.createConfigurationContextFromFileSystem(null, null);
ServiceClient sender = new ServiceClient(configContext, null);
sender.setOptions(options);
String result = sender.sendReceive(payload).toString();
assertTrue(result.indexOf("test:TestFault") > -1);
assertTrue(result.indexOf("FaultReason</soapenv:Text>") > -1);
assertTrue(result.indexOf("This is a test Exception") > -1);
} catch (AxisFault axisFault) {
axisFault.printStackTrace();
fail();
}
}
示例10: testExceptionInformationExtractionFromAxisFault
import org.apache.axis2.client.Options; //导入方法依赖的package包/类
public void testExceptionInformationExtractionFromAxisFault() {
try {
ConfigurationContext configContext =
ConfigurationContextFactory.createConfigurationContextFromFileSystem(
TestingUtils.prefixBaseDirectory("target/test-resources/integrationRepo"), null);
ServiceClient sender = new ServiceClient(configContext, null);
OMElement payload = getOMElement(FaultHandler.ERR_HANDLING_WITH_AXIS_FAULT);
// test with SOAP 1.2
Options options = new Options();
options.setTo(targetEPR);
options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
options.setExceptionToBeThrownOnSOAPFault(true);
options.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
sender.setOptions(options);
sender.sendReceive(payload).toString();
} catch (AxisFault axisFault) {
assertTrue(axisFault.getFaultCodeElement().toString()
.indexOf(FaultHandler.M_FAULT_EXCEPTION) > -1);
assertTrue(axisFault.getFaultDetailElement().toString()
.indexOf(FaultHandler.DETAIL_MORE_INFO) > -1);
assertTrue(axisFault.getFaultReasonElement().toString()
.indexOf(FaultHandler.FAULT_REASON) > -1);
}
}