Package org.apache.axis

Examples of org.apache.axis.AxisEngine


                return getNewServiceObject(msgContext, clsName);
            }

        } else if (scope.equalsIgnoreCase("Application")) {
            // MUST be AxisEngine here!
            AxisEngine engine = msgContext.getAxisEngine();
            if (engine.getApplicationSession() != null) {
                // This part isn't thread safe
                synchronized (this) {
                    // store service objects in session, indexed by class name
                    Object obj =
                            engine.getApplicationSession().get(serviceName);
                    if (obj == null) {
                        obj = getNewServiceObject(msgContext, clsName);
                        engine.getApplicationSession().set(serviceName, obj);
                    }
                    return obj;
                }
            } else {
                // was no incoming session, sigh, treat as request scope
View Full Code Here


            // Got one!
            try {
                Long id = (Long)header.
                             getValueAsType(Constants.XSD_LONG);
                // Store it away.
                AxisEngine engine = context.getAxisEngine();
                engine.setOption(SESSION_ID, id);
            } catch (Exception e) {
                throw AxisFault.makeFault(e);
            }
        } else {
            AxisEngine engine = context.getAxisEngine();
            Long id = (Long)engine.getOption(SESSION_ID);
            if (id == null)
                return;
           
            // We have a session ID, so insert the header
            Message msg = context.getRequestMessage();
View Full Code Here

    public SerializationContextImpl(Writer writer, MessageContext msgContext)
    {
        this.writer = writer;
        this.msgContext = msgContext;

        AxisEngine engine = null ;
        if ( msgContext != null ) {
            engine = msgContext.getAxisEngine();
            Boolean shouldSendDecl = (Boolean)engine.getOption(
                                                  AxisEngine.PROP_XML_DECL);
            if (shouldSendDecl != null)
                sendXMLDecl = shouldSendDecl.booleanValue();

            Boolean shouldSendMultiRefs =
                  (Boolean)msgContext.getProperty(AxisEngine.PROP_DOMULTIREFS);

            if (shouldSendMultiRefs == null)
                shouldSendMultiRefs =
                        (Boolean)engine.getOption(AxisEngine.PROP_DOMULTIREFS);

            if (shouldSendMultiRefs != null)
                doMultiRefs = shouldSendMultiRefs.booleanValue();

            // The SEND_TYPE_ATTR and PROP_SEND_XSI options indicate
            // whether the elements should have xsi:type attributes.
            // Only turn this off is the user tells us to
            if ( !msgContext.isPropertyTrue(Call.SEND_TYPE_ATTR, true ))
                sendXSIType = false ;

            Boolean opt = (Boolean)engine.getOption(AxisEngine.PROP_SEND_XSI);
            if ((opt != null) && (opt.equals(Boolean.FALSE))) {
                    sendXSIType = false ;
            }

            // A Document-style service overrides the above settings. Don't
View Full Code Here

                encodingStyle = org.apache.axis.Constants.URI_SOAP11_ENC;
            }
        }
        //register our type descriptors
        Service service = ((ServiceImpl) serviceImpl).getService();
        AxisEngine axisEngine = service.getEngine();
        TypeMappingRegistry typeMappingRegistry = axisEngine.getTypeMappingRegistry();
        TypeMapping typeMapping = typeMappingRegistry.getOrMakeTypeMapping(encodingStyle);
        typeMapping.register(BigInteger.class,
                Constants.XSD_UNSIGNEDLONG,
                new SimpleSerializerFactory(BigInteger.class, Constants.XSD_UNSIGNEDLONG),
                new SimpleDeserializerFactory(BigInteger.class, Constants.XSD_UNSIGNEDLONG));
View Full Code Here

                encodingStyle = org.apache.axis.Constants.URI_SOAP11_ENC;
            }
        }
        //register our type descriptors
        final Service service = ((ServiceImpl) serviceImpl).getService();
        final AxisEngine axisEngine = service.getEngine();
        final TypeMappingRegistry typeMappingRegistry = axisEngine.getTypeMappingRegistry();
        final TypeMapping typeMapping = typeMappingRegistry.getOrMakeTypeMapping(encodingStyle);
        typeMapping.register(BigInteger.class, Constants.XSD_UNSIGNEDLONG, new SimpleSerializerFactory(BigInteger.class, Constants.XSD_UNSIGNEDLONG), new SimpleDeserializerFactory(BigInteger.class, Constants.XSD_UNSIGNEDLONG));
        typeMapping.register(URI.class, Constants.XSD_ANYURI, new SimpleSerializerFactory(URI.class, Constants.XSD_ANYURI), new SimpleDeserializerFactory(URI.class, Constants.XSD_ANYURI));
        //It is essential that the types be registered before the typeInfos create the serializer/deserializers.
        for (final Iterator iter = typeInfo.iterator(); iter.hasNext(); ) {
View Full Code Here

    public void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
        servletLog.debug("Enter: doGet()");
       
        try {
            AxisEngine engine = getEngine();
            ServletContext servletContext =
                getServletConfig().getServletContext();

            String pathInfo = request.getPathInfo();
            String realpath = servletContext.getRealPath(request.getServletPath());
            if (realpath == null) {
                realpath = request.getServletPath();
            }

            boolean wsdlRequested = false;
            boolean listRequested = false;
            boolean hasParameters = request.getParameterNames().hasMoreElements();

            //JWS pages are special; they are the servlet path and there
            //is no pathinfo...we map the pathinfo to the servlet path to keep
            //it happy
            boolean isJWSPage = request.getRequestURI().endsWith(".jws");
            if(isJWSPage) {
                pathInfo= request.getServletPath();
            }

            // check first if we are doing WSDL or a list operation
            String queryString = request.getQueryString();
            boolean doExplain=false;
            if (queryString != null) {
                if (queryString.equalsIgnoreCase("wsdl")) {
                    wsdlRequested = true;
                } else if (queryString.equalsIgnoreCase("list")) {
                    listRequested = true;
                }
                else {
                    String operation=request.getParameter("operation");
                    if(operation!=null) {
                        if(operation.equals("explain"))
                            doExplain=true;
                    }
                    else if(request.getParameter("query")==null &&
                      request.getParameter("scanClause")==null)
                        doExplain=true;
                }
            }
            else
                doExplain=true;

            boolean hasNoPath = (pathInfo == null || pathInfo.equals(""));
            if (!wsdlRequested && !listRequested && hasNoPath && srwInfo.defaultDatabase==null) {
                // If the user requested the servlet (i.e. /axis/servlet/AxisServlet)
                // with no service name, present the user with a list of deployed
                // services to be helpful
                // Don't do this if we are doing WSDL or list.
                reportAvailableServices(response, request);
            } else if (realpath != null || doExplain) {
                // We have a pathname, so now we perform WSDL or list operations

                // get message context w/ various properties set
                MessageContext msgContext = createMessageContext(engine, request, response);

                if(doExplain) {
                    srwInfo.handleExplain(request, response, msgContext);
                    return;
                }

                // NOTE:  HttpUtils.getRequestURL has been deprecated.
                // This line SHOULD be:
                //    String url = req.getRequestURL().toString()
                // HOWEVER!!!!  DON'T REPLACE IT!  There's a bug in
                // req.getRequestURL that is not in HttpUtils.getRequestURL
                // req.getRequestURL returns "localhost" in the remote
                // scenario rather than the actual host name.
                //
                // ? Still true?  For which JVM's?
                //String url = HttpUtils.getRequestURL(request).toString();
                String url = request.getRequestURL().toString();

                msgContext.setProperty(MessageContext.TRANS_URL, url);


                if (wsdlRequested) {
                    // Do WSDL generation
                    msgContext.setTargetService("SRW");
                    processWsdlRequest(msgContext, response);
                } else if (listRequested) {
                    // Do list, if it is enabled
                    processListRequest(response);
                } else if (hasParameters) {
                    // If we have ?method=x&param=y in the URL, make a stab
                    // at invoking the method with the parameters specified
                    // in the URL

                    processMethodRequest(msgContext, request, response);
                    SRWDatabase.putDb((String)msgContext.getProperty("dbname"),
                        (SRWDatabase) msgContext.getProperty("db"));

                } else {

                    // See if we can locate the desired service.  If we
                    // can't, return a 404 Not Found.  Otherwise, just
                    // print the placeholder message.

                    String serviceName;
                    if (pathInfo.startsWith("/")) {
                        serviceName = pathInfo.substring(1);
                    } else {
                        serviceName = pathInfo;
                    }

                    SOAPService s = engine.getService(serviceName);
                    if (s == null) {
                        //no service: report it
                        if(isJWSPage) {
                            reportCantGetJWSService(request, response);
                        } else {
View Full Code Here

     * @throws AxisFault when anything other than a Server.NoService fault is reported
     * during WSDL generation
     */
    protected void processWsdlRequest(MessageContext msgContext,
                                      HttpServletResponse response) throws AxisFault, IOException {
        AxisEngine engine = getEngine();
        PrintWriter writer;
        try {
            engine.generateWSDL(msgContext);
            Document doc = (Document) msgContext.getProperty("WSDL");
            if (doc != null) {
                response.setContentType("text/xml");
                writer=response.getWriter();
                XMLUtils.DocumentToWriter(doc, writer);
View Full Code Here

        Message responseMsg=null;
        try {
            ByteArrayInputStream istream =
                new ByteArrayInputStream(msgtxt.getBytes("ISO-8859-1"));

            AxisEngine engine = getEngine();
            Message msg = new Message(istream, false);
            msgContext.setRequestMessage(msg);
            engine.invoke(msgContext);
            responseMsg = msgContext.getResponseMessage();
            //turn off caching for GET requests
            response.setHeader("Cache-Control", "no-cache");
            response.setHeader("Pragma", "no-cache");
            if (responseMsg == null) {
View Full Code Here

     * error is written out
     * @param response
     * @throws AxisFault, IOException
     */
    protected void processListRequest(HttpServletResponse response) throws AxisFault, IOException {
        AxisEngine engine = getEngine();
        if (enableList) {
            Document doc = Admin.listConfig(engine);
            if (doc != null) {
                response.setContentType("text/xml");
                PrintWriter writer=response.getWriter();
View Full Code Here

     * @throws AxisFault
     */
    protected void reportAvailableServices(HttpServletResponse response,
                                       HttpServletRequest request)
            throws  ConfigurationException, AxisFault, IOException {
        AxisEngine engine = getEngine();
        response.setContentType("text/html");
        PrintWriter writer=response.getWriter();
        writer.println("<h2>And now... Some Services</h2>");

        Iterator i;
        try {
            i = engine.getConfig().getDeployedServices();
        } catch (ConfigurationException configException) {
            //turn any internal configuration exceptions back into axis faults
            //if that is what they are
            if(configException.getContainedException() instanceof AxisFault) {
                throw (AxisFault) configException.getContainedException();
View Full Code Here

TOP

Related Classes of org.apache.axis.AxisEngine

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.