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); } }
private Object convertValue(String value, String type) { if (type == null) { // If no type is set we simply return the string value return value; } try { XMLConfigConstants.DATA_TYPES dataType = XMLConfigConstants.DATA_TYPES.valueOf(type); switch (dataType) { case BOOLEAN: return JavaUtils.isTrueExplicitly(value); case DOUBLE: return Double.parseDouble(value); case FLOAT: return Float.parseFloat(value); case INTEGER: return Integer.parseInt(value); case LONG: return Long.parseLong(value); case OM: return SynapseConfigUtils.stringToOM(value); case SHORT: return Short.parseShort(value); default: return value; } } catch (IllegalArgumentException e) { String msg = "Unknown type : " + type + " for the property mediator or the " + "property value cannot be converted into the specified type."; log.error(msg, e); throw new SynapseException(msg, e); } }
/** * Populates service from corresponding OM. * * @param service_element an OMElement for the <service> tag * @return a filled-in AxisService, configured from the passed XML * @throws DeploymentException if there is a problem */ public AxisService populateService(OMElement service_element) throws DeploymentException { try { // Determine whether service should be activated. String serviceActivate = service_element.getAttributeValue(new QName(ATTRIBUTE_ACTIVATE)); if (serviceActivate != null) { if ("true".equals(serviceActivate)) { service.setActive(true); } else if ("false".equals(serviceActivate)) { service.setActive(false); } } // Processing service level parameters OMAttribute serviceNameatt = service_element.getAttribute(new QName(ATTRIBUTE_NAME)); // If the service name is explicitly specified in the services.xml // then use that as the service name if (serviceNameatt != null) { if (!"".equals(serviceNameatt.getAttributeValue().trim())) { AxisService wsdlService = wsdlServiceMap.get(serviceNameatt.getAttributeValue()); if (wsdlService != null) { wsdlService.setClassLoader(service.getClassLoader()); wsdlService.setParent(service.getAxisServiceGroup()); service = wsdlService; service.setWsdlFound(true); service.setCustomWsdl(true); } service.setName(serviceNameatt.getAttributeValue()); // To be on the safe side if (service.getDocumentation() == null) { service.setDocumentation(serviceNameatt.getAttributeValue()); } } } Iterator itr = service_element.getChildrenWithName(new QName(TAG_PARAMETER)); processParameters(itr, service, service.getParent()); Parameter childFirstClassLoading = service.getParameter(Constants.Configuration.ENABLE_CHILD_FIRST_CLASS_LOADING); if (childFirstClassLoading != null) { ClassLoader cl = service.getClassLoader(); if (cl instanceof DeploymentClassLoader) { DeploymentClassLoader deploymentClassLoader = (DeploymentClassLoader) cl; if (JavaUtils.isTrueExplicitly(childFirstClassLoading.getValue())) { deploymentClassLoader.setChildFirstClassLoading(true); } else if (JavaUtils.isFalseExplicitly(childFirstClassLoading.getValue())) { deploymentClassLoader.setChildFirstClassLoading(false); } } } // If multiple services in one service group have different values // for the PARENT_FIRST // parameter then the final value become the value specified by the // last service in the group // Parameter parameter = // service.getParameter(DeploymentClassLoader.PARENT_FIRST); // if (parameter !=null && "false".equals(parameter.getValue())) { // ClassLoader serviceClassLoader = service.getClassLoader(); // ((DeploymentClassLoader)serviceClassLoader).setParentFirst(false); // } // process service description OMElement descriptionElement = service_element.getFirstChildWithName(new QName(TAG_DESCRIPTION)); if (descriptionElement != null) { OMElement descriptionValue = descriptionElement.getFirstElement(); if (descriptionValue != null) { service.setDocumentation(descriptionValue); } else { service.setDocumentation(descriptionElement.getText()); } } else { serviceNameatt = service_element.getAttribute(new QName(ATTRIBUTE_NAME)); if (serviceNameatt != null) { if (!"".equals(serviceNameatt.getAttributeValue().trim()) && service.getDocumentation() == null) { service.setDocumentation(serviceNameatt.getAttributeValue()); } } } if (service.getParameter("ServiceClass") == null) { log.debug("The Service " + service.getName() + " does not specify a Service Class"); } // Process WS-Addressing flag attribute OMAttribute addressingRequiredatt = service_element.getAttribute(new QName(ATTRIBUTE_WSADDRESSING)); if (addressingRequiredatt != null) { String addressingRequiredString = addressingRequiredatt.getAttributeValue(); AddressingHelper.setAddressingRequirementParemeterValue(service, addressingRequiredString); } // Setting service target namespace if any OMAttribute targetNameSpace = service_element.getAttribute(new QName(TARGET_NAME_SPACE)); if (targetNameSpace != null) { String nameSpeceVale = targetNameSpace.getAttributeValue(); if (nameSpeceVale != null && !"".equals(nameSpeceVale)) { service.setTargetNamespace(nameSpeceVale); } } else { if (service.getTargetNamespace() == null || "".equals(service.getTargetNamespace())) { service.setTargetNamespace(Java2WSDLConstants.DEFAULT_TARGET_NAMESPACE); } } // Processing service lifecycle attribute OMAttribute serviceLifeCycleClass = service_element.getAttribute(new QName(TAG_CLASS_NAME)); if (serviceLifeCycleClass != null) { String className = serviceLifeCycleClass.getAttributeValue(); loadServiceLifeCycleClass(className); } // Setting schema namespece if any OMElement schemaElement = service_element.getFirstChildWithName(new QName(SCHEMA)); if (schemaElement != null) { OMAttribute schemaNameSpace = schemaElement.getAttribute(new QName(SCHEMA_NAME_SPACE)); if (schemaNameSpace != null) { String nameSpeceVale = schemaNameSpace.getAttributeValue(); if (nameSpeceVale != null && !"".equals(nameSpeceVale)) { service.setSchemaTargetNamespace(nameSpeceVale); } } OMAttribute elementFormDefault = schemaElement.getAttribute(new QName(SCHEMA_ELEMENT_QUALIFIED)); if (elementFormDefault != null) { String value = elementFormDefault.getAttributeValue(); if ("true".equals(value)) { service.setElementFormDefault(true); } else if ("false".equals(value)) { service.setElementFormDefault(false); } } // package to namespace mapping. This will be an element that // maps pkg names to a namespace // when this is doing AxisService.getSchemaTargetNamespace will // be overridden // This will be <mapping/> with @namespace and @package Iterator mappingIterator = schemaElement.getChildrenWithName(new QName(MAPPING)); if (mappingIterator != null) { Map<String, String> pkg2nsMap = new Hashtable<String, String>(); while (mappingIterator.hasNext()) { OMElement mappingElement = (OMElement) mappingIterator.next(); OMAttribute namespaceAttribute = mappingElement.getAttribute(new QName(ATTRIBUTE_NAMESPACE)); OMAttribute packageAttribute = mappingElement.getAttribute(new QName(ATTRIBUTE_PACKAGE)); if (namespaceAttribute != null && packageAttribute != null) { String namespaceAttributeValue = namespaceAttribute.getAttributeValue(); String packageAttributeValue = packageAttribute.getAttributeValue(); if (namespaceAttributeValue != null && packageAttributeValue != null) { pkg2nsMap.put(packageAttributeValue.trim(), namespaceAttributeValue.trim()); } else { log.warn( "Either value of @namespce or @packagename not available. Thus, generated will be selected."); } } else { log.warn( "Either @namespce or @packagename not available. Thus, generated will be selected."); } } service.setP2nMap(pkg2nsMap); } } // processing Default Message receivers OMElement messageReceiver = service_element.getFirstChildWithName(new QName(TAG_MESSAGE_RECEIVERS)); if (messageReceiver != null) { HashMap<String, MessageReceiver> mrs = processMessageReceivers(service.getClassLoader(), messageReceiver); for (Map.Entry<String, MessageReceiver> entry : mrs.entrySet()) { service.addMessageReceiver(entry.getKey(), entry.getValue()); } } // Removing exclude operations OMElement excludeOperations = service_element.getFirstChildWithName(new QName(TAG_EXCLUDE_OPERATIONS)); ArrayList<String> excludeops = null; if (excludeOperations != null) { excludeops = processExcludeOperations(excludeOperations); } if (excludeops == null) { excludeops = new ArrayList<String>(); } Utils.addExcludeMethods(excludeops); // <schema targetNamespace="http://x.y.z"/> // setting the PolicyInclude // processing <wsp:Policy> .. </..> elements Iterator policyElements = service_element.getChildrenWithName(new QName(POLICY_NS_URI, TAG_POLICY)); if (policyElements != null && policyElements.hasNext()) { processPolicyElements(policyElements, service.getPolicySubject()); } // processing <wsp:PolicyReference> .. </..> elements Iterator policyRefElements = service_element.getChildrenWithName(new QName(POLICY_NS_URI, TAG_POLICY_REF)); if (policyRefElements != null && policyRefElements.hasNext()) { processPolicyRefElements(policyRefElements, service.getPolicySubject()); } // processing service scope String sessionScope = service_element.getAttributeValue(new QName(ATTRIBUTE_SCOPE)); if (sessionScope != null) { service.setScope(sessionScope); } // processing service-wide modules which required to engage globally Iterator moduleRefs = service_element.getChildrenWithName(new QName(TAG_MODULE)); processModuleRefs(moduleRefs); // processing transports OMElement transports = service_element.getFirstChildWithName(new QName(TAG_TRANSPORTS)); if (transports != null) { Iterator transport_itr = transports.getChildrenWithName(new QName(TAG_TRANSPORT)); ArrayList<String> trs = new ArrayList<String>(); while (transport_itr.hasNext()) { OMElement trsEle = (OMElement) transport_itr.next(); String transportName = trsEle.getText().trim(); if (axisConfig.getTransportIn(transportName) == null) { log.warn( "Service [ " + service.getName() + "] is trying to expose in a transport : " + transportName + " and which is not available in Axis2"); } else { trs.add(transportName); } } if (trs.isEmpty()) { throw new AxisFault( "Service [" + service.getName() + "] is trying expose in tranpsorts: " + transports + " and which is/are not available in Axis2"); } service.setExposedTransports(trs); } // processing operations Iterator operationsIterator = service_element.getChildrenWithName(new QName(TAG_OPERATION)); ArrayList ops = processOperations(operationsIterator); for (int i = 0; i < ops.size(); i++) { AxisOperation operationDesc = (AxisOperation) ops.get(i); ArrayList wsamappings = operationDesc.getWSAMappingList(); if (wsamappings == null) { continue; } if (service.getOperation(operationDesc.getName()) == null) { service.addOperation(operationDesc); } for (int j = 0; j < wsamappings.size(); j++) { String mapping = (String) wsamappings.get(j); if (mapping.length() > 0) { service.mapActionToOperation(mapping, operationDesc); } } } String objectSupplierValue = (String) service.getParameterValue(TAG_OBJECT_SUPPLIER); if (objectSupplierValue != null) { loadObjectSupplierClass(objectSupplierValue); } // Set the default message receiver for the operations that were // not listed in the services.xml setDefaultMessageReceivers(); Utils.processBeanPropertyExclude(service); if (!service.isUseUserWSDL()) { // Generating schema for the service if the impl class is Java if (!service.isWsdlFound()) { // trying to generate WSDL for the service using JAM and // Java reflection try { if (generateWsdl(service)) { Utils.fillAxisService(service, axisConfig, excludeops, null); } else { ArrayList nonRpcOperations = getNonRPCMethods(service); Utils.fillAxisService(service, axisConfig, excludeops, nonRpcOperations); } } catch (Exception e) { throw new DeploymentException( Messages.getMessage("errorinschemagen", e.getMessage()), e); } } } if (service.isCustomWsdl()) { OMElement mappingElement = service_element.getFirstChildWithName(new QName(TAG_PACKAGE2QNAME)); if (mappingElement != null) { processTypeMappings(mappingElement); } } for (String opName : excludeops) { service.removeOperation(new QName(opName)); } // Need to call the same logic towice setDefaultMessageReceivers(); Iterator moduleConfigs = service_element.getChildrenWithName(new QName(TAG_MODULE_CONFIG)); processServiceModuleConfig(moduleConfigs, service, service); // Loading Data Locator(s) configured OMElement dataLocatorElement = service_element.getFirstChildWithName(new QName(DRConstants.DATA_LOCATOR_ELEMENT)); if (dataLocatorElement != null) { processDataLocatorConfig(dataLocatorElement, service); } processEndpoints(service); processPolicyAttachments(service_element, service); } catch (AxisFault axisFault) { throw new DeploymentException(axisFault); } startupServiceLifecycle(); return service; }
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); SiteSkeletonInterface skel = (SiteSkeletonInterface) 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 ("passInfo".equals(methodName)) { org.example.www.site.PassInfoResponse passInfoResponse9 = null; org.example.www.site.PassInfo wrappedParam = (org.example.www.site.PassInfo) fromOM( msgContext.getEnvelope().getBody().getFirstElement(), org.example.www.site.PassInfo.class, getEnvelopeNamespaces(msgContext.getEnvelope())); passInfoResponse9 = skel.passInfo(wrappedParam); envelope = toEnvelope(getSOAPFactory(msgContext), passInfoResponse9, false); } else if ("searchSite".equals(methodName)) { org.example.www.site.SearchSiteResponse searchSiteResponse11 = null; org.example.www.site.SearchSite wrappedParam = (org.example.www.site.SearchSite) fromOM( msgContext.getEnvelope().getBody().getFirstElement(), org.example.www.site.SearchSite.class, getEnvelopeNamespaces(msgContext.getEnvelope())); searchSiteResponse11 = skel.searchSite(wrappedParam); envelope = toEnvelope(getSOAPFactory(msgContext), searchSiteResponse11, false); } else if ("getSite".equals(methodName)) { org.example.www.site.GetSiteResponse getSiteResponse13 = null; org.example.www.site.GetSite wrappedParam = (org.example.www.site.GetSite) fromOM( msgContext.getEnvelope().getBody().getFirstElement(), org.example.www.site.GetSite.class, getEnvelopeNamespaces(msgContext.getEnvelope())); getSiteResponse13 = skel.getSite(wrappedParam); envelope = toEnvelope(getSOAPFactory(msgContext), getSiteResponse13, false); } else if ("parallelInfo".equals(methodName)) { org.example.www.site.ParallelInfoResponse parallelInfoResponse15 = null; org.example.www.site.ParallelInfo wrappedParam = (org.example.www.site.ParallelInfo) fromOM( msgContext.getEnvelope().getBody().getFirstElement(), org.example.www.site.ParallelInfo.class, getEnvelopeNamespaces(msgContext.getEnvelope())); parallelInfoResponse15 = skel.parallelInfo(wrappedParam); envelope = toEnvelope(getSOAPFactory(msgContext), parallelInfoResponse15, false); } else { throw new java.lang.RuntimeException("method not found"); } newMsgContext.setEnvelope(envelope); } } catch (java.lang.Exception e) { throw org.apache.axis2.AxisFault.makeFault(e); } }
public void send(MessageContext synCtx) { logSetter(); Integer statisticReportingIndex = null; boolean isStatisticsEnabled = RuntimeStatisticCollector.isStatisticsEnabled(); if (isStatisticsEnabled) { statisticReportingIndex = OpenEventCollector.reportEntryEvent( synCtx, getReportingName(), definition.getAspectConfiguration(), ComponentType.ENDPOINT); } boolean traceOn = isTraceOn(synCtx); boolean traceOrDebugOn = isTraceOrDebugOn(traceOn); if (!initialized) { // can't send to a non-initialized endpoint. This is a program fault throw new IllegalStateException( "not initialized, " + "endpoint must be in initialized state"); } prepareForEndpointStatistics(synCtx); if (traceOrDebugOn) { String address = definition.getAddress(); if (address == null && synCtx.getTo() != null && synCtx.getTo().getAddress() != null) { // compute address for the default endpoint only for logging purposes address = synCtx.getTo().getAddress(); } traceOrDebug( traceOn, "Sending message through endpoint : " + getName() + " resolving to address = " + address); traceOrDebug( traceOn, "SOAPAction: " + (synCtx.getSoapAction() != null ? synCtx.getSoapAction() : "null")); traceOrDebug( traceOn, "WSA-Action: " + (synCtx.getWSAAction() != null ? synCtx.getWSAAction() : "null")); if (traceOn && trace.isTraceEnabled()) { trace.trace("Envelope : \n" + synCtx.getEnvelope()); } } // push the errorHandler sequence into the current message as the fault handler if (errorHandler != null) { Mediator errorHandlerMediator = synCtx.getSequence(errorHandler); if (errorHandlerMediator != null) { if (traceOrDebugOn) { traceOrDebug( traceOn, "Setting the onError handler : " + errorHandler + " for the endpoint : " + endpointName); } synCtx.pushFaultHandler(new MediatorFaultHandler(errorHandlerMediator)); } else { log.warn( "onError handler sequence : " + errorHandler + " for : " + endpointName + " cannot be found"); } } // register this as the immediate fault handler for this message. synCtx.pushFaultHandler(this); // add this as the last endpoint to process this message - used by statistics counting code synCtx.setProperty(SynapseConstants.LAST_ENDPOINT, this); // set message level metrics collector org.apache.axis2.context.MessageContext axis2Ctx = ((Axis2MessageContext) synCtx).getAxis2MessageContext(); axis2Ctx.setProperty(BaseConstants.METRICS_COLLECTOR, metricsMBean); if (contentAware) { try { RelayUtils.buildMessage(((Axis2MessageContext) synCtx).getAxis2MessageContext(), false); axis2Ctx.setProperty(RelayConstants.FORCE_RESPONSE_EARLY_BUILD, Boolean.TRUE); if (forceBuildMC) { ((Axis2MessageContext) synCtx).getAxis2MessageContext().getEnvelope().build(); } } catch (Exception e) { handleException("Error while building message", e); } } evaluateProperties(synCtx); // if the envelope preserving set build the envelope MediatorProperty preserveEnv = getProperty(SynapseConstants.PRESERVE_ENVELOPE); if (preserveEnv != null && JavaUtils.isTrueExplicitly( preserveEnv.getValue() != null ? preserveEnv.getValue() : preserveEnv.getEvaluatedExpression(synCtx))) { if (traceOrDebugOn) { traceOrDebug( traceOn, "Preserving the envelope by building it before " + "sending, since it is explicitly set"); } synCtx.getEnvelope().build(); } // Send the message through this endpoint synCtx.getEnvironment().send(definition, synCtx); if (isStatisticsEnabled) { CloseEventCollector.closeEntryEvent( synCtx, getReportingName(), ComponentType.ENDPOINT, statisticReportingIndex, false); } }
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); GSNWebServiceSkeleton skel = (GSNWebServiceSkeleton) 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.xmlNameToJava(op.getName().getLocalPart())) != null)) { if ("getVirtualSensorsDetails".equals(methodName)) { gsn.webservice.standard.GetVirtualSensorsDetailsResponse getVirtualSensorsDetailsResponse1 = null; gsn.webservice.standard.GetVirtualSensorsDetails wrappedParam = (gsn.webservice.standard.GetVirtualSensorsDetails) fromOM( msgContext.getEnvelope().getBody().getFirstElement(), gsn.webservice.standard.GetVirtualSensorsDetails.class, getEnvelopeNamespaces(msgContext.getEnvelope())); getVirtualSensorsDetailsResponse1 = skel.getVirtualSensorsDetails(wrappedParam); envelope = toEnvelope(getSOAPFactory(msgContext), getVirtualSensorsDetailsResponse1, false); } else if ("getNextData".equals(methodName)) { gsn.webservice.standard.GetNextDataResponse getNextDataResponse3 = null; gsn.webservice.standard.GetNextData wrappedParam = (gsn.webservice.standard.GetNextData) fromOM( msgContext.getEnvelope().getBody().getFirstElement(), gsn.webservice.standard.GetNextData.class, getEnvelopeNamespaces(msgContext.getEnvelope())); getNextDataResponse3 = skel.getNextData(wrappedParam); envelope = toEnvelope(getSOAPFactory(msgContext), getNextDataResponse3, false); } else if ("listWrapperURLs".equals(methodName)) { gsn.webservice.standard.ListWrapperURLsResponse listWrapperURLsResponse5 = null; gsn.webservice.standard.ListWrapperURLs wrappedParam = (gsn.webservice.standard.ListWrapperURLs) fromOM( msgContext.getEnvelope().getBody().getFirstElement(), gsn.webservice.standard.ListWrapperURLs.class, getEnvelopeNamespaces(msgContext.getEnvelope())); listWrapperURLsResponse5 = skel.listWrapperURLs(wrappedParam); envelope = toEnvelope(getSOAPFactory(msgContext), listWrapperURLsResponse5, false); } else if ("getLatestMultiData".equals(methodName)) { gsn.webservice.standard.GetLatestMultiDataResponse getLatestMultiDataResponse7 = null; gsn.webservice.standard.GetLatestMultiData wrappedParam = (gsn.webservice.standard.GetLatestMultiData) fromOM( msgContext.getEnvelope().getBody().getFirstElement(), gsn.webservice.standard.GetLatestMultiData.class, getEnvelopeNamespaces(msgContext.getEnvelope())); getLatestMultiDataResponse7 = skel.getLatestMultiData(wrappedParam); envelope = toEnvelope(getSOAPFactory(msgContext), getLatestMultiDataResponse7, false); } else if ("unregisterQuery".equals(methodName)) { gsn.webservice.standard.UnregisterQueryResponse unregisterQueryResponse9 = null; gsn.webservice.standard.UnregisterQuery wrappedParam = (gsn.webservice.standard.UnregisterQuery) fromOM( msgContext.getEnvelope().getBody().getFirstElement(), gsn.webservice.standard.UnregisterQuery.class, getEnvelopeNamespaces(msgContext.getEnvelope())); unregisterQueryResponse9 = skel.unregisterQuery(wrappedParam); envelope = toEnvelope(getSOAPFactory(msgContext), unregisterQueryResponse9, false); } else if ("createVirtualSensor".equals(methodName)) { gsn.webservice.standard.CreateVirtualSensorResponse createVirtualSensorResponse11 = null; gsn.webservice.standard.CreateVirtualSensor wrappedParam = (gsn.webservice.standard.CreateVirtualSensor) fromOM( msgContext.getEnvelope().getBody().getFirstElement(), gsn.webservice.standard.CreateVirtualSensor.class, getEnvelopeNamespaces(msgContext.getEnvelope())); createVirtualSensorResponse11 = skel.createVirtualSensor(wrappedParam); envelope = toEnvelope(getSOAPFactory(msgContext), createVirtualSensorResponse11, false); } else if ("getMultiData".equals(methodName)) { gsn.webservice.standard.GetMultiDataResponse getMultiDataResponse13 = null; gsn.webservice.standard.GetMultiData wrappedParam = (gsn.webservice.standard.GetMultiData) fromOM( msgContext.getEnvelope().getBody().getFirstElement(), gsn.webservice.standard.GetMultiData.class, getEnvelopeNamespaces(msgContext.getEnvelope())); getMultiDataResponse13 = skel.getMultiData(wrappedParam); envelope = toEnvelope(getSOAPFactory(msgContext), getMultiDataResponse13, false); } else if ("registerQuery".equals(methodName)) { gsn.webservice.standard.RegisterQueryResponse registerQueryResponse15 = null; gsn.webservice.standard.RegisterQuery wrappedParam = (gsn.webservice.standard.RegisterQuery) fromOM( msgContext.getEnvelope().getBody().getFirstElement(), gsn.webservice.standard.RegisterQuery.class, getEnvelopeNamespaces(msgContext.getEnvelope())); registerQueryResponse15 = skel.registerQuery(wrappedParam); envelope = toEnvelope(getSOAPFactory(msgContext), registerQueryResponse15, false); } else if ("getContainerInfo".equals(methodName)) { gsn.webservice.standard.GetContainerInfoResponse getContainerInfoResponse17 = null; gsn.webservice.standard.GetContainerInfo wrappedParam = (gsn.webservice.standard.GetContainerInfo) fromOM( msgContext.getEnvelope().getBody().getFirstElement(), gsn.webservice.standard.GetContainerInfo.class, getEnvelopeNamespaces(msgContext.getEnvelope())); getContainerInfoResponse17 = skel.getContainerInfo(wrappedParam); envelope = toEnvelope(getSOAPFactory(msgContext), getContainerInfoResponse17, false); } else if ("listVirtualSensorNames".equals(methodName)) { gsn.webservice.standard.ListVirtualSensorNamesResponse listVirtualSensorNamesResponse19 = null; gsn.webservice.standard.ListVirtualSensorNames wrappedParam = (gsn.webservice.standard.ListVirtualSensorNames) fromOM( msgContext.getEnvelope().getBody().getFirstElement(), gsn.webservice.standard.ListVirtualSensorNames.class, getEnvelopeNamespaces(msgContext.getEnvelope())); listVirtualSensorNamesResponse19 = skel.listVirtualSensorNames(wrappedParam); envelope = toEnvelope(getSOAPFactory(msgContext), listVirtualSensorNamesResponse19, false); } else if ("deleteVirtualSensor".equals(methodName)) { gsn.webservice.standard.DeleteVirtualSensorResponse deleteVirtualSensorResponse21 = null; gsn.webservice.standard.DeleteVirtualSensor wrappedParam = (gsn.webservice.standard.DeleteVirtualSensor) fromOM( msgContext.getEnvelope().getBody().getFirstElement(), gsn.webservice.standard.DeleteVirtualSensor.class, getEnvelopeNamespaces(msgContext.getEnvelope())); deleteVirtualSensorResponse21 = skel.deleteVirtualSensor(wrappedParam); envelope = toEnvelope(getSOAPFactory(msgContext), deleteVirtualSensorResponse21, false); } else { throw new java.lang.RuntimeException("method not found"); } newMsgContext.setEnvelope(envelope); } } catch (java.lang.Exception e) { throw org.apache.axis2.AxisFault.makeFault(e); } }
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); } }