org.apache.axis2.description.AxisEndpoint Java Examples

The following examples show how to use org.apache.axis2.description.AxisEndpoint. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: IntegratorStatefulHandler.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
/**
 * Finds axis Service and the Operation for DSS requests
 *
 * @param msgContext request message context
 * @throws AxisFault if any exception occurs while finding axis service or operation
 */
private static void dispatchAndVerify(MessageContext msgContext) throws AxisFault {
    requestDispatcher.invoke(msgContext);
    AxisService axisService = msgContext.getAxisService();
    if (axisService != null) {
        httpLocationBasedDispatcher.invoke(msgContext);
        if (msgContext.getAxisOperation() == null) {
            requestURIOperationDispatcher.invoke(msgContext);
        }

        AxisOperation axisOperation;
        if ((axisOperation = msgContext.getAxisOperation()) != null) {
            AxisEndpoint axisEndpoint =
                    (AxisEndpoint) msgContext.getProperty(WSDL2Constants.ENDPOINT_LOCAL_NAME);
            if (axisEndpoint != null) {
                AxisBindingOperation axisBindingOperation = (AxisBindingOperation) axisEndpoint
                        .getBinding().getChild(axisOperation.getName());
                msgContext.setProperty(Constants.AXIS_BINDING_OPERATION, axisBindingOperation);
            }
            msgContext.setAxisOperation(axisOperation);
        }
    }
}
 
Example #2
Source File: ServiceMetaData.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
public void setWsdlPorts(Map endPnts) {

        Map<String, String> resultMap = new HashMap<String, String>();
        int i = 0;
        for (Object p : endPnts.keySet()) {
            try {
                AxisEndpoint axisEndpoint = (AxisEndpoint) endPnts.get(p);
                if (axisEndpoint.getEndpointURL() != null || !axisEndpoint.getEndpointURL().equals("")) {
                    String endPoint = axisEndpoint.getEndpointURL().substring(0, axisEndpoint.getEndpointURL().indexOf(":"));
                    resultMap.put(p.toString(), endPoint);
                }
            } catch (Exception e) {
                if (log.isDebugEnabled()) {
                    log.error(e.getMessage(), e);
                }
            }
        }
        wsdlPorts = new String[resultMap.size()];
        wsdlPortTypes = new String[resultMap.size()];

        for (String a : resultMap.keySet()) {
            this.wsdlPorts[i] = a;
            this.wsdlPortTypes[i] = resultMap.get(a);
            i++;
        }
    }
 
Example #3
Source File: SecurityDeploymentInterceptor.java    From carbon-identity with Apache License 2.0 5 votes vote down vote up
public void addPolicyToAllBindings(AxisService axisService, Policy policy)
        throws ServerException {
    try {
        if (policy.getId() == null) {
            // Generate an ID
            policy.setId(UUIDGenerator.getUUID());
        }
        Map endPointMap = axisService.getEndpoints();
        for (Object o : endPointMap.entrySet()) {
            Map.Entry entry = (Map.Entry) o;
            AxisEndpoint point = (AxisEndpoint) entry.getValue();
            AxisBinding binding = point.getBinding();
            String bindingName = binding.getName().getLocalPart();

            //only UTOverTransport is allowed for HTTP
            if (bindingName.endsWith("HttpBinding") &&
                    (!policy.getAttributes().containsValue("UTOverTransport"))) {
                continue;
            }
            binding.getPolicySubject().attachPolicy(policy);
            // Add the new policy to the registry
        }
    } catch (Exception e) {
        log.error("Error in adding security policy to all bindings", e);
        throw new ServerException("addPoliciesToService", e);
    }
}
 
Example #4
Source File: SecurityServiceAdmin.java    From carbon-identity with Apache License 2.0 5 votes vote down vote up
/**
 * This method add Policy to service at the Registry. Does not add the
 * policy to Axis2. To all Bindings available
 *
 * @param axisService Service
 * @param policy      Policy
 * @throws org.wso2.carbon.utils.ServerException se
 */
public void addSecurityPolicyToAllBindings(AxisService axisService, Policy policy)
        throws ServerException {
    String serviceGroupId = axisService.getAxisServiceGroup().getServiceGroupName();
    try {
        if (policy.getId() == null) {
            policy.setId(UUIDGenerator.getUUID());
        }

        Map endPointMap = axisService.getEndpoints();
        for (Object o : endPointMap.entrySet()) {
            Map.Entry entry = (Map.Entry) o;
            AxisEndpoint point = (AxisEndpoint) entry.getValue();
            AxisBinding binding = point.getBinding();
            String bindingName = binding.getName().getLocalPart();

            //only UTOverTransport is allowed for HTTP
            if (bindingName.endsWith("HttpBinding") &&
                    (!policy.getAttributes().containsValue("UTOverTransport"))) {
                continue;
            }
            binding.getPolicySubject().attachPolicy(policy);

        }
    } catch (Exception e) {
        log.error("Error in adding security policy to all bindings", e);
        throw new ServerException("addPoliciesToService", e);
    }
}
 
Example #5
Source File: SecurityServiceAdmin.java    From carbon-identity with Apache License 2.0 5 votes vote down vote up
public void removeSecurityPolicyFromAllBindings(AxisService axisService, String uuid)
        throws ServerException {
    if (log.isDebugEnabled()) {
        log.debug("Removing  security policy from all bindings.");
    }
    Map endPointMap = axisService.getEndpoints();
    for (Object o : endPointMap.entrySet()) {
        Map.Entry entry = (Map.Entry) o;
        AxisEndpoint point = (AxisEndpoint) entry.getValue();
        AxisBinding binding = point.getBinding();
        if (binding.getPolicySubject().getAttachedPolicyComponent(uuid) != null) {
            binding.getPolicySubject().detachPolicyComponent(uuid);
        }
    }
}
 
Example #6
Source File: DBDeployer.java    From micro-integrator with Apache License 2.0 4 votes vote down vote up
/**
 * Creates a set of default endpoints for this service
 */
private void createDefaultEndpoints(AxisService axisService, AxisBinding soap11Binding,
		AxisBinding soap12Binding, AxisBinding httpBinding) {
	Map<String, TransportInDescription> transportsIn = axisConfig.getTransportsIn();
	Iterator<TransportInDescription> iterator = transportsIn.values().iterator();
	while (iterator.hasNext()) {
		/*
		 * Used to indicate whether a HTTPEndpoint is needed. Http endpoint
		 * is needed only for http and https transports
		 */
		boolean needHttp = false;

		/* The prefix is used to generate endpoint names */
		String prefix = "";
		TransportInDescription transportIn = iterator.next();
		String transportInName = transportIn.getName();
		if (HTTP_TRANSPORT.equalsIgnoreCase(transportInName)) {
			needHttp = true;
		} else if (HTTPS_TRANSPORT.equalsIgnoreCase(transportInName)) {
			needHttp = true;
			prefix = WSDL2Constants.DEFAULT_HTTPS_PREFIX;
		} else if (transportInName != null) {
			prefix = transportInName.toUpperCase();
		}

		/* Creates a default SOAP 1.1 endpoint */
		AxisEndpoint soap11Endpoint = new AxisEndpoint();
		String soap11EndpointName = prefix
				+ WSDL2Constants.DEFAULT_SOAP11_ENDPOINT_NAME;
		soap11Endpoint.setName(soap11EndpointName);
		soap11Endpoint.setBinding(soap11Binding);
		soap11Endpoint.setParent(axisService);
		soap11Endpoint.setTransportInDescription(transportInName);
		soap11Endpoint.setProperty(WSDL2Constants.HTTP_LOCATION_TABLE, httpLocationTable);
           soap11Endpoint.setProperty(WSDL2Constants.HTTP_LOCATION_TABLE_FOR_RESOURCE, httpLocationTableForResource);
		axisService.addEndpoint(soap11EndpointName, soap11Endpoint);

           /* setting soap11 endpoint as the default endpoint */
		axisService.setEndpointName(soap11EndpointName);

		/* Creates a default SOAP 1.2 endpoint */
		AxisEndpoint soap12Endpoint = new AxisEndpoint();
		String soap12EndpointName = prefix
				+ WSDL2Constants.DEFAULT_SOAP12_ENDPOINT_NAME;
		soap12Endpoint.setName(soap12EndpointName);
		soap12Endpoint.setBinding(soap12Binding);
		soap12Endpoint.setParent(axisService);
		soap12Endpoint.setTransportInDescription(transportInName);
		soap12Endpoint.setProperty(WSDL2Constants.HTTP_LOCATION_TABLE, httpLocationTable);
           soap12Endpoint.setProperty(WSDL2Constants.HTTP_LOCATION_TABLE_FOR_RESOURCE, httpLocationTableForResource);
		axisService.addEndpoint(soap12EndpointName, soap12Endpoint);

		/* Creates a HTTP endpoint if its http or https transport is used */
		if (needHttp) {
			AxisEndpoint httpEndpoint = new AxisEndpoint();
			String httpEndpointName = prefix
					+ WSDL2Constants.DEFAULT_HTTP_ENDPOINT_NAME;
			httpEndpoint.setName(httpEndpointName);
			httpEndpoint.setBinding(httpBinding);
			httpEndpoint.setParent(axisService);
			httpEndpoint.setTransportInDescription(transportInName);
			httpEndpoint.setProperty(WSDL2Constants.HTTP_LOCATION_TABLE, httpLocationTable);
               httpEndpoint.setProperty(WSDL2Constants.HTTP_LOCATION_TABLE_FOR_RESOURCE, httpLocationTableForResource);
			axisService.addEndpoint(httpEndpointName, httpEndpoint);
		}
	}
}