/** * Expose this service only via the specified transport * * @param serviceId service name * @param transportProtocols transport protocols to expose * @throws AxisFault axisfault * @throws org.wso2.carbon.security.SecurityConfigException ex */ public void setServiceTransports(String serviceId, List<String> transportProtocols) throws SecurityConfigException, AxisFault { AxisService axisService = axisConfig.getServiceForActivation(serviceId); if (axisService == null) { throw new SecurityConfigException("nullService"); } List<String> transports = new ArrayList<>(); for (int i = 0; i < transportProtocols.size(); i++) { transports.add(transportProtocols.get(i)); } axisService.setExposedTransports(transports); if (log.isDebugEnabled()) { log.debug("Successfully add selected transport bindings to service " + serviceId); } }
/** * Expose this service only via the specified transport * * @param serviceId service name * @param transportProtocols transport protocols to expose * @throws AxisFault axisfault * @throws org.wso2.carbon.security.SecurityConfigException ex */ public void setServiceTransports(String serviceId, List<String> transportProtocols) throws SecurityConfigException, AxisFault { AxisService axisService = axisConfig.getServiceForActivation(serviceId); if (axisService == null) { throw new SecurityConfigException("nullService"); } List<String> transports = new ArrayList<>(); for (int i = 0; i < transportProtocols.size(); i++) { transports.add(transportProtocols.get(i)); } axisService.setExposedTransports(transports); if (log.isDebugEnabled()) { log.debug("Successfully add selected transport bindings to service " + serviceId); } }
/** * Expose this service only via the specified transport * * @param serviceId service name * @param transportProtocols transport protocols to expose * @throws AxisFault axisfault * @throws org.wso2.carbon.security.SecurityConfigException ex */ public void setServiceTransports(String serviceId, List<String> transportProtocols) throws SecurityConfigException, AxisFault { AxisService axisService = axisConfig.getServiceForActivation(serviceId); if (axisService == null) { throw new SecurityConfigException("nullService"); } List<String> transports = new ArrayList<>(); for (int i = 0; i < transportProtocols.size(); i++) { transports.add(transportProtocols.get(i)); } axisService.setExposedTransports(transports); if (log.isDebugEnabled()) { log.debug("Successfully add selected transport bindings to service " + serviceId); } }
/** * This method checks if the given data service has a corresponding "services.xml" is available, * if so, the AxisService representing the data service is applied the instructions from its * "services.xml". */ private AxisService handleTransports(DeploymentFileData file, AxisService axisService) throws DataServiceFault { try (FileInputStream fis = new FileInputStream(file.getFile().getAbsoluteFile())) { StAXOMBuilder builder = new StAXOMBuilder(fis); OMElement documentElement = builder.getDocumentElement(); OMAttribute transports = documentElement.getAttribute(new QName(DBSFields.TRANSPORTS)); if (transports != null) { String [] transportArr = transports.getAttributeValue().split(" "); axisService.setExposedTransports(Arrays.asList(transportArr)); } } catch (Exception e) { throw new DataServiceFault(e, "Error in processing transports info"); } return axisService; }
public void disableTransportForService(AxisService service) { log.warn("Disabling the " + getTransportName() + " transport for the service " + service.getName() + ", because it is not configured properly for the service"); if (service.isEnableAllTransports()) { ArrayList<String> exposedTransports = new ArrayList<String>(); for(Object obj: cfgCtx.getAxisConfiguration().getTransportsIn().values()) { String transportName = ((TransportInDescription) obj).getName(); if (!transportName.equals(getTransportName())) { exposedTransports.add(transportName); } } service.setEnableAllTransports(false); service.setExposedTransports(exposedTransports); } else { service.removeExposedTransport(getTransportName()); } }
public void disableTransportForService(AxisService service) { log.warn("Disabling the " + getTransportName() + " transport for the service " + service.getName() + ", because it is not configured properly for the service"); if (service.isEnableAllTransports()) { ArrayList<String> exposedTransports = new ArrayList<String>(); for(Object obj: cfgCtx.getAxisConfiguration().getTransportsIn().values()) { String transportName = ((TransportInDescription) obj).getName(); if (!transportName.equals(getTransportName())) { exposedTransports.add(transportName); } } service.setEnableAllTransports(false); service.setExposedTransports(exposedTransports); } else { service.removeExposedTransport(getTransportName()); } }
/** * Adds Synapse Service to Axis2 configuration which enables the main message mediation. * * @throws AxisFault if an error occurs during Axis2 service initialization */ private void deploySynapseService() throws AxisFault { log.info("Deploying the Synapse service..."); // Dynamically initialize the Synapse Service and deploy it into Axis2 AxisConfiguration axisCfg = configurationContext.getAxisConfiguration(); AxisService synapseService = new AxisService(SynapseConstants.SYNAPSE_SERVICE_NAME); AxisOperation mediateOperation = new InOutAxisOperation( SynapseConstants.SYNAPSE_OPERATION_NAME); mediateOperation.setMessageReceiver(new SynapseMessageReceiver()); synapseService.addOperation(mediateOperation); List<String> transports = new ArrayList<String>(); transports.add(Constants.TRANSPORT_HTTP); transports.add(Constants.TRANSPORT_HTTPS); synapseService.setExposedTransports(transports); AxisServiceGroup synapseServiceGroup = new AxisServiceGroup(axisCfg); synapseServiceGroup.setServiceGroupName(SynapseConstants.SYNAPSE_SERVICE_NAME); synapseServiceGroup.addParameter(SynapseConstants.HIDDEN_SERVICE_PARAM, "true"); synapseServiceGroup.addService(synapseService); axisCfg.addServiceGroup(synapseServiceGroup); }
/** * Adds Synapse Service to Axis2 configuration which enables the main message mediation. * * @throws AxisFault if an error occurs during Axis2 service initialization */ private void deploySynapseService() throws AxisFault { log.info("Deploying the Synapse service..."); // Dynamically initialize the Synapse Service and deploy it into Axis2 AxisConfiguration axisCfg = configurationContext.getAxisConfiguration(); AxisService synapseService = new AxisService(SynapseConstants.SYNAPSE_SERVICE_NAME); AxisOperation mediateOperation = new InOutAxisOperation( SynapseConstants.SYNAPSE_OPERATION_NAME); mediateOperation.setMessageReceiver(new SynapseMessageReceiver()); synapseService.addOperation(mediateOperation); List<String> transports = new ArrayList<String>(); transports.add(Constants.TRANSPORT_HTTP); transports.add(Constants.TRANSPORT_HTTPS); synapseService.setExposedTransports(transports); AxisServiceGroup synapseServiceGroup = new AxisServiceGroup(axisCfg); synapseServiceGroup.setServiceGroupName(SynapseConstants.SYNAPSE_SERVICE_NAME); synapseServiceGroup.addParameter(SynapseConstants.HIDDEN_SERVICE_PARAM, "true"); synapseServiceGroup.addService(synapseService); axisCfg.addServiceGroup(synapseServiceGroup); }
transports.add(transportProtocols[i]); axisService.setExposedTransports(transports);
service.setExposedTransports(transports); axisConfig.addService(service);
+ " and which is/are not available in Axis2"); service.setExposedTransports(trs);
+ " and which is/are not available in Axis2"); service.setExposedTransports(trs);
transports.add(Constants.TRANSPORT_HTTP); transports.add(Constants.TRANSPORT_HTTPS); service.setExposedTransports(transports);
axisService.setExposedTransports(transports);
proxyService.setExposedTransports(transports);
axisService.setExposedTransports(dataService.getTransports());