Package org.apache.openejb.server

Examples of org.apache.openejb.server.ServerRuntimeException


    private Object doIntercept(final Method method, final Object[] objects, final MethodProxy methodProxy) throws Throwable {
        final int index = methodProxy.getSuperIndex();
        final OperationInfo operationInfo = operations[index];
        if (operationInfo == null) {
            throw new ServerRuntimeException("Operation not mapped: " + method.getName() + " index: " + index + "\n OperationInfos: " + Arrays.asList(operations));
        }
        stub.checkCachedEndpoint();

        final Call call = stub.createCall();

        operationInfo.prepareCall(call);

        stub.setUpCall(call);
        if (credentialsName != null) {
            throw new UnsupportedOperationException("Client side auth is not implementd");
//            Subject subject = ContextManager.getNextCaller();
//            if (subject == null) {
//                throw new IllegalStateException("Subject missing but authentication turned on");
//            } else {
//                Set creds = subject.getPrivateCredentials(NamedUsernamePasswordCredential.class);
//                boolean found = false;
//                for (Iterator iterator = creds.iterator(); iterator.hasNext();) {
//                    NamedUsernamePasswordCredential namedUsernamePasswordCredential = (NamedUsernamePasswordCredential) iterator.next();
//                    if (credentialsName.equals(namedUsernamePasswordCredential.getName())) {
//                        call.setUsername(namedUsernamePasswordCredential.getUsername());
//                        call.setPassword(new String(namedUsernamePasswordCredential.getPassword()));
//                        found = true;
//                        break;
//                    }
//                }
//                if (!found) {
//                    throw new IllegalStateException("no NamedUsernamePasswordCredential found for name " + credentialsName);
//                }
//            }
        }
        Object response = null;
        final List parameterDescs = operationInfo.getOperationDesc().getParameters();
        final Object[] unwrapped = extractFromHolders(objects, parameterDescs, operationInfo.getOperationDesc().getNumInParams());
        if (operationInfo.getOperationDesc().getMep() == OperationType.REQUEST_RESPONSE) {
            try {
                response = call.invoke(unwrapped);
            } catch (final RemoteException e) {
                throw operationInfo.unwrapFault(e);
            }

            if (response instanceof RemoteException) {
                throw operationInfo.unwrapFault((RemoteException) response);
            } else {
                stub.extractAttachments(call);
                final Map outputParameters = call.getOutputParams();
                putInHolders(outputParameters, objects, parameterDescs);
                final Class returnType = operationInfo.getOperationDesc().getReturnClass();
                //return type should never be null... but we are not objecting if wsdl-return-value-mapping is not set.
                if (response == null || returnType == null || returnType.isAssignableFrom(response.getClass())) {
                    return response;
                } else {
                    return JavaUtils.convert(response, returnType);
                }
            }
        } else if (operationInfo.getOperationDesc().getMep() == OperationType.ONE_WAY) {
            //one way
            call.invokeOneWay(unwrapped);
            return null;
        } else {
            throw new ServerRuntimeException("Invalid messaging style: " + operationInfo.getOperationDesc().getMep());
        }
    }
View Full Code Here


            } else if (provider.equalsIgnoreCase("sun")) {
                DEFAULT_SAAJ_UNIVERSE = SaajUniverse.Type.SUN;
            } else if (provider.equalsIgnoreCase("default")) {
                DEFAULT_SAAJ_UNIVERSE = null;
            } else {
                throw new ServerRuntimeException("Invalid SAAJ universe specified: " + provider);
            }

            if (DEFAULT_SAAJ_UNIVERSE != null) {
                logger.info("Default SAAJ universe: " + DEFAULT_SAAJ_UNIVERSE);
            } else {
View Full Code Here

                if (messageContext.getOperation().getMep() == OperationType.ONE_WAY) {
                    // No content, so just indicate accepted
                    res.setStatus(HttpServletResponse.SC_ACCEPTED);
                    return;
                } else if (responseMessage == null) {
                    responseMessage = handleException(messageContext, null, new ServerRuntimeException("No response for non-one-way operation"));
                }
            } else if (responseMessage == null) {
                res.setStatus(HttpServletResponse.SC_ACCEPTED);
                return;
            }
View Full Code Here

            final SOAPMessage message = ((SOAPMessageContext) context).getMessage();
            if (message != null) {
                message.saveChanges();
            }
        } catch (final SOAPException e) {
            throw new ServerRuntimeException("Unable to save changes to SOAPMessage : " + e.toString());
        }
    }
View Full Code Here

        private SOAPBody getBody(final SOAPMessage message) {
            try {
                return message.getSOAPPart().getEnvelope().getBody();
            } catch (final SOAPException e) {
                throw new ServerRuntimeException(e);
            }
        }
View Full Code Here

                final RPCElement responseBody = createResponseBody(requestBody, messageContext, operation, serviceDescription, object, responseEnvelope, getInOutParams());

                responseEnvelope.removeBody();
                responseEnvelope.addBodyElement(responseBody);
            } catch (final Exception e) {
                throw new ServerRuntimeException("Failed while creating response message body", e);
            }
        }
View Full Code Here

        }

        public InputSource getBaseInputSource() {
            final ZipEntry entry = moduleFile.getEntry(wsdlURI.toString());
            if (entry == null) {
                throw new ServerRuntimeException("The webservices.xml file points to a non-existant WSDL file " + wsdlURI.toString());
            }

            final InputStream wsdlInputStream;
            try {
                wsdlInputStream = moduleFile.getInputStream(entry);
                streams.add(wsdlInputStream);
            } catch (final Exception e) {
                throw new ServerRuntimeException("Could not open stream to wsdl file", e);
            }
            return new InputSource(wsdlInputStream);
        }
View Full Code Here

            try {
                final ZipEntry entry = moduleFile.getEntry(latestImportURI.toString());
                importInputStream = moduleFile.getInputStream(entry);
                streams.add(importInputStream);
            } catch (final Exception e) {
                throw new ServerRuntimeException("Could not open stream to import file", e);
            }

            final InputSource inputSource = new InputSource(importInputStream);
            inputSource.setSystemId(getLatestImportURI());
            return inputSource;
View Full Code Here

                    connections.put(session.uri, session);

                    // seen - needs to get maintained as "connected"
                    // TODO remove from seen
                } catch (final IOException e) {
                    throw new ServerRuntimeException(e);
                }
            }

            connect.addAll(unresolved);
        }
View Full Code Here

             */
            if (inMessage instanceof SoapMessage) {
                try {
                    reserialize((SoapMessage) inMessage);
                } catch (final Exception e) {
                    throw new ServerRuntimeException("Failed to reserialize soap message", e);
                }
            } else {
                // TODO: how to handle XML/HTTP binding?
            }

View Full Code Here

TOP

Related Classes of org.apache.openejb.server.ServerRuntimeException

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.