Search in sources :

Example 1 with JAXRPCException

use of javax.xml.rpc.JAXRPCException 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 JAXRPCException

use of javax.xml.rpc.JAXRPCException 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)

Aggregations

JAXRPCException (javax.xml.rpc.JAXRPCException)2 SOAPMessageContext (javax.xml.rpc.handler.soap.SOAPMessageContext)2 SOAPMessage (javax.xml.soap.SOAPMessage)1