Package org.apache.axis2.description

Examples of org.apache.axis2.description.AxisService


            } else if (!uri.startsWith(contextPath)) {
                response.setStatus(ResponseStatus.MOVED_PERMANENTLY);
                response.addHeader(LOCATION, contextPath);

            } else if (parameters.containsKey("wsdl")) {
                AxisService service = (AxisService) configurationContext.getAxisConfiguration().
                    getServices().get(serviceName);
                if (service != null) {
                    try {
                        service.printWSDL(response.getOutputStream(),
                            getIpAddress(), servicePath);
                        response.setHeader(CONTENT_TYPE, TEXT_HTML);
                        response.setStatus(ResponseStatus.OK);

                    } catch (AxisFault e) {
                        handleException("Axis2 fault writing ?wsdl output", e, response);
                        return;
                    } catch (SocketException e) {
                        handleException("Error getting ip address for ?wsdl output", e, response);
                        return;
                    }
                }

            } else if (parameters.containsKey("wsdl2")) {
                AxisService service = (AxisService) configurationContext.getAxisConfiguration().
                    getServices().get(serviceName);
                if (service != null) {
                    try {
                        service.printWSDL2(response.getOutputStream(),
                            getIpAddress(), servicePath);
                        response.setHeader(CONTENT_TYPE, TEXT_HTML);
                        response.setStatus(ResponseStatus.OK);

                    } catch (AxisFault e) {
                        handleException("Axis2 fault writing ?wsdl2 output", e, response);
                        return;
                    } catch (SocketException e) {
                        handleException("Error getting ip address for ?wsdl2 output", e, response);
                        return;
                    }
                }

            } else if (parameters.containsKey("xsd")) {
                if (parameters.get("xsd") == null || "".equals(parameters.get("xsd"))) {
                    AxisService service = (AxisService) configurationContext.getAxisConfiguration()
                        .getServices().get(serviceName);
                    if (service != null) {
                        try {
                            service.printSchema(response.getOutputStream());
                            response.setHeader(CONTENT_TYPE, TEXT_HTML);
                            response.setStatus(ResponseStatus.OK);

                        } catch (AxisFault axisFault) {
                            handleException("Error writing ?xsd output to client", axisFault, response);
                            return;
                        }
                    }

                } else {
                    //cater for named xsds - check for the xsd name
                    String schemaName = (String) parameters.get("xsd");
                    AxisService service = (AxisService) configurationContext.getAxisConfiguration()
                        .getServices().get(serviceName);

                    if (service != null) {
                        //run the population logic just to be sure
                        service.populateSchemaMappings();
                        //write out the correct schema
                        Map schemaTable = service.getSchemaMappingTable();
                        final XmlSchema schema = (XmlSchema)schemaTable.get(schemaName);
                        //schema found - write it to the stream
                        if (schema != null) {
                            schema.write(response.getOutputStream());
                            response.setHeader(CONTENT_TYPE, TEXT_HTML);
View Full Code Here


        OperationDescription op = ops[0];
        return op;
    }
   
    private EndpointDescription getEndpointDescription(MessageContext mc) {
        AxisService axisSvc = mc.getAxisMessageContext().getAxisService();

        Parameter param = axisSvc.getParameter(EndpointDescription.AXIS_SERVICE_PARAMETER);

        EndpointDescription ed = (EndpointDescription) param.getValue();
        return ed;
    }
View Full Code Here

    String axis2_xml = "test-resources" + File.separator + "server_mtom_axis2.xml";
    ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(
        repoPath, axis2_xml);

    AxisConfiguration axisConfiguration = configContext.getAxisConfiguration();
    AxisService axisService = axisConfiguration.getService("RMSampleService");
    AxisOperation operation = AxisOperationFactory.getAxisOperation(WSDL20_2004Constants.MEP_CONSTANT_IN_ONLY);
    operation.setMessageReceiver(new MTOMTestMessageReceiver());
    operation.setName(new QName(MTOMping));
    axisService.addOperation(operation);

    AxisOperation pingOperation = axisService.getOperation(new QName(PING_OPERATION_NAME));
    if (pingOperation == null)
      throw new AxisFault("Cant find the ping operation");

    // setting the operation specific phase chain
    operation.setRemainingPhasesInFlow(pingOperation.getRemainingPhasesInFlow());
View Full Code Here

   
    ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(
        repoPath, axis2_xml);

    AxisConfiguration axisConfiguration = configContext.getAxisConfiguration();
    AxisService axisService = axisConfiguration.getService("RMSampleService");
    AxisOperation operation = AxisOperationFactory.getAxisOperation(WSDL20_2004Constants.MEP_CONSTANT_IN_ONLY);
    operation.setMessageReceiver(new TestMessageReceiver());
    operation.setName(new QName(TEST_OPERATION_NAME));
    axisService.addOperation(operation);

    AxisOperation pingOperation = axisService.getOperation(new QName("ping"));
    if (pingOperation == null)
      throw new AxisFault("Cant find the ping operation");

    // setting the operation specific phase chain
    operation.setRemainingPhasesInFlow(pingOperation.getRemainingPhasesInFlow());
View Full Code Here

    }
   
    public void overrideConfigurationContext (ConfigurationContext context,MessageReceiver messageReceiver, String operationName, boolean newOperation, int mep) throws Exception  {
     
     
      AxisService rmService = context.getAxisConfiguration().getService(RMServiceName);
     
      AxisOperation operation = null;
     
      if (newOperation) {
        operation = rmService.getOperation(new QName (operationName));
        if (operation==null)
          throw new Exception ("Given operation not found");
      } else {
        operation = AxisOperationFactory.getAxisOperation(mep);
        rmService.addOperation(operation);
      }
     
      operation.setMessageReceiver(messageReceiver);
    }
View Full Code Here

            response.setStatusCode(HttpStatus.SC_MOVED_PERMANENTLY);
            response.addHeader(LOCATION, servicePath + "/");
            serverHandler.commitResponse(conn, response);

        } else if (serviceName != null && parameters.containsKey("wsdl")) {
            AxisService service = (AxisService) cfgCtx.getAxisConfiguration().
                getServices().get(serviceName);
            if (service != null) {
                try {
                    response.addHeader(CONTENT_TYPE, TEXT_XML);
                    serverHandler.commitResponse(conn, response);
                    service.printWSDL(os, getIpAddress());

                } catch (AxisFault e) {
                    handleException("Axis2 fault writing ?wsdl output", e);
                    return;
                } catch (SocketException e) {
                    handleException("Error getting ip address for ?wsdl output", e);
                    return;
                }
            }

        } else if (serviceName != null && parameters.containsKey("wsdl2")) {
            AxisService service = (AxisService) cfgCtx.getAxisConfiguration().
                getServices().get(serviceName);
            if (service != null) {
                try {
                    response.addHeader(CONTENT_TYPE, TEXT_XML);
                    serverHandler.commitResponse(conn, response);
                    service.printWSDL2(os, getIpAddress());
                } catch (AxisFault e) {
                    handleException("Axis2 fault writing ?wsdl2 output", e);
                    return;
                } catch (SocketException e) {
                    handleException("Error getting ip address for ?wsdl2 output", e);
                    return;
                }
            }

        } else if (serviceName != null && parameters.containsKey("xsd")) {
            if (parameters.get("xsd") == null || "".equals(parameters.get("xsd"))) {
                AxisService service = (AxisService) cfgCtx.getAxisConfiguration()
                    .getServices().get(serviceName);
                if (service != null) {
                    try {
                        response.addHeader(CONTENT_TYPE, TEXT_XML);
                        serverHandler.commitResponse(conn, response);
                        service.printSchema(os);

                    } catch (AxisFault axisFault) {
                        handleException("Error writing ?xsd output to client", axisFault);
                        return;
                    }
                }

            } else {
                //cater for named xsds - check for the xsd name
                String schemaName = (String) parameters.get("xsd");
                AxisService service = (AxisService) cfgCtx.getAxisConfiguration()
                    .getServices().get(serviceName);

                if (service != null) {
                    //run the population logic just to be sure
                    service.populateSchemaMappings();
                    //write out the correct schema
                    Map schemaTable = service.getSchemaMappingTable();
                    XmlSchema schema = (XmlSchema)schemaTable.get(schemaName);
                    if (schema == null) {
                        int dotIndex = schemaName.indexOf('.');
                        if (dotIndex > 0) {
                            String schemaKey = schemaName.substring(0,dotIndex);
                            schema = (XmlSchema) schemaTable.get(schemaKey);
                        }
                    }
                    //schema found - write it to the stream
                    if (schema != null) {
                        response.addHeader(CONTENT_TYPE, TEXT_XML);
                        serverHandler.commitResponse(conn, response);
                        schema.write(os);

                    } else {
                        // no schema available by that name  - send 404
                        response.setStatusCode(HttpStatus.SC_NOT_FOUND);
                    }
                }
            }

        } else if (serviceName == null || serviceName.length() == 0) {

            try {
                response.addHeader(CONTENT_TYPE, TEXT_HTML);
                serverHandler.commitResponse(conn, response);
                os.write(getServicesHTML().getBytes());

            } catch (IOException e) {
                handleException("Error writing ? output to client", e);
            }

        } else {
            if (parameters.isEmpty()) {
                AxisService service = (AxisService) cfgCtx.getAxisConfiguration().
                    getServices().get(serviceName);
                if (service != null) {
                    try {
                        response.addHeader(CONTENT_TYPE, TEXT_HTML);
                        serverHandler.commitResponse(conn, response);
View Full Code Here

            Collection serviceCollection = services.values();
            resultBuf.append("<h2>" + "Deployed services" + "</h2>");

            for (Iterator it = serviceCollection.iterator(); it.hasNext();) {

                AxisService axisService = (AxisService) it.next();
                if (axisService.getName().startsWith("__")) {
                    continue;    // skip private services
                }

                Iterator iterator = axisService.getOperations();
                resultBuf.append("<h3><a href=\"" + axisService.getName() + "?wsdl\">" +
                        axisService.getName() + "</a></h3>");

                if (iterator.hasNext()) {
                    resultBuf.append("Available operations <ul>");

                    for (; iterator.hasNext();) {
View Full Code Here

                org.apache.axis2.description.WSDL2Constants.MEP_URI_IN_OUT,
                inOutmessageReceiver);
        messageReciverMap.put(org.apache.axis2.description.WSDL2Constants.MEP_URI_ROBUST_IN_ONLY,
            inOutmessageReceiver);

        AxisService businessService =
                AxisService.createService(Services.class.getName(),
                                          businessConfigCtx.getAxisConfiguration(),
                                          messageReciverMap,
                                          "http://business.org", "http://business.org",
                                          Services.class.getClassLoader());
View Full Code Here

        }

        ConfigurationContext axisCfgCtx = axisOutMsgCtx.getConfigurationContext();
        AxisConfiguration axisCfg       = axisCfgCtx.getAxisConfiguration();

        AxisService anoymousService =
            AnonymousServiceFactory.getAnonymousService(synapseOutMessageContext.getConfiguration(),
            axisCfg, wsAddressingEnabled, wsRMEnabled, wsSecurityEnabled);
        ServiceGroupContext sgc = new ServiceGroupContext(
            axisCfgCtx, (AxisServiceGroup) anoymousService.getParent());
        ServiceContext serviceCtx = sgc.getServiceContext(anoymousService);

        boolean outOnlyMessage = "true".equals(
            synapseOutMessageContext.getProperty(SynapseConstants.OUT_ONLY));

        // get a reference to the DYNAMIC operation of the Anonymous Axis2 service
        AxisOperation axisAnonymousOperation = anoymousService.getOperation(
            outOnlyMessage ?
                new QName(AnonymousServiceFactory.OUT_ONLY_OPERATION) :
                new QName(AnonymousServiceFactory.OUT_IN_OPERATION));

        Options clientOptions = new Options();
View Full Code Here

                String serviceName =
                    jmsConnectionFactory.getServiceNameForDestination(dest, destinationName);
                String soapAction = JMSUtils.getInstace().
                    getProperty(message, BaseConstants.SOAPACTION);
                AxisService service = null;

                // set to bypass dispatching if we know the service - we already should!
                if (serviceName != null) {
                    service = cfgCtx.getAxisConfiguration().getService(serviceName);
                    msgContext.setAxisService(service);

                    // find the operation for the message, or default to one
                    Parameter operationParam = service.getParameter(BaseConstants.OPERATION_PARAM);
                    QName operationQName = (
                        operationParam != null ?
                            BaseUtils.getQNameFromString(operationParam.getValue()) :
                            BaseConstants.DEFAULT_OPERATION);

                    AxisOperation operation = service.getOperation(operationQName);
                    if (operation != null) {
                        msgContext.setAxisOperation(operation);
                        msgContext.setSoapAction("urn:" + operation.getName().getLocalPart());
                    }
                }

                // set the message property OUT_TRANSPORT_INFO
                // the reply is assumed to be over the JMSReplyTo destination, using
                // the same incoming connection factory, if a JMSReplyTo is available
                if (message.getJMSReplyTo() != null) {
                    msgContext.setProperty(
                        Constants.OUT_TRANSPORT_INFO,
                        new JMSOutTransportInfo(jmsConnectionFactory, message.getJMSReplyTo()));

                } else if (service != null) {
                    // does the service specify a default reply destination ?
                    Parameter param = service.getParameter(JMSConstants.REPLY_PARAM);
                    if (param != null && param.getValue() != null) {
                        msgContext.setProperty(
                            Constants.OUT_TRANSPORT_INFO,
                            new JMSOutTransportInfo(
                                jmsConnectionFactory,
View Full Code Here

TOP

Related Classes of org.apache.axis2.description.AxisService

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.