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;
}
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;
}
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);
}
Aggregations