Search in sources :

Example 1 with ServiceInstanceUpdateHeader

use of com.sun.identity.liberty.ws.soapbinding.ServiceInstanceUpdateHeader in project OpenAM by OpenRock.

the class PPRequestHandler method processDSTRequest.

/**
     * Processes query/modify request.
     * @param request query or modify object.
     * @param requestMsg Request Message.
     * @param responseMsg Response Message.
     * @return Object processed response object.
     * @exception SOAPFaultException for the interaction redirects 
     * @exception Exception for any failure.
     */
public Object processDSTRequest(Object request, Message requestMsg, Message responseMsg) throws SOAPFaultException, DSTException {
    IDPPUtils.debug.message("PPRequestHandler:processRequest:Init");
    try {
        IDPPServiceManager serviceManager = IDPPServiceManager.getInstance();
        String providerID = serviceManager.getProviderID();
        ProviderHeader ph = new ProviderHeader(providerID);
        responseMsg.setProviderHeader(ph);
        if (serviceManager.isServiceInstanceUpdateEnabled()) {
            ServiceInstanceUpdateHeader siuHeader = getServiceInstanceUpdateHeader();
            responseMsg.setServiceInstanceUpdateHeader(siuHeader);
        }
        if (request instanceof QueryElement) {
            QueryElement query = (QueryElement) request;
            Document doc = IDPPUtils.getDocumentBuilder().newDocument();
            IDPPUtils.getMarshaller().setProperty("com.sun.xml.bind.namespacePrefixMapper", new NamespacePrefixMapperImpl());
            IDPPUtils.getMarshaller().marshal(query, doc);
            return processQueryRequest(query, providerID, requestMsg, doc);
        } else if (request instanceof ModifyElement) {
            ModifyElement modify = (ModifyElement) request;
            Document doc = IDPPUtils.getDocumentBuilder().newDocument();
            IDPPUtils.getMarshaller().setProperty("com.sun.xml.bind.namespacePrefixMapper", new NamespacePrefixMapperImpl());
            IDPPUtils.getMarshaller().marshal(modify, doc);
            return processModifyRequest(modify, providerID, requestMsg, doc);
        } else {
            IDPPUtils.debug.error("PPRequestHandler:processRequest:invalid" + " Request.");
            throw new DSTException(IDPPUtils.bundle.getString("invalidRequest"));
        }
    } catch (IDPPException ie) {
        IDPPUtils.debug.error("PPRequestHandler:processRequest fail", ie);
        throw new DSTException(ie);
    } catch (JAXBException je) {
        IDPPUtils.debug.error("PPRequestHandler:processRequest fail", je);
        throw new DSTException(IDPPUtils.bundle.getString("jaxbFailure"));
    } catch (SOAPBindingException sbe) {
        IDPPUtils.debug.error("PPRequestHandler:processRequest fail", sbe);
        throw new DSTException(sbe);
    }
}
Also used : ModifyElement(com.sun.identity.liberty.ws.idpp.jaxb.ModifyElement) ProviderHeader(com.sun.identity.liberty.ws.soapbinding.ProviderHeader) SOAPBindingException(com.sun.identity.liberty.ws.soapbinding.SOAPBindingException) JAXBException(javax.xml.bind.JAXBException) ServiceInstanceUpdateHeader(com.sun.identity.liberty.ws.soapbinding.ServiceInstanceUpdateHeader) NamespacePrefixMapperImpl(com.sun.identity.liberty.ws.soapbinding.NamespacePrefixMapperImpl) DSTException(com.sun.identity.liberty.ws.dst.DSTException) QueryElement(com.sun.identity.liberty.ws.idpp.jaxb.QueryElement) Document(org.w3c.dom.Document)

Example 2 with ServiceInstanceUpdateHeader

use of com.sun.identity.liberty.ws.soapbinding.ServiceInstanceUpdateHeader in project OpenAM by OpenRock.

the class IDPPServiceInstanceUpdate method getServiceInstanceUpdateHeader.

/**
     * Gets the service instance update header.
     *
     * @return <code>ServiceInstanceUpdateHeader</code> ServiceInstanceUpdate
     *         Header for the Personal Profile Service.
     *         "null" if the end point is not configured.
     */
public ServiceInstanceUpdateHeader getServiceInstanceUpdateHeader() {
    ServiceInstanceUpdateHeader siuHeader = new ServiceInstanceUpdateHeader();
    String alternateEndPoint = IDPPServiceManager.getInstance().getAlternateEndPoint();
    if (alternateEndPoint == null) {
        IDPPUtils.debug.error("IDPPServiceInstanceUpdate.getService" + "InstanceUpdateHeader: Alternate Endpoint is null");
        return null;
    }
    siuHeader.setEndpoint(alternateEndPoint);
    Set alternateSechMechs = IDPPServiceManager.getInstance().getAlternateSecurityMechs();
    if (alternateSechMechs != null && !alternateSechMechs.isEmpty()) {
        List list = new ArrayList();
        Iterator iter = alternateSechMechs.iterator();
        while (iter.hasNext()) {
            list.add((String) iter.next());
        }
        siuHeader.setSecurityMechIDs(list);
    }
    return siuHeader;
}
Also used : Set(java.util.Set) ServiceInstanceUpdateHeader(com.sun.identity.liberty.ws.soapbinding.ServiceInstanceUpdateHeader) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) List(java.util.List) ArrayList(java.util.ArrayList)

Example 3 with ServiceInstanceUpdateHeader

use of com.sun.identity.liberty.ws.soapbinding.ServiceInstanceUpdateHeader in project OpenAM by OpenRock.

the class PPRequestHandler method getServiceInstanceUpdateHeader.

/**
     * Gets the service instance update header.
     * 
     * @exception SOAPFaultException.
     */
private ServiceInstanceUpdateHeader getServiceInstanceUpdateHeader() throws SOAPFaultException {
    ServiceInstanceUpdate siu = IDPPServiceManager.getInstance().getServiceInstanceUpdate();
    ServiceInstanceUpdateHeader siuHeader = siu.getServiceInstanceUpdateHeader();
    if (siu.isSOAPFaultNeeded()) {
        QName faultCodeServer = new QName(SOAPBindingConstants.NS_SOAP, "Server");
        SOAPFaultDetail detail = new SOAPFaultDetail(SOAPFaultDetail.ENDPOINT_MOVED, null, null);
        SOAPFault sf = new SOAPFault(faultCodeServer, IDPPUtils.bundle.getString("endPointMoved"), null, detail);
        Message sfmsg = new Message(sf);
        sfmsg.setServiceInstanceUpdateHeader(siuHeader);
        SOAPFaultException sfe = new SOAPFaultException(sfmsg);
        throw sfe;
    }
    return siuHeader;
}
Also used : Message(com.sun.identity.liberty.ws.soapbinding.Message) QName(javax.xml.namespace.QName) ServiceInstanceUpdateHeader(com.sun.identity.liberty.ws.soapbinding.ServiceInstanceUpdateHeader) SOAPFaultDetail(com.sun.identity.liberty.ws.soapbinding.SOAPFaultDetail) SOAPFault(com.sun.identity.liberty.ws.soapbinding.SOAPFault) SOAPFaultException(com.sun.identity.liberty.ws.soapbinding.SOAPFaultException) InteractionSOAPFaultException(com.sun.identity.liberty.ws.interaction.InteractionSOAPFaultException) ServiceInstanceUpdate(com.sun.identity.liberty.ws.interfaces.ServiceInstanceUpdate)

Aggregations

ServiceInstanceUpdateHeader (com.sun.identity.liberty.ws.soapbinding.ServiceInstanceUpdateHeader)3 DSTException (com.sun.identity.liberty.ws.dst.DSTException)1 ModifyElement (com.sun.identity.liberty.ws.idpp.jaxb.ModifyElement)1 QueryElement (com.sun.identity.liberty.ws.idpp.jaxb.QueryElement)1 InteractionSOAPFaultException (com.sun.identity.liberty.ws.interaction.InteractionSOAPFaultException)1 ServiceInstanceUpdate (com.sun.identity.liberty.ws.interfaces.ServiceInstanceUpdate)1 Message (com.sun.identity.liberty.ws.soapbinding.Message)1 NamespacePrefixMapperImpl (com.sun.identity.liberty.ws.soapbinding.NamespacePrefixMapperImpl)1 ProviderHeader (com.sun.identity.liberty.ws.soapbinding.ProviderHeader)1 SOAPBindingException (com.sun.identity.liberty.ws.soapbinding.SOAPBindingException)1 SOAPFault (com.sun.identity.liberty.ws.soapbinding.SOAPFault)1 SOAPFaultDetail (com.sun.identity.liberty.ws.soapbinding.SOAPFaultDetail)1 SOAPFaultException (com.sun.identity.liberty.ws.soapbinding.SOAPFaultException)1 ArrayList (java.util.ArrayList)1 Iterator (java.util.Iterator)1 List (java.util.List)1 Set (java.util.Set)1 JAXBException (javax.xml.bind.JAXBException)1 QName (javax.xml.namespace.QName)1 Document (org.w3c.dom.Document)1