本文整理汇总了Java中org.apache.axis2.addressing.EndpointReference.hasAnonymousAddress方法的典型用法代码示例。如果您正苦于以下问题:Java EndpointReference.hasAnonymousAddress方法的具体用法?Java EndpointReference.hasAnonymousAddress怎么用?Java EndpointReference.hasAnonymousAddress使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.axis2.addressing.EndpointReference
的用法示例。
在下文中一共展示了EndpointReference.hasAnonymousAddress方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupCorrectTransportOut
import org.apache.axis2.addressing.EndpointReference; //导入方法依赖的package包/类
/**
* Ensure that if the scheme of the To EPR for the response is different than the
* transport used for the request that the correct TransportOut is available
*/
private static void setupCorrectTransportOut(MessageContext context) throws AxisFault {
// Determine that we have the correct transport available.
TransportOutDescription transportOut = context.getTransportOut();
try {
EndpointReference responseEPR = context.getTo();
if (context.isServerSide() && responseEPR != null) {
if (!responseEPR.hasAnonymousAddress() && !responseEPR.hasNoneAddress()) {
URI uri = new URI(responseEPR.getAddress());
String scheme = uri.getScheme();
if ((transportOut == null) || !transportOut.getName().equals(scheme)) {
ConfigurationContext configurationContext =
context.getConfigurationContext();
transportOut = configurationContext.getAxisConfiguration()
.getTransportOut(scheme);
if (transportOut == null) {
throw new AxisFault("Can not find the transport sender : " + scheme);
}
context.setTransportOut(transportOut);
}
if (context.getOperationContext() != null) {
context.getOperationContext().setProperty(
Constants.DIFFERENT_EPR, Constants.VALUE_TRUE);
}
}
}
} catch (URISyntaxException urise) {
throw AxisFault.makeFault(urise);
}
}
示例2: executeImpl
import org.apache.axis2.addressing.EndpointReference; //导入方法依赖的package包/类
/**
* Executes the MEP. What this does depends on the specific MEP client. The basic idea is to have the MEP client
* execute and do something with the messages that have been added to it so far. For example, if its an Out-In
* MEP, then if the Out message has been set, then executing the client asks it to send the message and get the
* In message, possibly using a different thread.
*
* @param block Indicates whether execution should block or return ASAP. What block means is of course a
* function of the specific MEP client. IGNORED BY THIS MEP CLIENT.
* @throws AxisFault if something goes wrong during the execution of the MEP.
*/
@Override
public void executeImpl(final boolean block) throws AxisFault {
if (log.isDebugEnabled()) {
log.debug("Entry: OutOptInAxisOperationClient::execute, " + block);
}
if (completed) {
throw new AxisFault(Messages.getMessage("mepiscomplted"));
}
final ConfigurationContext cc = sc.getConfigurationContext();
// copy interesting info from options to message context.
final MessageContext mc = oc.getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
if (mc == null) {
throw new AxisFault(Messages.getMessage("outmsgctxnull"));
}
prepareMessageContext(cc, mc);
if (options.getTransportIn() == null && mc.getTransportIn() == null) {
mc.setTransportIn(ClientUtils.inferInTransport(cc
.getAxisConfiguration(), options, mc));
} else if (mc.getTransportIn() == null) {
mc.setTransportIn(options.getTransportIn());
}
/**
* If a module has set the USE_ASYNC_OPERATIONS option then we override the behaviour for sync calls, and
* effectively USE_CUSTOM_LISTENER too. However we leave real async calls alone.
*/
boolean useAsync = false;
if (!mc.getOptions().isUseSeparateListener()) {
final Boolean useAsyncOption
= (Boolean) mc.getProperty(Constants.Configuration.USE_ASYNC_OPERATIONS);
if (log.isDebugEnabled()) {
log.debug("OutInAxisOperationClient: useAsyncOption " + useAsyncOption);
}
if (useAsyncOption != null) {
useAsync = useAsyncOption.booleanValue();
}
}
final EndpointReference replyTo = mc.getReplyTo();
if (replyTo != null) {
if (replyTo.isWSAddressingAnonymous()
&& replyTo.getAllReferenceParameters() != null) {
mc.setProperty(AddressingConstants.INCLUDE_OPTIONAL_HEADERS, Boolean.TRUE);
}
final String customReplyTo = (String) options.getProperty(Options.CUSTOM_REPLYTO_ADDRESS);
if (!(Options.CUSTOM_REPLYTO_ADDRESS_TRUE.equals(customReplyTo))) {
if (!replyTo.hasAnonymousAddress()) {
useAsync = true;
}
}
}
if (useAsync || mc.getOptions().isUseSeparateListener()) {
sendAsync(useAsync, mc);
} else {
if (block) {
// Send the SOAP Message and receive a response
send(mc);
completed = true;
} else {
sc.getConfigurationContext().getThreadPool().execute(
new NonBlockingInvocationWorker(callback, mc, axisCallback));
}
}
}
示例3: receive
import org.apache.axis2.addressing.EndpointReference; //导入方法依赖的package包/类
/**
*
* @param messageCtx active MessageContext
* @throws AxisFault if a problem occurred
*/
public void receive(final MessageContext messageCtx) throws AxisFault {
if (messageCtx.isPropertyTrue(DO_ASYNC)
|| ((messageCtx.getParameter(DO_ASYNC) != null) &&
JavaUtils.isTrueExplicitly(messageCtx.getParameter(DO_ASYNC).getValue()))) {
String mep = messageCtx.getAxisOperation()
.getMessageExchangePattern();
EndpointReference replyTo = messageCtx.getReplyTo();
// In order to invoke the service in the ASYNC mode, the request
// should contain ReplyTo header if the MEP of the service is not
// InOnly type
if ((!WSDLUtil.isOutputPresentForMEP(mep))
|| (replyTo != null && !replyTo.hasAnonymousAddress())) {
AsyncMessageReceiverWorker worker = new AsyncMessageReceiverWorker(
messageCtx);
messageCtx.getEnvelope().build();
messageCtx.getConfigurationContext().getThreadPool().execute(
worker);
return;
}
}
ThreadContextDescriptor tc = setThreadContext(messageCtx);
try {
invokeBusinessLogic(messageCtx);
} catch (AxisFault fault) {
// signal the transport to rollback the tx, if any
messageCtx.setProperty(Constants.SET_ROLLBACK_ONLY, true);
// If we're in-only, eat this. Otherwise, toss it upwards!
if ((messageCtx.getAxisOperation() instanceof InOnlyAxisOperation) &&
!WSDL2Constants.MEP_URI_ROBUST_IN_ONLY.equals(messageCtx.getAxisOperation().getMessageExchangePattern())) {
log.error(fault);
} else {
fault.setFaultType(Constants.APPLICATION_FAULT);
throw fault;
}
} finally {
restoreThreadContext(tc);
}
}