Search in sources :

Example 1 with RedirectRequestElement

use of com.sun.identity.liberty.ws.interaction.jaxb.RedirectRequestElement in project OpenAM by OpenRock.

the class InteractionManager method newRedirectFault.

private SOAPFaultException newRedirectFault(String messageID) {
    RedirectRequestElement re = null;
    try {
        re = objectFactory.createRedirectRequestElement();
    } catch (JAXBException je) {
        debug.error("InteractionManager.newRedirectFault():" + " can not create RedirectRequestElement", je);
    }
    CorrelationHeader ch = new CorrelationHeader();
    String responseID = ch.getMessageID();
    ch.setRefToMessageID(messageID);
    String redirectUrl = null;
    String lbRedirectUrl = interactionConfig.getLbWSPRedirectHandler();
    String wspRedirectUrl = interactionConfig.getWSPRedirectHandler();
    if (debug.messageEnabled()) {
        debug.message("InteractionManager.newRedirectURLFault():" + "wspRedirectURL:" + wspRedirectUrl + ", lbRedirectUrl:" + lbRedirectUrl);
    }
    if (lbRedirectUrl == null) {
        redirectUrl = wspRedirectUrl + "?" + TRANS_ID + "=" + responseID;
        if (debug.messageEnabled()) {
            debug.message("InteractionManager.newRedirectURLFault():" + "lbRedirectURL is null, rediectUrl:" + redirectUrl);
        }
    } else {
        //lbRedirectUrl defined
        redirectUrl = lbRedirectUrl + "?" + TRANS_ID + "=" + responseID + "&" + InteractionConfig.HANDLER_HOST_ID + "=" + InteractionConfig.getInstance().getLocalServerId();
        if (debug.messageEnabled()) {
            debug.message("InteractionManager.newRedirectURLFault():" + "lbRedirectURL is not null, rediectUrl:" + redirectUrl);
        }
    }
    re.setRedirectURL(redirectUrl);
    List details = new ArrayList();
    try {
        details.add(Utils.convertJAXBToElement(re));
    } catch (JAXBException je) {
        debug.error("InteractionManager.newRedirectFault():" + " can not create newRedirectFault:" + " can not convert JAXBObject to Element", je);
    }
    SOAPFault sf = new SOAPFault(QNAME_SERVER, SERVER_ERROR, FAULT_ACTOR, new SOAPFaultDetail(details));
    Message sfmsg = new Message(sf);
    sfmsg.setCorrelationHeader(ch);
    SOAPFaultException sfe = new SOAPFaultException(sfmsg);
    return sfe;
}
Also used : Message(com.sun.identity.liberty.ws.soapbinding.Message) CorrelationHeader(com.sun.identity.liberty.ws.soapbinding.CorrelationHeader) JAXBException(javax.xml.bind.JAXBException) ArrayList(java.util.ArrayList) RedirectRequestElement(com.sun.identity.liberty.ws.interaction.jaxb.RedirectRequestElement) SOAPFaultDetail(com.sun.identity.liberty.ws.soapbinding.SOAPFaultDetail) ArrayList(java.util.ArrayList) List(java.util.List) SOAPFault(com.sun.identity.liberty.ws.soapbinding.SOAPFault) SOAPFaultException(com.sun.identity.liberty.ws.soapbinding.SOAPFaultException)

Example 2 with RedirectRequestElement

use of com.sun.identity.liberty.ws.interaction.jaxb.RedirectRequestElement in project OpenAM by OpenRock.

the class InteractionManager method getRedirectURL.

String getRedirectURL(SOAPFaultException sfe) throws SOAPFaultException {
    String redirectURL = null;
    List details = null;
    SOAPFaultDetail sfd = sfe.getSOAPFaultMessage().getSOAPFault().getDetail();
    if (sfd != null) {
        details = sfd.getOtherChildren();
    }
    try {
        details = Utils.convertElementToJAXB(details);
    } catch (JAXBException je) {
        debug.error("InteractionManager.getRedirectURL():" + " can not get Redirect URL", je);
    }
    if ((details != null) && (details.size() > 0) && (details.get(0) instanceof RedirectRequestElement)) {
        RedirectRequestElement rre = (RedirectRequestElement) details.get(0);
        if (rre != null) {
            redirectURL = rre.getRedirectURL();
        }
    }
    if (redirectURL == null) {
        throw sfe;
    }
    return redirectURL;
}
Also used : JAXBException(javax.xml.bind.JAXBException) SOAPFaultDetail(com.sun.identity.liberty.ws.soapbinding.SOAPFaultDetail) RedirectRequestElement(com.sun.identity.liberty.ws.interaction.jaxb.RedirectRequestElement) ArrayList(java.util.ArrayList) List(java.util.List)

Aggregations

RedirectRequestElement (com.sun.identity.liberty.ws.interaction.jaxb.RedirectRequestElement)2 SOAPFaultDetail (com.sun.identity.liberty.ws.soapbinding.SOAPFaultDetail)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 JAXBException (javax.xml.bind.JAXBException)2 CorrelationHeader (com.sun.identity.liberty.ws.soapbinding.CorrelationHeader)1 Message (com.sun.identity.liberty.ws.soapbinding.Message)1 SOAPFault (com.sun.identity.liberty.ws.soapbinding.SOAPFault)1 SOAPFaultException (com.sun.identity.liberty.ws.soapbinding.SOAPFaultException)1