Search in sources :

Example 86 with WrappedMessageContext

use of org.apache.cxf.jaxws.context.WrappedMessageContext in project cxf by apache.

the class JAXWSMethodInvoker method invoke.

@Override
protected Object invoke(Exchange exchange, final Object serviceObject, Method m, List<Object> params) {
    // set up the webservice request context
    WrappedMessageContext ctx = new WrappedMessageContext(exchange.getInMessage(), Scope.APPLICATION);
    Map<String, Object> handlerScopedStuff = removeHandlerProperties(ctx);
    final MessageContext oldCtx = WebServiceContextImpl.setMessageContext(ctx);
    List<Object> res = null;
    try {
        if ((params == null || params.isEmpty()) && serviceObject instanceof Provider) {
            params = Collections.singletonList(null);
        }
        res = CastUtils.cast((List<?>) super.invoke(exchange, serviceObject, m, params));
        if ((serviceObject instanceof Provider) && MessageUtils.getContextualBoolean(exchange.getInMessage(), "jaxws.provider.interpretNullAsOneway", true) && (res != null && !res.isEmpty() && res.get(0) == null) && exchange.getInMessage().getInterceptorChain().getState() == InterceptorChain.State.EXECUTING) {
            // treat the non-oneway call as oneway when a provider returns null
            // and the chain is not suspended due to a continuation suspend
            res = null;
            changeToOneway(exchange);
        }
        // update the webservice response context
        updateWebServiceContext(exchange, ctx);
    } catch (Fault f) {
        // get chance to copy over customer's header
        if (MessageUtils.getContextualBoolean(exchange.getInMessage(), COPY_SOAP_HEADERS_BY_FAULT, true)) {
            updateHeader(exchange, ctx);
        }
        throw f;
    } finally {
        // restore the WebServiceContextImpl's ThreadLocal variable to the previous value
        if (oldCtx == null) {
            WebServiceContextImpl.clear();
        } else {
            WebServiceContextImpl.setMessageContext(oldCtx);
        }
        addHandlerProperties(ctx, handlerScopedStuff);
    }
    return res;
}
Also used : WrappedMessageContext(org.apache.cxf.jaxws.context.WrappedMessageContext) List(java.util.List) Fault(org.apache.cxf.interceptor.Fault) WrappedMessageContext(org.apache.cxf.jaxws.context.WrappedMessageContext) MessageContext(javax.xml.ws.handler.MessageContext) Provider(javax.xml.ws.Provider)

Example 87 with WrappedMessageContext

use of org.apache.cxf.jaxws.context.WrappedMessageContext in project cxf by apache.

the class FragmentDialect method getSoapVersion.

private SoapVersion getSoapVersion() {
    WrappedMessageContext wmc = (WrappedMessageContext) context.getMessageContext();
    SoapMessage message = (SoapMessage) wmc.getWrappedMessage();
    return message.getVersion();
}
Also used : WrappedMessageContext(org.apache.cxf.jaxws.context.WrappedMessageContext) SoapMessage(org.apache.cxf.binding.soap.SoapMessage)

Example 88 with WrappedMessageContext

use of org.apache.cxf.jaxws.context.WrappedMessageContext in project cxf by apache.

the class XSLTResourceTransformer method getSoapVersion.

private SoapVersion getSoapVersion() {
    WrappedMessageContext wmc = (WrappedMessageContext) context.getMessageContext();
    SoapMessage message = (SoapMessage) wmc.getWrappedMessage();
    return message.getVersion();
}
Also used : WrappedMessageContext(org.apache.cxf.jaxws.context.WrappedMessageContext) SoapMessage(org.apache.cxf.binding.soap.SoapMessage)

Example 89 with WrappedMessageContext

use of org.apache.cxf.jaxws.context.WrappedMessageContext in project cxf by apache.

the class XSDResourceValidator method getSoapVersion.

private SoapVersion getSoapVersion() {
    WrappedMessageContext wmc = (WrappedMessageContext) context.getMessageContext();
    SoapMessage message = (SoapMessage) wmc.getWrappedMessage();
    return message.getVersion();
}
Also used : WrappedMessageContext(org.apache.cxf.jaxws.context.WrappedMessageContext) SoapMessage(org.apache.cxf.binding.soap.SoapMessage)

Example 90 with WrappedMessageContext

use of org.apache.cxf.jaxws.context.WrappedMessageContext in project cxf by apache.

the class MemoryResourceManager method getSoapVersion.

private SoapVersion getSoapVersion() {
    WrappedMessageContext wmc = (WrappedMessageContext) context.getMessageContext();
    SoapMessage message = (SoapMessage) wmc.getWrappedMessage();
    return message.getVersion();
}
Also used : WrappedMessageContext(org.apache.cxf.jaxws.context.WrappedMessageContext) SoapMessage(org.apache.cxf.binding.soap.SoapMessage)

Aggregations

WrappedMessageContext (org.apache.cxf.jaxws.context.WrappedMessageContext)167 MessageImpl (org.apache.cxf.message.MessageImpl)152 StaticSTSProperties (org.apache.cxf.sts.StaticSTSProperties)137 PasswordCallbackHandler (org.apache.cxf.sts.common.PasswordCallbackHandler)115 Crypto (org.apache.wss4j.common.crypto.Crypto)113 CustomTokenPrincipal (org.apache.wss4j.common.principal.CustomTokenPrincipal)107 JAXBElement (javax.xml.bind.JAXBElement)93 RequestSecurityTokenType (org.apache.cxf.ws.security.sts.provider.model.RequestSecurityTokenType)93 RequestSecurityTokenResponseType (org.apache.cxf.ws.security.sts.provider.model.RequestSecurityTokenResponseType)86 STSPropertiesMBean (org.apache.cxf.sts.STSPropertiesMBean)83 Element (org.w3c.dom.Element)65 ServiceMBean (org.apache.cxf.sts.service.ServiceMBean)61 StaticService (org.apache.cxf.sts.service.StaticService)61 RequestSecurityTokenResponseCollectionType (org.apache.cxf.ws.security.sts.provider.model.RequestSecurityTokenResponseCollectionType)56 KeyRequirements (org.apache.cxf.sts.request.KeyRequirements)54 TokenRequirements (org.apache.cxf.sts.request.TokenRequirements)54 EncryptionProperties (org.apache.cxf.sts.service.EncryptionProperties)53 SecurityContext (org.apache.cxf.security.SecurityContext)51 Principal (java.security.Principal)49 RequestedSecurityTokenType (org.apache.cxf.ws.security.sts.provider.model.RequestedSecurityTokenType)49