use of com.sun.identity.liberty.ws.soapbinding.Message in project OpenAM by OpenRock.
the class InteractionManager method getRequestMessage.
private Message getRequestMessage(String messageID) {
Message requestMessage = null;
CacheEntry cacheEntry = cache.getCacheEntry(messageID);
if (cacheEntry != null) {
requestMessage = cacheEntry.getRequestMessage();
}
if (debug.messageEnabled()) {
debug.message("InteractionManager.getRequestMessage():" + " looking up request message for messageID=" + messageID + ":requestMessage=" + (requestMessage == null));
}
return requestMessage;
}
use of com.sun.identity.liberty.ws.soapbinding.Message in project OpenAM by OpenRock.
the class InteractionManager method newRedirectFaultError.
private SOAPFaultException newRedirectFaultError(QName errorCode) {
StatusElement se = null;
try {
se = objectFactory.createStatusElement();
} catch (JAXBException je) {
debug.error("InteractionManager.newRedirectFaultError():" + " can not create StatusElement", je);
}
se.setCode(errorCode);
List details = new ArrayList();
try {
details.add(Utils.convertJAXBToElement(se));
} catch (JAXBException je) {
debug.error("InteractionManager.newRedirectFaultError():" + "can not create new RedirectFaultError:" + "can not convert JAXBObject to Element", je);
}
SOAPFault sf = new SOAPFault(QNAME_SERVER, SERVER_ERROR, FAULT_ACTOR, new SOAPFaultDetail(details));
SOAPFaultException sfe = new SOAPFaultException(new Message(sf));
return sfe;
}
use of com.sun.identity.liberty.ws.soapbinding.Message in project OpenAM by OpenRock.
the class DSTRequestHandler method processRequest.
/**
* Processes the request for the given personal profile service request.
* @param msg SOAP Request message
* @return Message SOAP Response Message.
* @exception SOAPFaultException if the service requires an interaction.
* @exception Exception for any generic failure.
*/
public Message processRequest(Message msg) throws SOAPFaultException, Exception {
if (DSTUtils.debug.messageEnabled()) {
DSTUtils.debug.message("DSTRequestHandler:processRequest:" + "Request received: " + msg.toString());
}
List requestBodies = msg.getBodies();
requestBodies = Utils.convertElementToJAXB(requestBodies);
if (requestBodies == null || requestBodies.size() == 0) {
DSTUtils.debug.error("DSTRequestHandler:processRequest:" + "SOAPBodies are null");
throw new Exception(DSTUtils.bundle.getString("nullInputParams"));
}
Message response = null;
int securityProfile = msg.getSecurityProfileType();
if ((securityProfile == Message.X509_TOKEN) || (securityProfile == Message.SAML_TOKEN) || (securityProfile == Message.BEARER_TOKEN)) {
response = new Message(null, generateBinarySecurityToken(msg));
} else {
response = new Message();
}
response.setCorrelationHeader(msg.getCorrelationHeader());
response.setWSFVersion(msg.getWSFVersion());
List responseBodies = processSOAPBodies(requestBodies, msg, response);
responseBodies = Utils.convertJAXBToElement(responseBodies);
response.setSOAPBodies(responseBodies);
if (DSTUtils.debug.messageEnabled()) {
DSTUtils.debug.message("DSTRequestHandler:processRequest:" + "returned response: " + response.toString());
}
return response;
}
use of com.sun.identity.liberty.ws.soapbinding.Message in project OpenAM by OpenRock.
the class DSTClient method sendMessage.
/**
* Sends the SOAP Message to the data service.
* @param List of Request Objects.
* @return List of Response Objects.
* @exception DSTException for failure.
*/
private List sendMessage(List requestObjects) throws DSTException, InteractionRedirectException {
DSTUtils.debug.message("DSTClient:sendMessage:Init");
if (requestObjects == null || requestObjects.size() == 0) {
DSTUtils.debug.message("DSTClient:sendMessage: requestobj are null");
throw new DSTException(DSTUtils.bundle.getString("nullInputParams"));
}
try {
Message msg = null;
ProviderHeader provH = null;
if (providerID != null) {
provH = new ProviderHeader(providerID);
}
if (securityProfile == Message.X509_TOKEN) {
if (token == null) {
throw new DSTException(DSTUtils.bundle.getString("nullToken"));
}
DSTUtils.debug.message("DSTClient:sendMessage:using x509");
msg = new Message(provH, token);
} else if (securityProfile == Message.SAML_TOKEN) {
DSTUtils.debug.message("DSTClient:sendMessage:using SAML");
msg = new Message(provH, assertion);
} else if (securityProfile == Message.BEARER_TOKEN) {
DSTUtils.debug.message("DSTClient:sendMessage:using Bearer");
msg = new Message(provH, assertion);
} else if (securityProfile == Message.ANONYMOUS) {
DSTUtils.debug.message("DSTClient:sendMessage:using Anonymous");
msg = new Message(provH);
} else {
throw new DSTException(DSTUtils.bundle.getString("invalidSecurityProfile"));
}
msg.setSOAPBodies(requestObjects);
msg.setWSFVersion(wsfVersion);
if (clientAuthEnabled) {
msg.setClientAuthentication(clientAuthEnabled);
}
if (DSTUtils.debug.messageEnabled()) {
DSTUtils.debug.message("DSTClient:sendMessage: request:" + msg.toString());
}
Message response = null;
if (httpRequest != null) {
response = handleInteraction(msg);
} else {
response = Client.sendRequest(msg, soapURI, certAlias, soapAction);
}
if (DSTUtils.debug.messageEnabled()) {
DSTUtils.debug.message("DSTClient:sendMessage:response = " + response.toString());
}
serviceInstanceUpdateHeader = response.getServiceInstanceUpdateHeader();
return response.getBodies();
} catch (SOAPBindingException sbe) {
DSTUtils.debug.error("DSTClient:sendMessage:soapbindexception", sbe);
throw new DSTException(sbe);
} catch (SOAPFaultException sfe) {
DSTUtils.debug.error("DSTClient:sendMessage:soapfault", sfe);
serviceInstanceUpdateHeader = sfe.getSOAPFaultMessage().getServiceInstanceUpdateHeader();
throw new DSTException(sfe);
}
}
use of com.sun.identity.liberty.ws.soapbinding.Message in project OpenAM by OpenRock.
the class DSTClient method handleInteraction.
/**
* Handles interaction request processing.
* When the interaction is required, it throws and InteractRedirect
* Exception, and redirect to the caller application(servlet).
*/
private Message handleInteraction(Message requestMsg) throws DSTException, SOAPFaultException, SOAPBindingException, InteractionRedirectException {
if (requestMsg == null || httpRequest == null || httpResponse == null || soapURI == null) {
DSTUtils.debug.error("DSTClient:handeInteraction:null values");
throw new DSTException(DSTUtils.bundle.getString("nullInputParams"));
}
DSTUtils.debug.message("DSTClient:handleInteraction:init");
String resend = httpRequest.getParameter(InteractionManager.RESEND_MESSAGE);
String returnURL = httpRequest.getRequestURL().toString();
Message response;
try {
InteractionManager manager = InteractionManager.getInstance();
if (resend == null) {
//If the interaction is not required, this will send a
// original response.
response = manager.sendRequest(requestMsg, soapURI, certAlias, soapAction, returnURL, httpRequest, httpResponse);
} else {
response = manager.resendRequest(returnURL, httpRequest, httpResponse);
}
return response;
} catch (InteractionRedirectException ire) {
DSTUtils.debug.message("DSTClient:handleInteraction: Interaction" + "Redirection happened.");
throw ire;
} catch (InteractionException ie) {
DSTUtils.debug.error("DSTClient:handleInteraction: Interaction" + " Error occured.", ie);
throw new DSTException(ie);
}
}
Aggregations