Search in sources :

Example 1 with SOAPMessageContext

use of javax.xml.rpc.handler.soap.SOAPMessageContext in project Payara by payara.

the class MessageLayerClientHandler method handleRequest.

public boolean handleRequest(MessageContext messageContext) {
    if (!isSoapMessageContext(messageContext)) {
        // cannot process this, as this is not a soap message context
        throw new JAXRPCException(errMsg);
    }
    if (config_ == null) {
        return true;
    }
    // get the ClientAuthContext
    SOAPMessageContext smc = (SOAPMessageContext) messageContext;
    SOAPMessage request = smc.getMessage();
    ClientAuthContext cAC = config_.getAuthContext(null, request);
    if (cAC == null) {
        return true;
    }
    smc.setProperty(CLIENT_AUTH_CONTEXT, cAC);
    smc.setProperty(javax.xml.ws.handler.MessageContext.WSDL_SERVICE, serviceName);
    try {
        WebServiceSecurity.secureRequest(smc, cAC, isAppclientContainer);
    } catch (Exception e) {
        if (_logger.isLoggable(Level.WARNING)) {
            _logger.log(Level.WARNING, LogUtils.ERROR_REQUEST_SECURING, e);
        }
        throw new JAXRPCException(e);
    }
    return true;
}
Also used : SOAPMessageContext(javax.xml.rpc.handler.soap.SOAPMessageContext) JAXRPCException(javax.xml.rpc.JAXRPCException) SOAPMessage(javax.xml.soap.SOAPMessage) JAXRPCException(javax.xml.rpc.JAXRPCException)

Example 2 with SOAPMessageContext

use of javax.xml.rpc.handler.soap.SOAPMessageContext in project Payara by payara.

the class MessageLayerClientHandler method handleResponse.

public boolean handleResponse(MessageContext messageContext) {
    boolean retValue;
    if (!isSoapMessageContext(messageContext)) {
        // cannot process this, as this is not a soap message context
        throw new JAXRPCException(errMsg);
    }
    if (config_ == null) {
        return true;
    }
    // get the ClientAuthContext
    SOAPMessageContext smc = (SOAPMessageContext) messageContext;
    ClientAuthContext cAC = (ClientAuthContext) smc.getProperty(CLIENT_AUTH_CONTEXT);
    if (cAC == null) {
        return true;
    }
    try {
        retValue = WebServiceSecurity.validateResponse(smc, cAC);
    } catch (Exception e) {
        if (_logger.isLoggable(Level.WARNING)) {
            _logger.log(Level.WARNING, LogUtils.ERROR_RESPONSE_VALIDATION, e);
        }
        throw new JAXRPCException(e);
    }
    return retValue;
}
Also used : SOAPMessageContext(javax.xml.rpc.handler.soap.SOAPMessageContext) JAXRPCException(javax.xml.rpc.JAXRPCException) JAXRPCException(javax.xml.rpc.JAXRPCException)

Example 3 with SOAPMessageContext

use of javax.xml.rpc.handler.soap.SOAPMessageContext in project Payara by payara.

the class WsUtil method getInvMethod.

/**
 *@return a method object representing the target of a web service
 * invocation
 */
public Method getInvMethod(Tie webServiceTie, MessageContext context) throws Exception {
    // Use tie to get Method from SOAP message inv.webServiceTie
    SOAPMessageContext soapMsgContext = (SOAPMessageContext) context;
    SOAPMessage message = soapMsgContext.getMessage();
    if (!(webServiceTie instanceof StreamingHandler)) {
        throw new IllegalArgumentException(webServiceTie + "is not instance of StreamingHandler.");
    }
    StreamingHandler streamingHandler = (StreamingHandler) webServiceTie;
    int opcode = streamingHandler.getOpcodeForRequestMessage(message);
    return streamingHandler.getMethodForOpcode(opcode);
}
Also used : SOAPMessageContext(javax.xml.rpc.handler.soap.SOAPMessageContext) StreamingHandler(com.sun.xml.rpc.spi.runtime.StreamingHandler) UserDataConstraint(com.sun.enterprise.deployment.web.UserDataConstraint) SecurityConstraint(com.sun.enterprise.deployment.web.SecurityConstraint)

Aggregations

SOAPMessageContext (javax.xml.rpc.handler.soap.SOAPMessageContext)3 JAXRPCException (javax.xml.rpc.JAXRPCException)2 SecurityConstraint (com.sun.enterprise.deployment.web.SecurityConstraint)1 UserDataConstraint (com.sun.enterprise.deployment.web.UserDataConstraint)1 StreamingHandler (com.sun.xml.rpc.spi.runtime.StreamingHandler)1 SOAPMessage (javax.xml.soap.SOAPMessage)1