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 SOAPAuthParam method putSOAPInPacket.
private boolean putSOAPInPacket(SOAPMessage m, Object p) {
if (m == null) {
((Packet) p).setMessage(null);
} else {
Message msg = Messages.create(m);
((Packet) p).setMessage(msg);
}
return true;
}
use of com.sun.xml.ws.api.message.Packet in project Payara by payara.
the class ClientSecurityPipe method startSecureConversation.
@Override
public JAXBElement startSecureConversation(Packet packet) throws WSSecureConversationException {
PacketMessageInfo info = new PacketMapMessageInfo(packet, new Packet());
JAXBElement token = null;
try {
// gets the subject from the packet (puts one there if not found)
Subject clientSubject = getClientSubject(packet);
// put MessageInfo in properties map, since MessageInfo
// is not passed to getAuthContext, key idicates function
HashMap map = new HashMap();
map.put(PipeConstants.SECURITY_TOKEN, info);
helper.getSessionToken(map, info, clientSubject);
// helper returns token in map of msgInfo, using same key
Object o = info.getMap().get(PipeConstants.SECURITY_TOKEN);
if (o != null && o instanceof JAXBElement) {
token = (JAXBElement) o;
}
} catch (Exception e) {
if (e instanceof WSSecureConversationException) {
throw (WSSecureConversationException) e;
} else {
throw new WSSecureConversationException("Secure Conversation failure: ", e);
}
}
return token;
}
use of com.sun.xml.ws.api.message.Packet in project Payara by payara.
the class ClientSecurityPipe method preDestroy.
@Override
public void preDestroy() {
// create a dummy request packet
try {
Packet request = new Packet();
PacketMessageInfo info = new PacketMapMessageInfo(request, new Packet());
Subject subj = getClientSubject(request);
ClientAuthContext cAC = helper.getClientAuthContext(info, subj);
if (cAC != null && WSIT_CLIENT_AUTH_CONTEXT.equals(cAC.getClass().getName())) {
cAC.cleanSubject(info, subj);
}
} catch (Exception ex) {
// ignore exceptions
}
helper.disable();
}
use of com.sun.xml.ws.api.message.Packet in project Payara by payara.
the class ClientSecurityTube method startSecureConversation.
@Override
public JAXBElement startSecureConversation(Packet packet) throws WSSecureConversationException {
PacketMessageInfo locInfo = new PacketMapMessageInfo(packet, new Packet());
JAXBElement token = null;
try {
// gets the subject from the packet (puts one there if not found)
Subject locClientSubject = getClientSubject(packet);
// put MessageInfo in properties map, since MessageInfo
// is not passed to getAuthContext, key idicates function
HashMap map = new HashMap();
map.put(PipeConstants.SECURITY_TOKEN, locInfo);
helper.getSessionToken(map, locInfo, locClientSubject);
// helper returns token in map of msgInfo, using same key
Object o = locInfo.getMap().get(PipeConstants.SECURITY_TOKEN);
if (o != null && o instanceof JAXBElement) {
token = (JAXBElement) o;
}
} catch (Exception e) {
if (e instanceof WSSecureConversationException) {
throw (WSSecureConversationException) e;
} else {
throw new WSSecureConversationException("Secure Conversation failure: ", e);
}
}
return token;
}
Aggregations