Examples of AxisService


Examples of org.apache.axis2.description.AxisService

        //  2) request is to be injected into  the main sequence  .i.e. http://localhost:8280
        // This method does not cause any performance issue ...
        // Proper fix should be refractoring axis2 RestUtil in a proper way
        if (dispatching) {
            RequestURIBasedDispatcher requestDispatcher = new RequestURIBasedDispatcher();
            AxisService axisService = requestDispatcher.findService(msgContext);
            if (axisService == null) {
                String defaultSvcName = NHttpConfiguration.getInstance().getStringValue(
                        "nhttp.default.service", "__SynapseService");
                axisService = msgContext.getConfigurationContext()
                        .getAxisConfiguration().getService(defaultSvcName);
View Full Code Here

Examples of org.apache.axis2.description.AxisService

        serviceObj     = Activator.bc.getService(sr);
        if(serviceObj == null) {
          throw new NullPointerException("serviceObj argument cannot be null");
        }       
      }
      AxisService as = createService(axisConfig);
     
      axisConfig.addService(as);
     
      Activator.log.info("deployed " + this + " in " + axisConfig);
      serviceMap.put(axisConfig, as);
View Full Code Here

Examples of org.apache.axis2.description.AxisService

 

  public void undeploy(AxisConfiguration axisConfig) throws Exception {
    synchronized(serviceMap) {
      AxisService as = (AxisService)serviceMap.get(axisConfig);
      if(as == null) {
        throw new IllegalStateException(this + " not deployed in " + axisConfig);
      }

      axisConfig.removeService(as.getName());
     
      Activator.log.info("undeployed " + this + " from " + axisConfig);
      serviceMap.remove(axisConfig);

      if(getDeployCount() == 0) {
View Full Code Here

Examples of org.apache.axis2.description.AxisService

  // This code is more or less copied from AxisService.createService()
  // ...but why is it so complicated???
  static AxisService createService(final SOAPService       soapService,
                                   AxisConfiguration axisConfiguration) throws Exception {
    AxisService     axisService          = new OSGiAxisService(soapService);
   
    HashMap messageReceiverClassMap = new HashMap();

    MessageReceiver messageReceiver = new org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver() {
      protected Object makeNewServiceObject(MessageContext msgContext) throws AxisFault {
        return soapService.serviceObj;
      }
    };
   
    messageReceiverClassMap.put(WSDL2Constants.MEP_URI_IN_ONLY,        messageReceiver);

    MessageReceiver inOutmessageReceiver = new org.apache.axis2.rpc.receivers.RPCMessageReceiver() {
      protected Object makeNewServiceObject(MessageContext msgContext) throws AxisFault{
        return soapService.serviceObj;
      }
    };

    messageReceiverClassMap.put(WSDL2Constants.MEP_URI_IN_OUT,         inOutmessageReceiver);
    messageReceiverClassMap.put(WSDL2Constants.MEP_URI_ROBUST_IN_ONLY, inOutmessageReceiver);

    axisService.setParent(axisConfiguration);
    axisService.setName(soapService.serviceName);

    soapService.schemaGenerator =
      new DefaultSchemaGenerator(soapService.serviceObj.getClass().getClassLoader(),
                                 soapService.serviceClass,
                                 soapService.targetNamespace,
                                 Java2WSDLConstants.SCHEMA_NAMESPACE_PRFIX, axisService) {
        // override to use "allowed method" semantics
        protected JMethod[] processMethods(JMethod[] declaredMethods) throws Exception {
          ArrayList al = new ArrayList();

          Hashtable props = new Hashtable();
          for(int i = 0; i < declaredMethods.length; i++) {
            String name = declaredMethods[i].getSimpleName();
            props.put("name", name);
            if(soapService.allowedMethodsFilter == null ||
               soapService.allowedMethodsFilter.match(props)) {
              Activator.log.info("allow method " + name);
              al.add(declaredMethods[i]);
            } else {
              Activator.log.info("skip method  " + name);
            }
          }
         
          JMethod[] r = new JMethod[al.size()];
          al.toArray(r);

          JMethod[] methods = super.processMethods(r);
          return methods;
        }
      };
   
    soapService.schemaGenerator.setElementFormDefault(Java2WSDLConstants.FORM_DEFAULT_UNQUALIFIED);

    // Utils.addExcludeMethods(soapService.excludeMethods);
    // soapService.schemaGenerator.setExcludeMethods(soapService.excludeMethods);

    Parameter parameter = new Parameter(Constants.SERVICE_CLASS, soapService.serviceClass);
    OMElement paraElement = Utils.getParameter(Constants.SERVICE_CLASS, soapService.serviceClass, false);
    parameter.setParameterElement(paraElement);
    axisService.setUseDefaultChains(false);
    axisService.addParameter(parameter);
    axisService.setName(soapService.serviceName);

    axisService.setClassLoader(soapService.serviceObj.getClass().getClassLoader());

    NamespaceMap map = new NamespaceMap();
    map.put(Java2WSDLConstants.AXIS2_NAMESPACE_PREFIX,          Java2WSDLConstants.AXIS2_XSD);
    map.put(Java2WSDLConstants.DEFAULT_SCHEMA_NAMESPACE_PREFIX, Java2WSDLConstants.URI_2001_SCHEMA_XSD);
    axisService.setNameSpacesMap(map);
    axisService.setElementFormDefault(false);
    axisService.addSchema(soapService.schemaGenerator.generateSchema());
    axisService.setSchemaTargetNamespace(soapService.schemaGenerator.getSchemaTargetNameSpace());
    axisService.setTypeTable(soapService.schemaGenerator.getTypeTable());

    if (soapService.targetNamespace == null) {
      soapService.targetNamespace = soapService.schemaGenerator.getSchemaTargetNameSpace();
    }
    if (soapService.targetNamespace != null && !"".equals(soapService.targetNamespace)) {
      axisService.setTargetNamespace(soapService.targetNamespace);
    }

    JMethod[] method = soapService.schemaGenerator.getMethods();
    PhasesInfo pinfo = axisConfiguration.getPhasesInfo();
    for (int i = 0; i < method.length; i++) {
      JMethod         jmethod   = method[i];
      AxisOperation   operation = axisService.getOperation(new QName(jmethod.getSimpleName()));
      String          mep       = operation.getMessageExchangePattern();
      MessageReceiver mr;

      if (messageReceiverClassMap != null) {       
        if (messageReceiverClassMap.get(mep) != null) {
          Object obj = messageReceiverClassMap.get(mep);
          if (obj instanceof MessageReceiver) {
            mr = (MessageReceiver) obj;
            operation.setMessageReceiver(mr);
          } else {
            Activator.log.error("Object is not an instance of MessageReceiver," +
                                " thus, default MessageReceiver has been set");
            mr = axisConfiguration
              .getMessageReceiver(operation.getMessageExchangePattern());
            operation.setMessageReceiver(mr);
          }
        } else {
          Activator.log.error("Required MessageReceiver couldn't be found," +
                              " thus, default MessageReceiver has been used");
          mr = axisConfiguration
            .getMessageReceiver(operation.getMessageExchangePattern());
          operation.setMessageReceiver(mr);
        }
      } else {
        Activator.log.error("MessageReceiverClassMap couldn't be found," +
                            " thus, default MessageReceiver has been used");
        mr = axisConfiguration.getMessageReceiver(operation.getMessageExchangePattern());
        operation.setMessageReceiver(mr);
      }
      pinfo.setOperationPhases(operation);
      axisService.addOperation(operation);
    }
    return axisService;
  }
View Full Code Here

Examples of org.apache.axis2.description.AxisService

    out.println("<h2>Registered services</h2>");
    out.println("<dl>");
    for(Iterator it = services.keySet().iterator(); it.hasNext(); ) {
      String      name = (String)it.next();
      AxisService as   = (AxisService)services.get(name);

      out.print("<dt>");
      out.println(name);
      out.println("" + wsdlLink(as));
      out.println("</dt>");
      out.print("<dd>");
      if(as instanceof OSGiAxisService) {
        SOAPService ss = ((OSGiAxisService)as).soapService;
        out.println("<ul>");
        out.println(" <li>bundle " +
                    "#" + ss.sr.getBundle().getBundleId() +
                    ", " + ss.sr.getBundle().getLocation() +
                    "</li>");
        out.println(" <li>service #" + ss.sr.getProperty(org.osgi.framework.Constants.SERVICE_ID) + ", " + ss.serviceClass);
        if(ss.schemaGenerator != null) {
          out.println("<ul>");
          JMethod[] methods = ss.schemaGenerator.getMethods();
          for(int i = 0; methods != null && i < methods.length; i++) {
            out.println("<li>" + methods[i].getQualifiedName() + "</li>");
          }
          out.println("</ul>");
        }
        out.println("</li>");
        out.println("</ul>");
      } else {
        out.println(as.getClass().getName() + " " + as);
      }
      out.println("</dd>");
    }
    out.println("</dl>");
View Full Code Here

Examples of org.apache.axis2.description.AxisService

    public void setFileName(String fileName) {
        this.fileName = fileName;
    }

    public void buildService(AxisConfiguration axisCfg) throws AxisFault {
        AxisService eventSourceService = new AxisService();
        eventSourceService.setName(this.name);
        // Add wse operations
        addOperations(eventSourceService);
        axisCfg.addService(eventSourceService);
        //Set the service parameters
        eventSourceService
                .addParameter(EventingConstants.SUBSCRIPTION_MANAGER, subscriptionManager);
        eventSourceService.addParameter(SynapseEventingConstants.SERVICE_TYPE,
                SynapseEventingConstants.EVENTING_ST);
    }
View Full Code Here

Examples of org.apache.axis2.description.AxisService

                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

Examples of org.apache.axis2.description.AxisService

    public static boolean mediateInMessage(Log log, MessageContext messageContext,
                                           org.apache.synapse.MessageContext synCtx)
            throws AxisFault {

        AxisService service = messageContext.getAxisService();
        if (service != null) {
            Parameter inMediationParam
                    = service.getParameter(HandlerConstants.IN_SEQUENCE_PARAM_NAME);
            if (inMediationParam != null && inMediationParam.getValue() != null) {
                if (inMediationParam.getValue() instanceof Mediator) {
                    Mediator inMessageSequence = (Mediator) inMediationParam.getValue();
                    return inMessageSequence.mediate(synCtx);
                } else if (inMediationParam.getValue() instanceof String) {
                    Mediator inMessageSequence = synCtx.getConfiguration().getSequence(
                            (String) inMediationParam.getValue());
                    return inMessageSequence.mediate(synCtx);
                } else {
                    if (log.isDebugEnabled()) {
                        log.debug("The provided in message mediation " +
                                "sequence is not a proper mediator");
                    }
                }
            } else {
                if (log.isDebugEnabled()) {
                    log.debug("Couldn't find the incoming mediation for the service "
                            + service.getName());
                }
            }
        } else {
            String message = "Couldn't find the Service for the associated message with id "
                    + messageContext.getMessageID();
View Full Code Here

Examples of org.apache.axis2.description.AxisService

    public static boolean mediateOutMessage(Log log, MessageContext messageContext,
                                           org.apache.synapse.MessageContext synCtx)
            throws AxisFault {

        AxisService service = messageContext.getAxisService();
        if (service != null) {
            Parameter inMediationParam
                    = service.getParameter(HandlerConstants.OUT_SEQUENCE_PARAM_NAME);
            if (inMediationParam != null && inMediationParam.getValue() != null) {
                if (inMediationParam.getValue() instanceof Mediator) {
                    Mediator inMessageSequence = (Mediator) inMediationParam.getValue();
                    return inMessageSequence.mediate(synCtx);
                } else if (inMediationParam.getValue() instanceof String) {
                    Mediator inMessageSequence = synCtx.getConfiguration().getSequence(
                            (String) inMediationParam.getValue());
                    return inMessageSequence.mediate(synCtx);
                } else {
                    if (log.isDebugEnabled()) {
                        log.debug("The provided out message mediation " +
                                "sequence is not a proper mediator");
                    }
                }
            } else {
                if (log.isDebugEnabled()) {
                    log.debug("Couldn't find the outgoing mediation for the service "
                            + service.getName());
                }
            }
        } else {
            String message = "Couldn't find the Service for the associated message with id "
                    + messageContext.getMessageID();
View Full Code Here

Examples of org.apache.axis2.description.AxisService

    public void testWSDLWithoutPublishWSDL() throws Exception {
        // Build the proxy service
        SynapseConfiguration synCfg = new SynapseConfiguration();
        AxisConfiguration axisCfg = new AxisConfiguration();
        ProxyService proxyService = new ProxyService("Test");
        AxisService axisService = proxyService.buildAxisService(synCfg, axisCfg);
        // Serialize the WSDL
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        axisService.printWSDL(baos);
        // Check that the produced WSDL can be read by WSDL4J
        WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
        wsdlReader.readWSDL(null, new InputSource(new ByteArrayInputStream(baos.toByteArray())));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.