public void invokeBusinessLogic(org.apache.axis2.context.MessageContext msgContext)
      throws org.apache.axis2.AxisFault {

    try {

      // get the implementation class for the Web Service
      Object obj = getTheImplementationObject(msgContext);

      MultitenancyThrottlingServiceSkeletonInterface skel =
          (MultitenancyThrottlingServiceSkeletonInterface) obj;
      // Out Envelop
      org.apache.axiom.soap.SOAPEnvelope envelope = null;
      // Find the axisOperation that has been set by the Dispatch phase.
      org.apache.axis2.description.AxisOperation op =
          msgContext.getOperationContext().getAxisOperation();
      if (op == null) {
        throw new org.apache.axis2.AxisFault(
            "Operation is not located, if this is doclit style the SOAP-ACTION should specified via the SOAP Action to use the RawXMLProvider");
      }

      java.lang.String methodName;
      if ((op.getName() != null)
          && ((methodName =
                  org.apache.axis2.util.JavaUtils.xmlNameToJavaIdentifier(
                      op.getName().getLocalPart()))
              != null)) {

        if ("executeThrottlingRules".equals(methodName)) {

          // doc style
          org.wso2.carbon.throttling.manager.services.ExecuteThrottlingRules wrappedParam =
              (org.wso2.carbon.throttling.manager.services.ExecuteThrottlingRules)
                  fromOM(
                      msgContext.getEnvelope().getBody().getFirstElement(),
                      org.wso2.carbon.throttling.manager.services.ExecuteThrottlingRules.class,
                      getEnvelopeNamespaces(msgContext.getEnvelope()));

          skel.executeThrottlingRules(wrappedParam);

          envelope = getSOAPFactory(msgContext).getDefaultEnvelope();

        } else {
          throw new java.lang.RuntimeException("method not found");
        }
      }
    } catch (MultitenancyThrottlingServiceExceptionException e) {
      msgContext.setProperty(
          org.apache.axis2.Constants.FAULT_NAME, "MultitenancyThrottlingServiceException");
      org.apache.axis2.AxisFault f = createAxisFault(e);
      if (e.getFaultMessage() != null) {
        f.setDetail(toOM(e.getFaultMessage(), false));
      }
      throw f;
    } catch (java.lang.Exception e) {
      throw org.apache.axis2.AxisFault.makeFault(e);
    }
  }
コード例 #2
0
ファイル: DBUtils.java プロジェクト: GayashanNA/carbon-data
 /** Creates an AxisFault. */
 public static AxisFault createAxisFault(Exception e) {
   AxisFault fault;
   Throwable cause = e.getCause();
   if (cause != null) {
     fault = new AxisFault(e.getMessage(), cause);
   } else {
     fault = new AxisFault(e.getMessage());
   }
   fault.setDetail(DataServiceFault.extractFaultMessage(e));
   fault.setFaultCode(
       new QName(DBConstants.WSO2_DS_NAMESPACE, DataServiceFault.extractFaultCode(e)));
   return fault;
 }
  public void invokeBusinessLogic(
      org.apache.axis2.context.MessageContext msgContext,
      org.apache.axis2.context.MessageContext newMsgContext)
      throws org.apache.axis2.AxisFault {

    try {

      // get the implementation class for the Web Service
      Object obj = getTheImplementationObject(msgContext);

      MultitenancyBillingServiceSkeletonInterface skel =
          (MultitenancyBillingServiceSkeletonInterface) obj;
      // Out Envelop
      org.apache.axiom.soap.SOAPEnvelope envelope = null;
      // Find the axisOperation that has been set by the Dispatch phase.
      org.apache.axis2.description.AxisOperation op =
          msgContext.getOperationContext().getAxisOperation();
      if (op == null) {
        throw new org.apache.axis2.AxisFault(
            "Operation is not located, if this is doclit style the SOAP-ACTION should specified via the SOAP Action to use the RawXMLProvider");
      }

      java.lang.String methodName;
      if ((op.getName() != null)
          && ((methodName =
                  org.apache.axis2.util.JavaUtils.xmlNameToJavaIdentifier(
                      op.getName().getLocalPart()))
              != null)) {

        if ("getOutstandingBalance".equals(methodName)) {

          org.wso2.carbon.billing.mgt.services.GetOutstandingBalanceResponse
              getOutstandingBalanceResponse13 = null;
          org.wso2.carbon.billing.mgt.services.GetOutstandingBalance wrappedParam =
              (org.wso2.carbon.billing.mgt.services.GetOutstandingBalance)
                  fromOM(
                      msgContext.getEnvelope().getBody().getFirstElement(),
                      org.wso2.carbon.billing.mgt.services.GetOutstandingBalance.class,
                      getEnvelopeNamespaces(msgContext.getEnvelope()));

          getOutstandingBalanceResponse13 = skel.getOutstandingBalance(wrappedParam);

          envelope =
              toEnvelope(
                  getSOAPFactory(msgContext),
                  getOutstandingBalanceResponse13,
                  false,
                  new javax.xml.namespace.QName(
                      "http://services.mgt.billing.carbon.wso2.org", "getOutstandingBalance"));
        } else if ("getCurrentInvoice".equals(methodName)) {

          org.wso2.carbon.billing.mgt.services.GetCurrentInvoiceResponse
              getCurrentInvoiceResponse15 = null;
          org.wso2.carbon.billing.mgt.services.GetCurrentInvoice wrappedParam =
              (org.wso2.carbon.billing.mgt.services.GetCurrentInvoice)
                  fromOM(
                      msgContext.getEnvelope().getBody().getFirstElement(),
                      org.wso2.carbon.billing.mgt.services.GetCurrentInvoice.class,
                      getEnvelopeNamespaces(msgContext.getEnvelope()));

          getCurrentInvoiceResponse15 = skel.getCurrentInvoice(wrappedParam);

          envelope =
              toEnvelope(
                  getSOAPFactory(msgContext),
                  getCurrentInvoiceResponse15,
                  false,
                  new javax.xml.namespace.QName(
                      "http://services.mgt.billing.carbon.wso2.org", "getCurrentInvoice"));
        } else if ("getPastInvoice".equals(methodName)) {

          org.wso2.carbon.billing.mgt.services.GetPastInvoiceResponse getPastInvoiceResponse17 =
              null;
          org.wso2.carbon.billing.mgt.services.GetPastInvoice wrappedParam =
              (org.wso2.carbon.billing.mgt.services.GetPastInvoice)
                  fromOM(
                      msgContext.getEnvelope().getBody().getFirstElement(),
                      org.wso2.carbon.billing.mgt.services.GetPastInvoice.class,
                      getEnvelopeNamespaces(msgContext.getEnvelope()));

          getPastInvoiceResponse17 = skel.getPastInvoice(wrappedParam);

          envelope =
              toEnvelope(
                  getSOAPFactory(msgContext),
                  getPastInvoiceResponse17,
                  false,
                  new javax.xml.namespace.QName(
                      "http://services.mgt.billing.carbon.wso2.org", "getPastInvoice"));
        } else if ("addPayment".equals(methodName)) {

          org.wso2.carbon.billing.mgt.services.AddPaymentResponse addPaymentResponse19 = null;
          org.wso2.carbon.billing.mgt.services.AddPayment wrappedParam =
              (org.wso2.carbon.billing.mgt.services.AddPayment)
                  fromOM(
                      msgContext.getEnvelope().getBody().getFirstElement(),
                      org.wso2.carbon.billing.mgt.services.AddPayment.class,
                      getEnvelopeNamespaces(msgContext.getEnvelope()));

          addPaymentResponse19 = skel.addPayment(wrappedParam);

          envelope =
              toEnvelope(
                  getSOAPFactory(msgContext),
                  addPaymentResponse19,
                  false,
                  new javax.xml.namespace.QName(
                      "http://services.mgt.billing.carbon.wso2.org", "addPayment"));
        } else if ("getAvailableBillingPeriods".equals(methodName)) {

          org.wso2.carbon.billing.mgt.services.GetAvailableBillingPeriodsResponse
              getAvailableBillingPeriodsResponse21 = null;
          org.wso2.carbon.billing.mgt.services.GetAvailableBillingPeriods wrappedParam =
              (org.wso2.carbon.billing.mgt.services.GetAvailableBillingPeriods)
                  fromOM(
                      msgContext.getEnvelope().getBody().getFirstElement(),
                      org.wso2.carbon.billing.mgt.services.GetAvailableBillingPeriods.class,
                      getEnvelopeNamespaces(msgContext.getEnvelope()));

          getAvailableBillingPeriodsResponse21 = skel.getAvailableBillingPeriods(wrappedParam);

          envelope =
              toEnvelope(
                  getSOAPFactory(msgContext),
                  getAvailableBillingPeriodsResponse21,
                  false,
                  new javax.xml.namespace.QName(
                      "http://services.mgt.billing.carbon.wso2.org", "getAvailableBillingPeriods"));
        } else if ("getPaginatedBalances".equals(methodName)) {

          org.wso2.carbon.billing.mgt.services.GetPaginatedBalancesResponse
              getPaginatedBalancesResponse23 = null;
          org.wso2.carbon.billing.mgt.services.GetPaginatedBalances wrappedParam =
              (org.wso2.carbon.billing.mgt.services.GetPaginatedBalances)
                  fromOM(
                      msgContext.getEnvelope().getBody().getFirstElement(),
                      org.wso2.carbon.billing.mgt.services.GetPaginatedBalances.class,
                      getEnvelopeNamespaces(msgContext.getEnvelope()));

          getPaginatedBalancesResponse23 = skel.getPaginatedBalances(wrappedParam);

          envelope =
              toEnvelope(
                  getSOAPFactory(msgContext),
                  getPaginatedBalancesResponse23,
                  false,
                  new javax.xml.namespace.QName(
                      "http://services.mgt.billing.carbon.wso2.org", "getPaginatedBalances"));

        } else {
          throw new java.lang.RuntimeException("method not found");
        }

        newMsgContext.setEnvelope(envelope);
      }
    } catch (MultitenancyBillingServiceExceptionException e) {

      msgContext.setProperty(
          org.apache.axis2.Constants.FAULT_NAME, "MultitenancyBillingServiceException");
      org.apache.axis2.AxisFault f = createAxisFault(e);
      if (e.getFaultMessage() != null) {
        f.setDetail(toOM(e.getFaultMessage(), false));
      }
      throw f;
    } catch (java.lang.Exception e) {
      throw org.apache.axis2.AxisFault.makeFault(e);
    }
  }