Package org.apache.axis2.jaxws.runtime.description.marshal

Examples of org.apache.axis2.jaxws.runtime.description.marshal.FaultBeanDesc


                // The faultBeanObject is a JAXB object that represents the data of the exception.  It is marshalled in the detail
                // section of the soap fault.  The faultBeanObject is obtained direction from the exception (A) or via
                // the legacy exception rules (B).
                Object faultBeanObject = null;

                FaultBeanDesc faultBeanDesc = marshalDesc.getFaultBeanDesc(fd);
                String faultInfo = fd.getFaultInfo();
                if (faultInfo == null || faultInfo.length() == 0) {
                    // Legacy Exception case
                    faultBeanObject = LegacyExceptionUtil.createFaultBean(t, fd, marshalDesc);
                } else {
                    // Normal case
                    // Get the fault bean object. 
                    Method getFaultInfo = t.getClass().getMethod("getFaultInfo", null);
                    faultBeanObject = getFaultInfo.invoke(t, null);
                }

                if (log.isErrorEnabled()) {
                    log.debug("The faultBean type is" + faultBeanObject.getClass().getName());
                }

                // Use "by java type" marshalling if necessary
                if (faultBeanObject == t ||
                        (context.getConstructionType() != JAXBUtils.CONSTRUCTION_TYPE
                                .BY_CONTEXT_PATH &&
                                isNotJAXBRootElement(faultBeanObject.getClass(), marshalDesc))) {
                    context.setProcessType(faultBeanObject.getClass());
                }

                QName faultBeanQName = new QName(faultBeanDesc.getFaultBeanNamespace(),
                                                 faultBeanDesc.getFaultBeanLocalName());
                // Make sure the faultBeanObject can be marshalled as an element
                if (!marshalDesc.getAnnotationDesc(faultBeanObject.getClass()).hasXmlRootElement())
                {
                    faultBeanObject = new JAXBElement(faultBeanQName, faultBeanObject.getClass(),
                                                      faultBeanObject);
View Full Code Here


        FaultDescription faultDesc = null;
        if (elementQName != null) {
            for (int i = 0; i < operationDesc.getFaultDescriptions().length && faultDesc == null;
                 i++) {
                FaultDescription fd = operationDesc.getFaultDescriptions()[i];
                FaultBeanDesc faultBeanDesc = marshalDesc.getFaultBeanDesc(fd);
                QName tryQName = new QName(faultBeanDesc.getFaultBeanNamespace(),
                                           faultBeanDesc.getFaultBeanLocalName());
                if (log.isErrorEnabled()) {
                    log.debug("  FaultDescription qname is (" + tryQName +
                            ") and detail element qname is (" + elementQName + ")");
                }
                if (elementQName.equals(tryQName)) {
                    faultDesc = fd;
                }
            }
        }

        if (faultDesc == null && elementQName != null) {
            // If not found, retry the search using just the local name
            for (int i = 0; i < operationDesc.getFaultDescriptions().length && faultDesc == null;
                 i++) {
                FaultDescription fd = operationDesc.getFaultDescriptions()[i];
                FaultBeanDesc faultBeanDesc = marshalDesc.getFaultBeanDesc(fd);
                String tryName = faultBeanDesc.getFaultBeanLocalName();
                if (elementQName.getLocalPart().equals(tryName)) {
                    faultDesc = fd;
                }
            }
        }


        if (faultDesc == null) {
            // This is a system exception if the method does not throw a checked exception or if
            // the detail block is missing or contains multiple items.
            exception = createSystemException(xmlfault, message);
        } else {
            if (log.isErrorEnabled()) {
                log.debug("Ready to demarshal service exception.  The detail entry name is " +
                        elementQName);
            }
            FaultBeanDesc faultBeanDesc = marshalDesc.getFaultBeanDesc(faultDesc);
            boolean isLegacy =
                    (faultDesc.getFaultInfo() == null || faultDesc.getFaultInfo().length() == 0);

            // Get the JAXB object from the block
            JAXBBlockContext blockContext = new JAXBBlockContext(marshalDesc.getPackages());

            // Note that faultBean may not be a bean, it could be a primitive
            Class faultBeanFormalClass = loadClass(faultBeanDesc.getFaultBeanClassName());

            // Use "by java type" marshalling if necessary
            if (blockContext.getConstructionType() != JAXBUtils.CONSTRUCTION_TYPE.BY_CONTEXT_PATH &&
                    isNotJAXBRootElement(faultBeanFormalClass, marshalDesc)) {
                blockContext.setProcessType(faultBeanFormalClass);
View Full Code Here

        try {
            // Get the fault bean name from the fault description.
            // REVIEW The default name should be:
            //      Package = <SEI package> or <SEI package>.jaxws
            //      Name = <exception name> + Bean
            FaultBeanDesc faultBeanDesc = marshalDesc.getFaultBeanDesc(fd);
            String faultBeanName = faultBeanDesc.getFaultBeanClassName();

            // TODO Add check that faultBeanName is correct
            if (log.isDebugEnabled()) {
                log.debug("Legacy Exception FaultBean name is = " + faultBeanName);
            }
View Full Code Here

            //    2) the values on the fault bean are obtained (using the bean's property desc map)
            //    3) use heuristics to find a matching constructor on the exception class.  If found it is instantiated.

            // To accomplish the above marshalling and unmarshalling we need the property descriptor maps
            // for the exception and the bean.
            FaultBeanDesc faultBeanDesc = ap.getFaultBeanDescMap().get(faultDesc);
            String faultDescBeanName = faultBeanDesc.getFaultBeanClassName();
            Class faultDescBean = loadClass(faultDescBeanName);
            if (faultDescBean != null) {
                addPropertyDesc(faultDescBeanName, map);
                addPropertyDesc(faultDescExceptionName, map);
            }
View Full Code Here

     * @param set       Set<Package> that is updated
     */
    private static void getPackagesFromAnnotations(FaultDescription faultDesc, TreeSet<String> set,
                                                   MarshalServiceRuntimeDescription msrd) {

        FaultBeanDesc faultBeanDesc = msrd.getFaultBeanDesc(faultDesc);
        if(faultBeanDesc == null){
          if(log.isDebugEnabled()){
            log.debug("faultBeanDesc from MarshallServiceRuntimeDescription is null");
          }
          //NO FaultBeanDesc found nothing we can do.
          return;
        }
        String faultBeanName = faultBeanDesc.getFaultBeanClassName();
        if(faultBeanName == null){
          if(log.isDebugEnabled()){
            log.debug("FaultBeanName is null");
          }
          //We cannot load the faultBeanName
          return;
        }
        Class faultBean = loadClass(faultBeanName);
        if (faultBean != null) {
            setTypeAndElementPackages(faultBean, faultBeanDesc.getFaultBeanNamespace(),
                                      faultBeanDesc.getFaultBeanLocalName(), set, msrd);
        }
    }
View Full Code Here

     * @param set       Set<Package> that is updated
     */
    private static void getAnnotationDescs(FaultDescription faultDesc,
                                           ArtifactProcessor ap,
                                           Map<String, AnnotationDesc> map) {
        FaultBeanDesc faultBeanDesc = ap.getFaultBeanDescMap().get(faultDesc);
        Class faultBean = loadClass(faultBeanDesc.getFaultBeanClassName());
        if (faultBean != null) {
            getTypeAnnotationDescs(faultBean, map);
        }
    }
View Full Code Here

                    if (foundResponseWrapperName != null) {
                        responseWrapperMap.put(opDesc, foundResponseWrapperName);
                    }

                    for (FaultDescription faultDesc : opDesc.getFaultDescriptions()) {
                        FaultBeanDesc faultBeanDesc = create(faultDesc, opDesc);
                        faultBeanDescMap.put(faultDesc, faultBeanDesc);
                    }
                }
            }
        }
View Full Code Here

            String charSetEncoding = BuilderUtil.getCharSetEncoding(contentTypeStr);
            msgContext.setProperty(
                    Constants.Configuration.CHARACTER_SET_ENCODING, charSetEncoding);
            boolean eprFound = false;
            if (endpointsConfiguration != null) {
                URLEndpoint epr = endpointsConfiguration.getEndpoint(request.getRequestLine().getUri());
                if (epr != null) {
                    eprFound = true;
                    String type = TransportUtils.getContentType(contentTypeStr, msgContext);
                    msgContext.setProperty(Constants.Configuration.MESSAGE_TYPE, type);
                    epr.setParameters(msgContext);

                    Builder builder = epr.getBuilder(type);
                    if (HTTPTransportUtils.isRESTRequest(contentTypeStr)) {
                        RESTUtil.processPOSTRequest(msgContext, is, os,
                                request.getRequestLine().getUri(), contentType, builder, isRestDispatching);
                    } else {
View Full Code Here

            String contentTypeStr = contentType != null ?
                    contentType.getValue() : inferContentType();

            boolean eprFound = false;
            if (endpointsConfiguration != null) {
                URLEndpoint epr = endpointsConfiguration.getEndpoint(request.getRequestLine().getUri());
                if (epr != null) {
                    eprFound = true;
                    String type = TransportUtils.getContentType(contentTypeStr, msgContext);
                    msgContext.setProperty(Constants.Configuration.MESSAGE_TYPE, type);

                    epr.setParameters(msgContext);

                    Builder builder = epr.getBuilder(type);
                    RESTUtil.processGetAndDeleteRequest(
                            msgContext, os, request.getRequestLine().getUri(),
                            request.getFirstHeader(HTTP.CONTENT_TYPE), builder,
                            method, isRestDispatching);
                }
View Full Code Here

        params = getListenerParameters();


        param = transportIn.getParameter(NhttpConstants.ENDPOINTS_CONFIGURATION);
        if (param != null && param.getValue() != null) {
            endpoints = new URLEndpointsConfigurationFactory().create(param.getValue().toString());
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.axis2.jaxws.runtime.description.marshal.FaultBeanDesc

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.