use of com.sun.xml.ws.api.message.Packet in project Payara by payara.
the class MonitoringPipe method process.
public Packet process(Packet request) {
// if it is a JBI request then skip the monitoring logic. This is done
// as HTTPServletRequest/Response is not available when the invocation
// is from JavaEE service engine.
String delegateClassName = request.webServiceContextDelegate.getClass().getName();
if (delegateClassName.equals("com.sun.enterprise.jbi.serviceengine." + "bridge.transport.NMRServerConnection")) {
return next.process(request);
}
// No monitoring available for restful services
if ("http://www.w3.org/2004/08/wsdl/http".equals(endpoint.getProtocolBinding())) {
return next.process(request);
}
SOAPMessageContext ctxt = new SOAPMessageContextImpl(request);
HttpServletRequest httpRequest = (HttpServletRequest) request.get(javax.xml.ws.handler.MessageContext.SERVLET_REQUEST);
HttpServletResponse httpResponse = (HttpServletResponse) request.get(javax.xml.ws.handler.MessageContext.SERVLET_RESPONSE);
String messageId = null;
JAXWSEndpointImpl endpt1;
if (endpoint.implementedByWebComponent()) {
endpt1 = (JAXWSEndpointImpl) wsEngine.getEndpoint(httpRequest.getServletPath());
} else {
endpt1 = (JAXWSEndpointImpl) wsEngine.getEndpoint(httpRequest.getRequestURI());
}
messageId = wsEngine.preProcessRequest(endpt1);
if (messageId != null) {
ctxt.put(EndpointImpl.MESSAGE_ID, messageId);
ThreadLocalInfo config = new ThreadLocalInfo(messageId, httpRequest);
wsEngine.getThreadLocal().set(config);
}
try {
endpt1.processRequest(ctxt);
} catch (Exception e) {
// temporary - need to send back SOAP fault message
}
Packet pipeResponse = next.process(request);
// Make the response packet available in the MessageContext
((SOAPMessageContextImpl) ctxt).setPacket(pipeResponse);
try {
if (endpt1 != null) {
endpt1.processResponse(ctxt);
}
} catch (Exception e) {
// temporary - need to send back SOAP fault message
}
if (messageId != null) {
HttpResponseInfoImpl info = new HttpResponseInfoImpl(httpResponse);
wsEngine.postProcessResponse(messageId, info);
}
return pipeResponse;
}
use of com.sun.xml.ws.api.message.Packet in project Payara by payara.
the class ClientSecurityPipe method processSecureRequest.
private Packet processSecureRequest(PacketMessageInfo info, ClientAuthContext cAC, Subject clientSubject) throws WebServiceException {
// send the request
Packet response = next.process(info.getRequestPacket());
// check for response
Message m = response.getMessage();
if (m != null) {
if (cAC != null) {
AuthStatus status;
info.setResponsePacket(response);
try {
status = cAC.validateResponse(info, clientSubject, null);
} catch (Exception e) {
throw new WebServiceException(localStrings.getLocalString("enterprise.webservice.cantValidateResponse", "Cannot validate response for {0}", new Object[] { helper.getModelName() }), e);
}
if (status == AuthStatus.SEND_CONTINUE) {
response = processSecureRequest(info, cAC, clientSubject);
} else {
response = info.getResponsePacket();
}
}
}
return response;
}
use of com.sun.xml.ws.api.message.Packet in project Payara by payara.
the class ClientSecurityPipe method process.
@Override
public Packet process(Packet request) {
/*
* XXX should there be code like the following?
if(isHttpBinding) {
return next.process(request);
}
*/
PacketMessageInfo info = new PacketMapMessageInfo(request, new Packet());
info.getMap().put(javax.xml.ws.Endpoint.WSDL_SERVICE, helper.getProperty(PipeConstants.WSDL_SERVICE));
AuthStatus status = AuthStatus.SEND_SUCCESS;
Subject clientSubject = getClientSubject(request);
ClientAuthContext cAC = null;
try {
cAC = helper.getClientAuthContext(info, clientSubject);
if (cAC != null) {
// proceed to process message sescurity
status = cAC.secureRequest(info, clientSubject);
}
} catch (Exception e) {
_logger.log(Level.SEVERE, LogUtils.ERROR_REQUEST_SECURING, e);
throw new WebServiceException(localStrings.getLocalString("enterprise.webservice.cantSecureRequst", "Cannot secure request for {0}", new Object[] { helper.getModelName() }), e);
}
Packet response;
if (status == AuthStatus.FAILURE) {
if (_logger.isLoggable(Level.FINE)) {
_logger.log(Level.FINE, "ws.status_secure_request", status);
}
response = info.getResponsePacket();
} else {
response = processSecureRequest(info, cAC, clientSubject);
}
// may return a security fault even if the MEP was one-way
return response;
}
use of com.sun.xml.ws.api.message.Packet in project Payara by payara.
the class ClientSecurityTube method processRequest.
@Override
public NextAction processRequest(Packet request) {
try {
/*
* XXX should there be code like the following?
if(isHttpBinding) {
return next.process(request);
}
*/
info = new PacketMapMessageInfo(request, new Packet());
AuthStatus status = AuthStatus.SEND_SUCCESS;
info.getMap().put(javax.xml.ws.Endpoint.WSDL_SERVICE, helper.getProperty(PipeConstants.WSDL_SERVICE));
Subject locClientSubject = getClientSubject(request);
cAC = helper.getClientAuthContext(info, locClientSubject);
if (cAC != null) {
// proceed to process message sescurity
status = cAC.secureRequest(info, locClientSubject);
}
if (status == AuthStatus.FAILURE) {
if (_logger.isLoggable(Level.FINE)) {
_logger.log(Level.FINE, "ws.status_secure_request", status);
}
throw new WebServiceException(localStrings.getLocalString("enterprise.webservice.cantSecureRequst", "Cannot secure request for {0}", new Object[] { helper.getModelName() }), new Exception("An Error occured while Securing the Request"));
} else {
return doInvoke(super.next, info.getRequestPacket());
}
} catch (Exception e) {
_logger.log(Level.SEVERE, LogUtils.ERROR_REQUEST_SECURING, e);
throw new WebServiceException(localStrings.getLocalString("enterprise.webservice.cantSecureRequst", "Cannot secure request for {0}", new Object[] { helper.getModelName() }), e);
}
}
Aggregations