BindingOperationInfo bop = ex.getBindingOperationInfo(); Method ret = bop.getProperty(ASYNC_METHOD, Method.class); if (ret == null) { Class<?>[] ptypes = new Class<?>[mso.getParameterTypes().length + 1]; try { ret = mso.getDeclaringClass().getMethod(mso.getName() + "Async", ptypes); bop.setProperty(ASYNC_METHOD, ret); } catch (Throwable t) { JaxwsServerHandler h = ex.get(JaxwsServerHandler.class); if (h != null) { return ret; ContinuationProvider cp = ex.getInMessage().get(ContinuationProvider.class); .getContextualBoolean(ex.getInMessage(), PARTIAL_RESPONSE_SENT_PROPERTY, false); if ((cp == null) && uam.always() || decoupledEndpoints) { JaxwsServerHandler handler = new JaxwsServerHandler(null); ex.put(JaxwsServerHandler.class, handler); params.add(handler); return ret; c.suspend(0); JaxwsServerHandler handler = new JaxwsServerHandler(c); ex.put(JaxwsServerHandler.class, handler); params.add(handler); return ret;
boolean requestor = isRequestor(message); Exchange exchange = message.getExchange(); Exception ex = new Fault(exception); FaultMode mode = message.get(FaultMode.class); Message faultMessage = exchange.getOutMessage(); if (null == faultMessage) { faultMessage = new MessageImpl(); faultMessage.setExchange(message.getExchange()); faultMessage = exchange.getEndpoint().getBinding().createMessage(faultMessage); faultMessage.setContent(Exception.class, ex); faultMessage.put(FaultMode.class, mode); exchange.setOutMessage(null); exchange.setOutFaultMessage(faultMessage); InterceptorChain ic = message.getInterceptorChain(); ic.reset(); faultMessage.setInterceptorChain(ic); ic.doIntercept(faultMessage);
private void handleAbort(Message message, W3CDOMStreamWriter writer) { message.getInterceptorChain().abort(); if (!message.getExchange().isOneWay()) { //server side inbound Endpoint e = message.getExchange().getEndpoint(); Message responseMsg = new MessageImpl(); responseMsg.setExchange(message.getExchange()); responseMsg = e.getBinding().createMessage(responseMsg); message.getExchange().setOutMessage(responseMsg); XMLStreamReader reader = message.getContent(XMLStreamReader.class); if (reader == null && writer != null) { reader = StaxUtils.createXMLStreamReader(writer.getDocument()); } InterceptorChain chain = OutgoingChainInterceptor .getOutInterceptorChain(message.getExchange()); responseMsg.setInterceptorChain(chain); responseMsg.put("LogicalHandlerInterceptor.INREADER", reader); chain.doIntercept(responseMsg); } }
protected final boolean isOutbound() { return message != null && exchange != null && (message == exchange.getOutMessage() || message == exchange.getOutFaultMessage()); }
private void changeToOneway(Exchange exchange) { exchange.setOneWay(true); exchange.setOutMessage(null); javax.servlet.http.HttpServletResponse httpresp = (javax.servlet.http.HttpServletResponse)exchange.getInMessage(). get("HTTP.RESPONSE"); if (httpresp != null) { httpresp.setStatus(202); } }
private Message createResponseMessage(Exchange exchange) { if (exchange == null) { return null; } Message m = exchange.getOutMessage(); if (m == null && !exchange.isOneWay()) { Endpoint ep = exchange.getEndpoint(); m = new MessageImpl(); m.setExchange(exchange); m = ep.getBinding().createMessage(m); exchange.setOutMessage(m); } return m; }
XMLStreamReader reader = (XMLStreamReader)message.get("LogicalHandlerInterceptor.INREADER"); SOAPMessage origMessage = null; if (reader != null) { if (requestor) { message.getInterceptorChain().abort(); if (!message.getExchange().isOneWay()) { Endpoint e = message.getExchange().getEndpoint(); Message responseMsg = new MessageImpl(); responseMsg.setExchange(message.getExchange()); responseMsg = e.getBinding().createMessage(responseMsg); MessageObserver observer = message.getExchange() .get(MessageObserver.class); if (observer != null) { .getContent(XMLStreamReader.class)); message.getExchange().setInMessage(responseMsg); responseMsg.put(InterceptorChain.STARTING_AT_INTERCEPTOR_ID, LogicalHandlerInInterceptor.class.getName()); message.setContent(XMLStreamWriter.class, origWriter); } catch (XMLStreamException e) { throw new Fault(e);
public void handleMessage(Message message) throws Fault { Exchange ex = message.getExchange(); BindingOperationInfo boi = ex.getBindingOperationInfo(); if (Boolean.TRUE.equals(message.get(Message.PARTIAL_RESPONSE_MESSAGE)) || boi == null) { return; Method method = ex.get(Method.class); if (boi.isUnwrappedCapable()) { BindingOperationInfo boi2 = boi.getUnwrappedOperation(); OperationInfo op = boi2.getOperationInfo(); BindingMessageInfo bmi; MessageInfo wrappedMessageInfo = message.get(MessageInfo.class); MessageInfo messageInfo; if (wrappedMessageInfo == boi.getOperationInfo().getInput()) { message.put(MessageInfo.class, messageInfo); message.put(BindingMessageInfo.class, bmi); ex.put(BindingOperationInfo.class, boi2); throw new Fault(e);
protected void handleResponseInternal() throws IOException { Exchange exchange = outMessage.getExchange(); int responseCode = doProcessResponseCode(); inMessage.setExchange(exchange); updateResponseHeaders(inMessage); inMessage.put(Message.RESPONSE_CODE, responseCode); if (MessageUtils.getContextualBoolean(outMessage, SET_HTTP_RESPONSE_MESSAGE, false)) { inMessage.put(HTTP_RESPONSE_MESSAGE, getResponseMessage()); in = getPartialResponse(); if (in == null || !MessageUtils.getContextualBoolean(outMessage, Message.PROCESS_ONEWAY_RESPONSE, false)) { Endpoint ep = exchange.getEndpoint(); if (null != ep && null != ep.getEndpointInfo() && null == ep.getEndpointInfo(). getProperty("org.apache.cxf.ws.addressing.MAPAggregator.decoupledDestination")) { ClientCallback cc = exchange.remove(ClientCallback.class); if (null != cc) { cc.handleResponse(null, null); exchange.put("IN_CHAIN_COMPLETE", Boolean.TRUE); exchange.setInMessage(inMessage); return;
public void handleMessage(Message message) throws Fault { Exchange ex = message.getExchange(); BindingOperationInfo bop = ex.getBindingOperationInfo(); MessageInfo messageInfo = message.get(MessageInfo.class); if (messageInfo == null || bop == null || !bop.isUnwrapped()) { return; BindingOperationInfo newbop = bop.getWrappedOperation(); MessageInfo wrappedMsgInfo; if (Boolean.TRUE.equals(message.get(Message.REQUESTOR_ROLE))) { wrappedMsgInfo = newbop.getInput().getMessageInfo(); } else { wrappedMsgInfo = newbop.getOutput().getMessageInfo(); throw f; } catch (Exception e) { throw new Fault(e); ex.put(BindingOperationInfo.class, newbop); if (messageInfo == bop.getOperationInfo().getInput()) {
public void handleMessage(Message message) throws Fault { BindingOperationInfo bop = message.getExchange().getBindingOperationInfo(); if (bop != null && !bindingName.equals(bop.getBinding().getName())) { return; } else if (DataSource.class.isAssignableFrom(type)) { MessageContentsList list = (MessageContentsList)message.getContent(List.class); DataSource ds = (DataSource)list.get(0); String ct = ds.getContentType(); if (ct.toLowerCase().contains("multipart/related")) { Message msg = new MessageImpl(); msg.setExchange(message.getExchange()); msg.put(Message.CONTENT_TYPE, ct); try { deser.initializeAttachments(); } catch (IOException ex) { throw new Fault(ex); message.setAttachments(msg.getAttachments()); out.close(); } catch (IOException e) { throw new Fault(e); ds = new DOMSource(StaxUtils.read(ds)); } catch (XMLStreamException e) { throw new Fault(e);
Throwable thr = f.getCause(); SOAPFaultException sf = null; if (thr instanceof SOAPFaultException) { SoapVersion soapVersion = (SoapVersion)message.get(SoapVersion.class.getName()); if (soapVersion != null && soapVersion.getVersion() != 1.1) { if (f instanceof SoapFault) { convertedLang = convertedLang + '-' + country; f.setLang(convertedLang); message.setContent(Exception.class, f); Throwable cause = f.getCause(); WebFault fault = null; if (cause != null) { throw new Fault(new org.apache.cxf.common.i18n.Message("COULD_NOT_INVOKE", BUNDLE), e); Service service = message.getExchange().getService(); message.getExchange().getBus()); writer.setSchema(schema); OperationInfo op = message.getExchange().getBindingOperationInfo().getOperationInfo(); QName faultName = getFaultName(fault, cause.getClass(), op); MessagePartInfo part = getFaultMessagePart(faultName, op);
protected void updateMessageForSuspend() { inMessage.getExchange().getInMessage().getInterceptorChain().suspend(); } public void redispatch() {
public void handleMessage(Message message) throws Fault { MessageContentsList outObjects = MessageContentsList.getContentsList(message); Exchange exchange = message.getExchange(); OperationInfo op = exchange.getBindingOperationInfo() == null ? null : exchange.getBindingOperationInfo().getOperationInfo(); if (!Boolean.TRUE.equals(message.get(Message.REQUESTOR_ROLE))) { List<MessagePartInfo> parts = op.getOutput().getMessageParts(); MessageContentsList inObjects = MessageContentsList.getContentsList(exchange.getInMessage()); if (inObjects != null) { if (!(inObjects == outObjects)) { throw new Fault(new org.apache.cxf.common.i18n.Message("CANNOT_SET_HOLDER_OBJECTS", LOG)); message.put(HolderInInterceptor.CLIENT_HOLDERS, holders);
message.getInterceptorChain().abort(); MessageObserver observer = message.getExchange().get(MessageObserver.class); if (!message.getExchange().isOneWay() && observer != null) { Endpoint e = message.getExchange().getEndpoint(); Message responseMsg = new MessageImpl(); responseMsg.setExchange(message.getExchange()); responseMsg = e.getBinding().createMessage(responseMsg); message.getExchange().setInMessage(responseMsg); SOAPMessage soapMessage = ((SOAPMessageContext)context).getMessage(); responseMsg.put(InterceptorChain.STARTING_AT_INTERCEPTOR_ID, if (!getInvoker(message).isOutbound()) { message.getInterceptorChain().abort(); Endpoint e = message.getExchange().getEndpoint(); if (!message.getExchange().isOneWay()) { Message responseMsg = new MessageImpl(); responseMsg.setExchange(message.getExchange()); responseMsg = e.getBinding().createMessage(responseMsg); message.getExchange().setOutMessage(responseMsg); SOAPMessage soapMessage = ((SOAPMessageContext)context).getMessage(); chain.doInterceptStartingAfter(responseMsg, SoapPreProtocolOutInterceptor.class.getName());
@Override public void handleFault(Message message) { Exception ex = message.getContent(Exception.class); if (ex instanceof AuthenticationException) { HttpServletResponse resp = (HttpServletResponse)message.getExchange() .getInMessage().get(AbstractHTTPDestination.HTTP_RESPONSE); resp.setStatus(HttpServletResponse.SC_UNAUTHORIZED); resp.setHeader("WWW-Authenticate", authenticationType + " realm=\"" + realm + "\""); resp.setContentType("text/plain"); try { resp.getOutputStream().write(ex.getMessage().getBytes()); resp.getOutputStream().flush(); message.getInterceptorChain().setFaultObserver(null); //avoid return soap fault message.getInterceptorChain().abort(); } catch (IOException e) { // TODO } } }
inMessage.setExchange(new ExchangeImpl()); inMessage.getExchange().put(Bus.class, bus); inMessage.put(Message.DECOUPLED_CHANNEL_MESSAGE, Boolean.TRUE);
if (outMessage.getExchange() == null) { return; Message inMessage = outMessage.getExchange().getInMessage(); if (inMessage == null) { return; Object o = inMessage.get("cxf.io.cacheinput"); DelegatingInputStream in = inMessage.getContent(DelegatingInputStream.class); if (PropertyUtils.isTrue(o)) { ((AttachmentDataSource)a.getDataHandler().getDataSource()).cache(inMessage); } catch (IOException e) { throw new Fault(e);
private Message createOutMessage(Message inMessage) { Endpoint e = inMessage.getExchange().getEndpoint(); Message mout = e.getBinding().createMessage(); mout.setExchange(inMessage.getExchange()); mout.setInterceptorChain( OutgoingChainInterceptor.getOutInterceptorChain(inMessage.getExchange())); inMessage.getExchange().setOutMessage(mout); inMessage.getExchange().put("cxf.io.cacheinput", Boolean.FALSE); return mout; } }
public EndpointReference getEndpointReference(Element... referenceParameters) { WrappedMessageContext ctx = (WrappedMessageContext)getMessageContext(); org.apache.cxf.message.Message msg = ctx.getWrappedMessage(); Endpoint ep = msg.getExchange().getEndpoint(); builder.address(ep.getEndpointInfo().getAddress()); builder.serviceName(ep.getService().getName()); builder.endpointName(ep.getEndpointInfo().getName()); URI wsdlDescription = ep.getEndpointInfo().getProperty("URI", URI.class); if (wsdlDescription == null) { String address = ep.getEndpointInfo().getAddress();