Package org.apache.axis2.engine

Examples of org.apache.axis2.engine.AxisFault


                int index = 0;
                while (!finish) {
                    Thread.sleep(1000);
                    index++;
                    if (index > 10) {
                        throw new AxisFault("Async response is taking too long[10s+]. Server is being shut down.");
                    }
                }
                call.close();

        }
View Full Code Here


            Class ImplClass = obj.getClass();
            DependencyManager.configureBusinussLogicProvider(obj,msgContext);

            OperationDescription op = msgContext.getOperationContext().getAxisOperation();
            if (op == null) {
                throw new AxisFault("Operation is not located, if this is doclit style the SOAP-ACTION should specified via the SOAP Action to use the RawXMLProvider");
            }
            String methodName = op.getName().getLocalPart();
            Method[] methods = ImplClass.getMethods();
            for (int i = 0; i < methods.length; i++) {
                if (methods[i].getName().equals(methodName)) {
                    this.method = methods[i];
                    break;
                }
            }
            Class[] parameters = method.getParameterTypes();
            if ((parameters != null)
                && (parameters.length == 1)
                && OMElement.class.getName().equals(parameters[0].getName())) {
                OMElement methodElement = msgContext.getEnvelope().getBody().getFirstElement();

                OMElement parmeter = null;
                SOAPEnvelope envelope = null;

                String style = msgContext.getOperationContext().getAxisOperation().getStyle();

                if (WSDLService.STYLE_DOC.equals(style)) {
                    parmeter = methodElement;
                    Object[] parms = new Object[] { parmeter };

                    // invoke the WebService
                    OMElement result = (OMElement) method.invoke(obj, parms);
                    envelope = OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope();
                    envelope.getBody().setFirstChild(result);

                } else if (WSDLService.STYLE_RPC.equals(style)) {
                    parmeter = methodElement.getFirstElement();
                    Object[] parms = new Object[] { parmeter };

                    // invoke the WebService
                    OMElement result = (OMElement) method.invoke(obj, parms);
                    SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
                    envelope = fac.getDefaultEnvelope();

                    OMNamespace ns = fac.createOMNamespace("http://soapenc/", "res");
                    OMElement responseMethodName = fac.createOMElement(methodName + "Response", ns);
                    if (result != null) {
                        responseMethodName.addChild(result);
                    }
                    if (responseMethodName != null) {
                        envelope.getBody().addChild(responseMethodName);
                    }
                } else {
                    throw new AxisFault("Unknown style ");
                }
            } else {
                throw new AxisFault(
                    "Raw Xml provider supports only the methods bearing the signature public OMElement "
                        + "&lt;method-name&gt;(OMElement) where the method name is anything");
            }
        } catch (Exception e) {
            throw AxisFault.makeFault(e);
View Full Code Here

            response.setEnvelope(resenvelope);
            engine = new AxisEngine(msgctx.getSystemContext());
            engine.receive(response);

        } else {
            throw new AxisFault("Blocking invocation always expect a response");
        }
        return response;
    }
View Full Code Here

        this.mep = mep;
    }

    protected void verifyInvocation(OperationDescription axisop,MessageContext msgCtx) throws AxisFault {
        if (axisop == null) {
            throw new AxisFault("OperationDescription can not be null");
        }

        if (mep.equals(axisop.getMessageExchangePattern())) {
            throw new AxisFault("This mepClient supports only "
                    + mep
                    + " And the Axis Operations suppiled supports "
                    + axisop.getMessageExchangePattern());
        }
View Full Code Here

        if (transport != null) {
            return serviceContext.getEngineContext().getAxisConfiguration().getTransportOut(new QName(transport));

        } else {
            throw new AxisFault("Cannot Infer transport from the URL");
        }

    }
View Full Code Here

        if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(soapVersionURI)) {
            fac = OMAbstractFactory.getSOAP12Factory();
        } else if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(soapVersionURI)) {
            fac = OMAbstractFactory.getSOAP11Factory();
        } else {
             throw new AxisFault("Invalid SOAP URI. Axis2 only supports SOAP 1.1 and 1.2");
        }
        return fac.getDefaultEnvelope();
    }
View Full Code Here

                        if (operationElement != null) {
                            if (method.getName().equals(operationElement.getLocalName())
                               || operationElement.getLocalName() != null && operationElement.getLocalName().startsWith(method.getName()) ) {
                                omElement = operationElement.getFirstElement();
                            } else {
                                throw new AxisFault("Operation Name does not match the immediate child name, expected "+ method.getName() + " but get " + operationElement.getLocalName());
                            }
                        } else {
                            throw new AxisFault("rpc style expect the immediate child of the SOAP body ");
                        }
                    } else {
                        throw new AxisFault("Unknown style ");
                    }
                    args = new Object[] { omElement };
                } else {
                    throw new AxisFault(
                        "Raw Xml provider supports only the methods bearing the signature public OMElement "
                            + "&lt;method-name&gt;(OMElement) where the method name is anything");
                }

                OMElement result = (OMElement) method.invoke(obj, args);
               
                OMElement bodyContent = null;
                if (WSDLService.STYLE_RPC.equals(style)) {
                    OMNamespace ns = getSOAPFactory().createOMNamespace("http://soapenc/", "res");
                    bodyContent =
                        getSOAPFactory().createOMElement(method.getName() + "Response", ns);
                    bodyContent.addChild(result);
                }else{
                    bodyContent = result;
                }

                SOAPEnvelope envelope = getSOAPFactory().getDefaultEnvelope();
                if(bodyContent!= null){
                    envelope.getBody().addChild(bodyContent);
                }
                newmsgContext.setEnvelope(envelope);
            } else {
                throw new AxisFault(
                    "Implementation class does not define a method called" + opDesc.getName());
            }
        } catch (Exception e) {
            throw AxisFault.makeFault(e);
        }
View Full Code Here

            while (!callback.isComplete()) {
                if (index < 20) {
                    try {
                        Thread.sleep(100);
                    } catch (InterruptedException e) {
                        throw new AxisFault(e);
                    }
                } else {
                    throw new AxisFault("Time out waiting for the response");
                }
            }
            if (callback.envelope != null) {
                MessageContext resMsgctx = new MessageContext(serviceContext.getEngineContext());
                resMsgctx.setEnvelope(callback.envelope);
                return resMsgctx;
            } else {
                if (callback.error instanceof AxisFault) {
                    throw (AxisFault) callback.error;
                } else {
                    throw new AxisFault(callback.error);
                }
            }
        } else {
            msgctx.setTo(to);
            msgctx.setSoapAction(soapAction);
            msgctx.setServiceContext(serviceContext);
            ConfigurationContext syscontext = serviceContext.getEngineContext();

            checkTransport(msgctx);

            ConfigurationContext sysContext = serviceContext.getEngineContext();
            AxisConfiguration registry = sysContext.getAxisConfiguration();

            msgctx.setOperationContext(
                OperationContextFactory.createMEPContext(
                    WSDLConstants.MEP_CONSTANT_IN_OUT,
                    axisop,
                    serviceContext));
            MessageContext response = TwoChannelBasedSender.send(msgctx, listenerTransport);

            SOAPEnvelope resenvelope = response.getEnvelope();

            if (resenvelope.getBody().hasFault()) {
                throw new AxisFault(resenvelope.getBody().getFault().getException());
            }
            return response;
        }
    }
View Full Code Here

                            || Constants.TRANSPORT_TCP.equals(senderTransport)
                            || Constants.TRANSPORT_COMMONS_HTTP.equals(senderTransport);
            boolean isCommonsAndHTTP =  Constants.TRANSPORT_COMMONS_HTTP.equals(senderTransport)
                    && Constants.TRANSPORT_HTTP.equals(listenerTransport);                        
            if(!isCommonsAndHTTP && (!isTransportsEqual || !isATwoWaytransport)){
                throw new AxisFault("useSeparateListener = false is only supports by the htpp/tcp and tcp commons transport set as the sender and receiver");
            }
        }else{
            this.useSeparateListener = useSeparateListener;

        }

        AxisConfiguration axisConfig = serviceContext.getEngineContext().getAxisConfiguration();
        this.listenerTransport = axisConfig.getTransportIn(new QName(listenerTransport));
        this.senderTransport = axisConfig.getTransportOut(new QName(senderTransport));
        if (this.senderTransport == null) {
            throw new AxisFault("Unknown transport " + senderTransport);
        }

        if (this.listenerTransport == null) {
            throw new AxisFault("Unknown transport " + listenerTransport);
        }

        if (useSeparateListener == true) {
            if (!serviceContext
                .getEngineContext()
                .getAxisConfiguration()
                .isEngaged(new QName(Constants.MODULE_ADDRESSING))) {
                throw new AxisFault("to do two Transport Channels the Addressing Modules must be engeged");
            }
            ListenerManager.makeSureStarted(listenerTransport, serviceContext.getEngineContext());
        }
    }
View Full Code Here

            int index = 0;
            while (!finish) {
                Thread.sleep(1000);
                index++;
                if (index > 10) {
                    throw new AxisFault("Server is shutdown as the Async response take too longs time");
                }
            }
            call.close();

    }
View Full Code Here

TOP

Related Classes of org.apache.axis2.engine.AxisFault

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.