Java Code Examples for javax.wsdl.WSDLException

The following are top voted examples for showing how to use javax.wsdl.WSDLException. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: boosters   File: OperatonUtils.java   View source code 8 votes vote down vote up
/**
 * 参考SoapMessageBuilder.SoapMessageBuilder(URL wsdlUrl)方法
 * 获取portType中的所有operation
 *
 * @param wsdlUrl
 * @return
 */
private static List<Operation> getPortTypeOperations(String wsdlUrl) {
    List<Operation> operationList = new ArrayList();
    try {
        WSDLReader reader = new WSDLReaderImpl();
        reader.setFeature("javax.wsdl.verbose", false);
        Definition definition = reader.readWSDL(wsdlUrl.toString());
        Map<String, PortTypeImpl> defMap = definition.getAllPortTypes();
        Collection<PortTypeImpl> collection = defMap.values();
        for (PortTypeImpl portType : collection) {
            operationList.addAll(portType.getOperations());
        }
    } catch (WSDLException e) {
        System.out.println("get wsdl operation fail.");
        e.printStackTrace();
    }
    return operationList;
}
 
Example 2
Project: OSCAR-ConCert   File: CxfClientUtilsOld.java   View source code 7 votes vote down vote up
public static boolean isConnectionException(Throwable t)
{
	if (t != null)
	{
		Throwable cause = t.getCause();
		if (cause != null && cause instanceof ServiceConstructionException)
		{
			Throwable causeCause = cause.getCause();
			if (causeCause != null && causeCause instanceof WSDLException)
			{
				Throwable causeCauseCaise = causeCause.getCause();
				if (causeCauseCaise != null && causeCauseCaise instanceof ConnectException) return(true);
			}
		}
	}

	return(false);
}
 
Example 3
Project: development   File: BesDAO.java   View source code 7 votes vote down vote up
void validateVersion(String wsdlUrl) {
    WSDLLocator locator = new BasicAuthWSDLLocator(wsdlUrl, null, null);
    WSDLFactory wsdlFactory;
    Definition serviceDefinition;
    try {
        wsdlFactory = WSDLFactory.newInstance();
        WSDLReader wsdlReader = wsdlFactory.newWSDLReader();
        // avoid importing external documents
        wsdlReader.setExtensionRegistry(new WSVersionExtensionRegistry());
        serviceDefinition = wsdlReader.readWSDL(locator);
        Element versionElement = serviceDefinition
                .getDocumentationElement();
        if (!CTMGApiVersion.version.equals(versionElement.getTextContent())) {
            LOGGER.warn("Web service mismatches and the version value, expected: "
                    + CTMGApiVersion.version
                    + " and the one got from wsdl: "
                    + versionElement.getTextContent());
        }
    } catch (WSDLException e) {
        LOGGER.warn("Remote wsdl cannot be retrieved from CT_MG. [Cause: "
                + e.getMessage() + "]", e);
    }

}
 
Example 4
Project: oscm   File: OperationServiceAdapterFactory.java   View source code 6 votes vote down vote up
public static OperationServiceAdapter getOperationServiceAdapter(
        TechnicalProductOperation operation, Integer wsTimeout,
        String username, String password) throws IOException,
        WSDLException, ParserConfigurationException {

    String target = operation.getActionUrl();
    if (Strings.isEmpty(target)) {
        throw new SaaSSystemException(
                String.format(
                        "Failed to retrieve service endpoint for service operation '%s', as the target is not defined.",
                        Long.valueOf(operation.getKey())));
    }
    WSPortConnector portConnector = new WSPortConnector(target, username,
            password);

    SupportedOperationVersions supportedVersion = getSupportedVersion(portConnector);
    OperationServiceAdapter adapter = getAdapterForVersion(supportedVersion);
    final Object port = portConnector.getPort(
            supportedVersion.getLocalWSDL(),
            supportedVersion.getServiceClass(), wsTimeout);
    adapter.setOperationService(port);
    return adapter;
}
 
Example 5
Project: oscm   File: ApplicationServiceBean.java   View source code 6 votes vote down vote up
/**
 * Creates the operation service adapter that delegates to the real the
 * port. If a provisioning user is specified, basic authentication will be
 * used.
 * 
 * @param op
 *            the {@link TechnicalProductOperation} to get the action url
 *            from
 * @return the {@link OperationService}
 * @throws IOException
 * @throws ParserConfigurationException
 * @throws WSDLException
 */
protected OperationService getServiceClient(TechnicalProductOperation op)
        throws IOException, WSDLException, ParserConfigurationException {

    TechnicalProduct techProduct = op.getTechnicalProduct();
    String username = techProduct.getProvisioningUsername();
    String password = techProduct.getProvisioningPassword();

    // Get the timeout value for the outgoing WS call from the configuration
    // settings
    Integer wsTimeout = Integer
            .valueOf(cs.getConfigurationSetting(ConfigurationKey.WS_TIMEOUT,
                    Configuration.GLOBAL_CONTEXT).getValue());

    return OperationServiceAdapterFactory.getOperationServiceAdapter(op,
            wsTimeout, username, password);
}
 
Example 6
Project: oscm   File: BesDAO.java   View source code 6 votes vote down vote up
void validateVersion(String wsdlUrl) {
    WSDLLocator locator = new BasicAuthWSDLLocator(wsdlUrl, null, null);
    WSDLFactory wsdlFactory;
    Definition serviceDefinition;
    try {
        wsdlFactory = WSDLFactory.newInstance();
        WSDLReader wsdlReader = wsdlFactory.newWSDLReader();
        // avoid importing external documents
        wsdlReader.setExtensionRegistry(new WSVersionExtensionRegistry());
        serviceDefinition = wsdlReader.readWSDL(locator);
        Element versionElement = serviceDefinition
                .getDocumentationElement();
        if (!CTMGApiVersion.version.equals(versionElement.getTextContent())) {
            LOGGER.warn("Web service mismatches and the version value, expected: "
                    + CTMGApiVersion.version
                    + " and the one got from wsdl: "
                    + versionElement.getTextContent());
        }
    } catch (WSDLException e) {
        LOGGER.warn("Remote wsdl cannot be retrieved from CT_MG. [Cause: "
                + e.getMessage() + "]", e);
    }

}
 
Example 7
Project: oscm   File: WSPortConnector.java   View source code 6 votes vote down vote up
/**
 * Creates an instance of port connector.
 * 
 * @param remoteWsdlUrl
 *            The URL at which the WSDL can be accessed.
 * @param userName
 *            The userName to be used for authentication. <code>null</code>
 *            if no authentication is required.
 * @param password
 *            The password for the user. <code>null</code> if not required.
 * @param host
 *            optional - if specified, this host will be used instead the
 *            one from the wsdl
 * 
 * @throws IOException
 * @throws WSDLException
 */
public WSPortConnector(String remoteWsdlUrl, String userName,
        String password, String host) throws IOException, WSDLException {
    this.userName = userName;
    this.password = password;
    URL url = new URL(remoteWsdlUrl);
    if (requiresUserAuthentication(userName, password)) {
        url = BasicAuthLoader.load(url, userName, password);
    }

    WSDLLocator locator = new BasicAuthWSDLLocator(remoteWsdlUrl, userName,
            password);

    try {
        details = getServiceDetails(locator, host);
    } finally {
        locator.close();
    }
}
 
Example 8
Project: oscm   File: TriggerProcessListener.java   View source code 6 votes vote down vote up
/**
 * Sends a notification on registration of a customer to the receiver
 * specified in the trigger definition.
 * 
 * @param process
 *            The current process to be handled.
 * @param facade
 *            Localizer facade to determine translated reason.
 * @throws ParserConfigurationException
 * @throws WSDLException
 * @throws IOException
 */
private void handleRegisterCustomer(TriggerProcess process,
        LocalizerFacade facade) throws IOException, WSDLException,
        ParserConfigurationException {
    INotificationServiceAdapter serviceClient = getServiceClient(process
            .getTriggerDefinition());
    VOTriggerProcess vo = TriggerProcessAssembler.toVOTriggerProcess(
            process, facade);
    VOOrganization organization = getParamValue(
            process.getParamValueForName(TriggerProcessParameterName.ORGANIZATION),
            VOOrganization.class);
    VOUserDetails user = getParamValue(
            process.getParamValueForName(TriggerProcessParameterName.USER),
            VOUserDetails.class);
    Properties organizationProperties = getParamValue(
            process.getParamValueForName(TriggerProcessParameterName.ORGANIZATION_PROPERTIES),
            Properties.class);
    serviceClient.onRegisterCustomer(VOConverter.convertToApi(vo),
            VOConverter.convertToApi(organization),
            VOConverter.convertToApi(user), organizationProperties);

    updateProcessState(process);
}
 
Example 9
Project: oscm   File: TriggerProcessListener.java   View source code 6 votes vote down vote up
/**
 * Sends a notification on the modification of a subscription to the
 * receiver specified in the trigger definition.
 * 
 * @param process
 *            The current process to be handled.
 * @param facade
 *            Localizer facade to determine translated reason.
 * @throws ParserConfigurationException
 * @throws WSDLException
 * @throws IOException
 */
private void handleModifySubscription(TriggerProcess process,
        LocalizerFacade facade) throws IOException, WSDLException,
        ParserConfigurationException {
    INotificationServiceAdapter serviceClient = getServiceClient(process
            .getTriggerDefinition());
    VOTriggerProcess vo = TriggerProcessAssembler.toVOTriggerProcess(
            process, facade);
    VOSubscription subscription = getParamValue(
            process.getParamValueForName(TriggerProcessParameterName.SUBSCRIPTION),
            VOSubscription.class);
    List<VOParameter> modifiedParameters = ParameterizedTypes
            .list(getParamValue(
                    process.getParamValueForName(TriggerProcessParameterName.PARAMETERS),
                    List.class), VOParameter.class);
    serviceClient.onModifySubscription(VOConverter.convertToApi(vo),
            VOConverter.convertToApi(subscription), VOCollectionConverter
                    .convertList(modifiedParameters,
                            org.oscm.vo.VOParameter.class));

    updateProcessState(process);
}
 
Example 10
Project: oscm   File: TriggerProcessListener.java   View source code 6 votes vote down vote up
/**
 * Sends a notification on the upgrade of a subscription to the receiver
 * specified in the trigger definition.
 * 
 * @param process
 *            The current process to be handled.
 * @param facade
 *            Localizer facade to determine translated reason.
 * @throws ParserConfigurationException
 * @throws WSDLException
 * @throws IOException
 */
private void handleUpgradeSubscription(TriggerProcess process,
        LocalizerFacade facade) throws IOException, WSDLException,
        ParserConfigurationException {
    INotificationServiceAdapter serviceClient = getServiceClient(process
            .getTriggerDefinition());
    VOTriggerProcess vo = TriggerProcessAssembler.toVOTriggerProcess(
            process, facade);
    VOSubscription current = getParamValue(
            process.getParamValueForName(TriggerProcessParameterName.SUBSCRIPTION),
            VOSubscription.class);
    VOService newProduct = getParamValue(
            process.getParamValueForName(TriggerProcessParameterName.PRODUCT),
            VOService.class);
    serviceClient.onUpgradeSubscription(VOConverter.convertToApi(vo),
            VOConverter.convertToApi(current),
            VOConverter.convertToApi(newProduct));

    updateProcessState(process);
}
 
Example 11
Project: oscm   File: TriggerProcessListener.java   View source code 6 votes vote down vote up
/**
 * Sends a notification on the unsubscribe operation.
 * 
 * @param process
 *            The current trigger process to be handled.
 * @param facade
 *            Localizer facade to determine translated reason.
 * @throws ParserConfigurationException
 * @throws WSDLException
 * @throws IOException
 */
private void handleUnsubscribeFromProduct(TriggerProcess process,
        LocalizerFacade facade) throws IOException, WSDLException,
        ParserConfigurationException {
    INotificationServiceAdapter serviceClient = getServiceClient(process
            .getTriggerDefinition());
    VOTriggerProcess vo = TriggerProcessAssembler.toVOTriggerProcess(
            process, facade);
    String subId = getParamValue(
            process.getParamValueForName(TriggerProcessParameterName.SUBSCRIPTION),
            String.class);
    serviceClient.onUnsubscribeFromProduct(VOConverter.convertToApi(vo),
            subId);

    updateProcessState(process);
}
 
Example 12
Project: oscm   File: TriggerProcessListener.java   View source code 6 votes vote down vote up
/**
 * Sends a notification on the deactivation of a product to the receiver
 * specified in the trigger definition.
 * 
 * @param process
 *            The current trigger process to be handled.
 * @param facade
 *            Localizer facade to determine translated reason.
 * @throws ParserConfigurationException
 * @throws WSDLException
 * @throws IOException
 */
private void handleDeactivateProduct(TriggerProcess process,
        LocalizerFacade facade) throws IOException, WSDLException,
        ParserConfigurationException {
    INotificationServiceAdapter serviceClient = getServiceClient(process
            .getTriggerDefinition());
    VOTriggerProcess vo = TriggerProcessAssembler.toVOTriggerProcess(
            process, facade);
    VOService product = getParamValue(
            process.getParamValueForName(TriggerProcessParameterName.PRODUCT),
            VOService.class);
    serviceClient.onDeactivateProduct(VOConverter.convertToApi(vo),
            VOConverter.convertToApi(product));

    updateProcessState(process);
}
 
Example 13
Project: oscm   File: TriggerProcessListener.java   View source code 6 votes vote down vote up
/**
 * Sends a notification on the activation of a product to the receiver
 * specified in the trigger definition.
 * 
 * @param process
 *            The current trigger process to be handled.
 * @param facade
 *            Localizer facade to determine translated reason.
 * @throws ParserConfigurationException
 * @throws WSDLException
 * @throws IOException
 */
private void handleActivateProduct(TriggerProcess process,
        LocalizerFacade facade) throws IOException, WSDLException,
        ParserConfigurationException {
    INotificationServiceAdapter serviceClient = getServiceClient(process
            .getTriggerDefinition());
    VOTriggerProcess vo = TriggerProcessAssembler.toVOTriggerProcess(
            process, facade);
    VOService product = getParamValue(
            process.getParamValueForName(TriggerProcessParameterName.PRODUCT),
            VOService.class);
    serviceClient.onActivateProduct(VOConverter.convertToApi(vo),
            VOConverter.convertToApi(product));

    updateProcessState(process);
}
 
Example 14
Project: oscm   File: TriggerProcessListener.java   View source code 6 votes vote down vote up
private void handleSubscriptionTermination(TriggerProcess process,
        LocalizerFacade facade) throws IOException, WSDLException,
        ParserConfigurationException {
    INotificationServiceAdapter serviceClient = getServiceClient(process
            .getTriggerDefinition());
    VOTriggerProcess vo = TriggerProcessAssembler.toVOTriggerProcess(
            process, facade);
    String subscriptionId = getParamValue(
            process.getParamValueForName(TriggerProcessParameterName.SUBSCRIPTION),
            String.class);
    Invariants.assertNotNull(subscriptionId,
            "mandatory parameter 'subscriptionId' not set");

    VONotificationBuilder builder = new VONotificationBuilder();
    builder.addParameter(VOProperty.SUBSCRIPTION_SUBSCRIPTION_ID,
            subscriptionId);
    VONotification notification = builder.build();

    serviceClient.onSubscriptionTermination(VOConverter.convertToApi(vo),
            notification);
    updateProcessState(process);
}
 
Example 15
Project: convertigo-engine   File: WebServiceServlet.java   View source code 6 votes vote down vote up
private static void addWsdLDocumentation(Definition definition, WSDLElement wsdlElement, String documentation) {
if (documentation.equals(""))
	return;

  	try {
	Document doc = new WSDLWriterImpl().getDocument(definition);
	Element element = doc.createElementNS("http://schemas.xmlsoap.org/wsdl/","documentation");
	element.setPrefix("wsdl");
	String cdataValue = documentation;
	cdataValue = cdataValue.replaceAll("<!\\[CDATA\\[", "&lt;!\\[CDATA\\[");
	cdataValue = cdataValue.replaceAll("\\]\\]>", "\\]\\]&gt;");
	element.appendChild(doc.createCDATASection(cdataValue));
	wsdlElement.setDocumentationElement(element);
} catch (WSDLException e) {
	e.printStackTrace();
}
  }
 
Example 16
Project: castlemock   File: CreateSoapPortsService.java   View source code 6 votes vote down vote up
/**
 * The method creates ports based on provided definitions.
 * @param files Definitions used to create new ports.
 * @param generateResponse Boolean value for if a default response should be generated for each new operation
 * @return List of ports generated from the provided definitions.
 * @throws WSDLException Throws an WSDLException if WSDL parsing failed.
 */
private List<SoapPortDto> createPorts(final List<File> files, final boolean generateResponse) throws WSDLException {
    try {
        final List<SoapPortDto> soapPorts = new ArrayList<>();
        final DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
        documentBuilderFactory.setValidating(false);
        documentBuilderFactory.setNamespaceAware(true);

        for(File file : files){
            final DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
            final Document document = documentBuilder.parse(file);
            document.getDocumentElement().normalize();

            final List<SoapPortDto> fileSoapPorts = getSoapPorts(document, generateResponse);
            soapPorts.addAll(fileSoapPorts);
        }
        return soapPorts;
    } catch (Exception e) {
        throw new IllegalArgumentException("Unable parse WSDL file", e);
    }
}
 
Example 17
Project: Camel   File: CxfEndpoint.java   View source code 6 votes vote down vote up
public QName getServiceName() {
    if (serviceName == null && serviceNameString != null) {
        serviceName = QName.valueOf(resolvePropertyPlaceholders(serviceNameString));
    }
    //if not specify the service name and if the wsdlUrl is available,
    //parse the wsdl to see if only one service in it, if so set the only service
    //from wsdl to avoid ambiguity
    if (serviceName == null && getWsdlURL() != null) {
        // use wsdl manager to parse wsdl or get cached
        // definition
        try {
            Definition definition = getBus().getExtension(WSDLManager.class)
                    .getDefinition(getWsdlURL());
            if (definition.getServices().size() == 1) {
                serviceName = (QName) definition.getServices().keySet()
                    .iterator().next();
                
            }
        } catch (WSDLException e) {
            throw new RuntimeException(e);
        }
    }
    return serviceName;
}
 
Example 18
Project: development   File: OperationServiceAdapterFactory.java   View source code 6 votes vote down vote up
public static OperationServiceAdapter getOperationServiceAdapter(
        TechnicalProductOperation operation, Integer wsTimeout,
        String username, String password) throws IOException,
        WSDLException, ParserConfigurationException {

    String target = operation.getActionUrl();
    if (Strings.isEmpty(target)) {
        throw new SaaSSystemException(
                String.format(
                        "Failed to retrieve service endpoint for service operation '%s', as the target is not defined.",
                        Long.valueOf(operation.getKey())));
    }
    WSPortConnector portConnector = new WSPortConnector(target, username,
            password);

    SupportedOperationVersions supportedVersion = getSupportedVersion(portConnector);
    OperationServiceAdapter adapter = getAdapterForVersion(supportedVersion);
    final Object port = portConnector.getPort(
            supportedVersion.getLocalWSDL(),
            supportedVersion.getServiceClass(), wsTimeout);
    adapter.setOperationService(port);
    return adapter;
}
 
Example 19
Project: development   File: ApplicationServiceBean.java   View source code 6 votes vote down vote up
/**
 * Creates the operation service adapter that delegates to the real the
 * port. If a provisioning user is specified, basic authentication will be
 * used.
 * 
 * @param op
 *            the {@link TechnicalProductOperation} to get the action url
 *            from
 * @return the {@link OperationService}
 * @throws IOException
 * @throws ParserConfigurationException
 * @throws WSDLException
 */
protected OperationService getServiceClient(TechnicalProductOperation op)
        throws IOException, WSDLException, ParserConfigurationException {

    TechnicalProduct techProduct = op.getTechnicalProduct();
    String username = techProduct.getProvisioningUsername();
    String password = techProduct.getProvisioningPassword();

    // Get the timeout value for the outgoing WS call from the configuration
    // settings
    Integer wsTimeout = Integer
            .valueOf(cs.getConfigurationSetting(ConfigurationKey.WS_TIMEOUT,
                    Configuration.GLOBAL_CONTEXT).getValue());

    return OperationServiceAdapterFactory.getOperationServiceAdapter(op,
            wsTimeout, username, password);
}
 
Example 20
Project: development   File: WSPortConnector.java   View source code 6 votes vote down vote up
/**
 * Creates an instance of port connector.
 * 
 * @param remoteWsdlUrl
 *            The URL at which the WSDL can be accessed.
 * @param userName
 *            The userName to be used for authentication. <code>null</code>
 *            if no authentication is required.
 * @param password
 *            The password for the user. <code>null</code> if not required.
 * @param host
 *            optional - if specified, this host will be used instead the
 *            one from the wsdl
 * 
 * @throws IOException
 * @throws WSDLException
 */
public WSPortConnector(String remoteWsdlUrl, String userName,
        String password, String host) throws IOException, WSDLException {
    this.userName = userName;
    this.password = password;
    URL url = new URL(remoteWsdlUrl);
    if (requiresUserAuthentication(userName, password)) {
        url = BasicAuthLoader.load(url, userName, password);
    }

    WSDLLocator locator = new BasicAuthWSDLLocator(remoteWsdlUrl, userName,
            password);

    try {
        details = getServiceDetails(locator, host);
    } finally {
        locator.close();
    }
}
 
Example 21
Project: development   File: TriggerProcessListener.java   View source code 6 votes vote down vote up
/**
 * Sends a notification on registration of a customer to the receiver
 * specified in the trigger definition.
 * 
 * @param process
 *            The current process to be handled.
 * @param facade
 *            Localizer facade to determine translated reason.
 * @throws ParserConfigurationException
 * @throws WSDLException
 * @throws IOException
 */
private void handleRegisterCustomer(TriggerProcess process,
        LocalizerFacade facade) throws IOException, WSDLException,
        ParserConfigurationException {
    INotificationServiceAdapter serviceClient = getServiceClient(process
            .getTriggerDefinition());
    VOTriggerProcess vo = TriggerProcessAssembler.toVOTriggerProcess(
            process, facade);
    VOOrganization organization = getParamValue(
            process.getParamValueForName(TriggerProcessParameterName.ORGANIZATION),
            VOOrganization.class);
    VOUserDetails user = getParamValue(
            process.getParamValueForName(TriggerProcessParameterName.USER),
            VOUserDetails.class);
    Properties organizationProperties = getParamValue(
            process.getParamValueForName(TriggerProcessParameterName.ORGANIZATION_PROPERTIES),
            Properties.class);
    serviceClient.onRegisterCustomer(VOConverter.convertToApi(vo),
            VOConverter.convertToApi(organization),
            VOConverter.convertToApi(user), organizationProperties);

    updateProcessState(process);
}
 
Example 22
Project: development   File: TriggerProcessListener.java   View source code 6 votes vote down vote up
/**
 * Sends a notification on the modification of a subscription to the
 * receiver specified in the trigger definition.
 * 
 * @param process
 *            The current process to be handled.
 * @param facade
 *            Localizer facade to determine translated reason.
 * @throws ParserConfigurationException
 * @throws WSDLException
 * @throws IOException
 */
private void handleModifySubscription(TriggerProcess process,
        LocalizerFacade facade) throws IOException, WSDLException,
        ParserConfigurationException {
    INotificationServiceAdapter serviceClient = getServiceClient(process
            .getTriggerDefinition());
    VOTriggerProcess vo = TriggerProcessAssembler.toVOTriggerProcess(
            process, facade);
    VOSubscription subscription = getParamValue(
            process.getParamValueForName(TriggerProcessParameterName.SUBSCRIPTION),
            VOSubscription.class);
    List<VOParameter> modifiedParameters = ParameterizedTypes
            .list(getParamValue(
                    process.getParamValueForName(TriggerProcessParameterName.PARAMETERS),
                    List.class), VOParameter.class);
    serviceClient.onModifySubscription(VOConverter.convertToApi(vo),
            VOConverter.convertToApi(subscription), VOCollectionConverter
                    .convertList(modifiedParameters,
                            org.oscm.vo.VOParameter.class));

    updateProcessState(process);
}
 
Example 23
Project: development   File: TriggerProcessListener.java   View source code 6 votes vote down vote up
/**
 * Sends a notification on the upgrade of a subscription to the receiver
 * specified in the trigger definition.
 * 
 * @param process
 *            The current process to be handled.
 * @param facade
 *            Localizer facade to determine translated reason.
 * @throws ParserConfigurationException
 * @throws WSDLException
 * @throws IOException
 */
private void handleUpgradeSubscription(TriggerProcess process,
        LocalizerFacade facade) throws IOException, WSDLException,
        ParserConfigurationException {
    INotificationServiceAdapter serviceClient = getServiceClient(process
            .getTriggerDefinition());
    VOTriggerProcess vo = TriggerProcessAssembler.toVOTriggerProcess(
            process, facade);
    VOSubscription current = getParamValue(
            process.getParamValueForName(TriggerProcessParameterName.SUBSCRIPTION),
            VOSubscription.class);
    VOService newProduct = getParamValue(
            process.getParamValueForName(TriggerProcessParameterName.PRODUCT),
            VOService.class);
    serviceClient.onUpgradeSubscription(VOConverter.convertToApi(vo),
            VOConverter.convertToApi(current),
            VOConverter.convertToApi(newProduct));

    updateProcessState(process);
}
 
Example 24
Project: development   File: TriggerProcessListener.java   View source code 6 votes vote down vote up
/**
 * Sends a notification on the unsubscribe operation.
 * 
 * @param process
 *            The current trigger process to be handled.
 * @param facade
 *            Localizer facade to determine translated reason.
 * @throws ParserConfigurationException
 * @throws WSDLException
 * @throws IOException
 */
private void handleUnsubscribeFromProduct(TriggerProcess process,
        LocalizerFacade facade) throws IOException, WSDLException,
        ParserConfigurationException {
    INotificationServiceAdapter serviceClient = getServiceClient(process
            .getTriggerDefinition());
    VOTriggerProcess vo = TriggerProcessAssembler.toVOTriggerProcess(
            process, facade);
    String subId = getParamValue(
            process.getParamValueForName(TriggerProcessParameterName.SUBSCRIPTION),
            String.class);
    serviceClient.onUnsubscribeFromProduct(VOConverter.convertToApi(vo),
            subId);

    updateProcessState(process);
}
 
Example 25
Project: development   File: TriggerProcessListener.java   View source code 6 votes vote down vote up
/**
 * Sends a notification on the deactivation of a product to the receiver
 * specified in the trigger definition.
 * 
 * @param process
 *            The current trigger process to be handled.
 * @param facade
 *            Localizer facade to determine translated reason.
 * @throws ParserConfigurationException
 * @throws WSDLException
 * @throws IOException
 */
private void handleDeactivateProduct(TriggerProcess process,
        LocalizerFacade facade) throws IOException, WSDLException,
        ParserConfigurationException {
    INotificationServiceAdapter serviceClient = getServiceClient(process
            .getTriggerDefinition());
    VOTriggerProcess vo = TriggerProcessAssembler.toVOTriggerProcess(
            process, facade);
    VOService product = getParamValue(
            process.getParamValueForName(TriggerProcessParameterName.PRODUCT),
            VOService.class);
    serviceClient.onDeactivateProduct(VOConverter.convertToApi(vo),
            VOConverter.convertToApi(product));

    updateProcessState(process);
}
 
Example 26
Project: development   File: TriggerProcessListener.java   View source code 6 votes vote down vote up
/**
 * Sends a notification on the activation of a product to the receiver
 * specified in the trigger definition.
 * 
 * @param process
 *            The current trigger process to be handled.
 * @param facade
 *            Localizer facade to determine translated reason.
 * @throws ParserConfigurationException
 * @throws WSDLException
 * @throws IOException
 */
private void handleActivateProduct(TriggerProcess process,
        LocalizerFacade facade) throws IOException, WSDLException,
        ParserConfigurationException {
    INotificationServiceAdapter serviceClient = getServiceClient(process
            .getTriggerDefinition());
    VOTriggerProcess vo = TriggerProcessAssembler.toVOTriggerProcess(
            process, facade);
    VOService product = getParamValue(
            process.getParamValueForName(TriggerProcessParameterName.PRODUCT),
            VOService.class);
    serviceClient.onActivateProduct(VOConverter.convertToApi(vo),
            VOConverter.convertToApi(product));

    updateProcessState(process);
}
 
Example 27
Project: development   File: TriggerProcessListener.java   View source code 6 votes vote down vote up
private void handleSubscriptionTermination(TriggerProcess process,
        LocalizerFacade facade) throws IOException, WSDLException,
        ParserConfigurationException {
    INotificationServiceAdapter serviceClient = getServiceClient(process
            .getTriggerDefinition());
    VOTriggerProcess vo = TriggerProcessAssembler.toVOTriggerProcess(
            process, facade);
    String subscriptionId = getParamValue(
            process.getParamValueForName(TriggerProcessParameterName.SUBSCRIPTION),
            String.class);
    Invariants.assertNotNull(subscriptionId,
            "mandatory parameter 'subscriptionId' not set");

    VONotificationBuilder builder = new VONotificationBuilder();
    builder.addParameter(VOProperty.SUBSCRIPTION_SUBSCRIPTION_ID,
            subscriptionId);
    VONotification notification = builder.build();

    serviceClient.onSubscriptionTermination(VOConverter.convertToApi(vo),
            notification);
    updateProcessState(process);
}
 
Example 28
Project: jolie   File: WSDLDocCreator.java   View source code 6 votes vote down vote up
private Binding createBindingSOAP(Definition def, PortType pt, String bindingName) {
    Binding bind = def.getBinding(new QName(bindingName));
    if (bind == null) {
        bind = def.createBinding();
        bind.setQName(new QName(tns, bindingName));
    }
    bind.setPortType(pt);
    bind.setUndefined(false);
    try {
        SOAPBinding soapBinding = (SOAPBinding) extensionRegistry.createExtension(Binding.class, new QName(NameSpacesEnum.SOAP.getNameSpaceURI(), "binding"));
        soapBinding.setTransportURI(NameSpacesEnum.SOAPoverHTTP.getNameSpaceURI());
        soapBinding.setStyle("document");
        bind.addExtensibilityElement(soapBinding);
    } catch (WSDLException ex) {
        System.out.println((ex.getStackTrace()));
    }
    def.addBinding(bind);

    return bind;

}
 
Example 29
Project: jolie   File: WSDLDocCreator.java   View source code 6 votes vote down vote up
public Service createService(Definition localdef, String serviceName, Binding bind, String mySOAPAddress) {
    Port p = localDef.createPort();
    p.setName(serviceName + "Port");
    try {

        SOAPAddress soapAddress = (SOAPAddress) extensionRegistry.createExtension(Port.class, new QName(NameSpacesEnum.SOAP.getNameSpaceURI(), "address"));
        soapAddress.setLocationURI(mySOAPAddress);
        p.addExtensibilityElement(soapAddress);
    } catch (WSDLException ex) {
        ex.printStackTrace();
    }
    p.setBinding(bind);
    Service s = new ServiceImpl();
    QName serviceQName = new QName(serviceName);
    s.setQName(serviceQName);
    s.addPort(p);
    localDef.addService(s);
    return s;
}
 
Example 30
Project: incubator-taverna-workbench-common-activities   File: AddXMLOutputSplitterMenuAction.java   View source code 6 votes vote down vote up
@Override
protected Action createAction() {
	AddXMLOutputSplitterAction configAction = new AddXMLOutputSplitterAction(
			findActivity(), null, editManager, selectionManager);
	Map<String, TypeDescriptor> descriptors;
	try {
		descriptors = configAction.getTypeDescriptors();
	} catch (UnknownOperationException | IOException | ParserConfigurationException
			| WSDLException | SAXException | JDOMException e) {
		return null;
	}
	if (!AbstractAddXMLSplitterAction.filterDescriptors(descriptors).isEmpty()) {
		configAction.putValue(Action.NAME, ADD_XML_OUTPUT_SPLITTER);
		addMenuDots(configAction);
		return configAction;
	} else {
		return null;
	}
}
 
Example 31
Project: incubator-taverna-workbench-common-activities   File: AddXMLInputSplitterMenuAction.java   View source code 6 votes vote down vote up
@Override
protected Action createAction() {
	AddXMLInputSplitterAction configAction = new AddXMLInputSplitterAction(findActivity(),
			null, editManager, selectionManager);
	Map<String, TypeDescriptor> descriptors;
	try {
		descriptors = configAction.getTypeDescriptors();
	} catch (UnknownOperationException | IOException | ParserConfigurationException
			| WSDLException | SAXException | JDOMException e) {
		return null;
	}
	if (!AbstractAddXMLSplitterAction.filterDescriptors(descriptors).isEmpty()) {
		configAction.putValue(Action.NAME, ADD_XML_INPUT_SPLITTER);
		addMenuDots(configAction);
		return configAction;
	} else {
		return null;
	}
}
 
Example 32
Project: SecureBPMN   File: CxfWSDLImporter.java   View source code 6 votes vote down vote up
public void importFrom(String url) {
  this.wsServices.clear();
  this.wsOperations.clear();
  this.structures.clear();

  this.wsdlLocation = url;

  try {
    Bus bus = BusFactory.getDefaultBus();
    WSDLManager wsdlManager = bus.getExtension(WSDLManager.class);
    Definition def = wsdlManager.getDefinition(url);
    WSDLServiceBuilder builder = new WSDLServiceBuilder(bus);
    List<ServiceInfo> services = builder.buildServices(def);
    
    for (ServiceInfo service : services) {
      WSService wsService = this.importService(service);
      this.wsServices.put(this.namespace + wsService.getName(), wsService);
    }
    
    this.importTypes(def.getTypes());
  } catch (WSDLException e) {
    e.printStackTrace();
  }
}
 
Example 33
Project: incubator-taverna-common-activities   File: WSDL11Parser.java   View source code 6 votes vote down vote up
public static synchronized WSDL11Parser getWSDL11Parser(String wsdlLocation) throws WSDLException, IOException {
    WSDL11Parser parser = null;
    
    if (parsers == null) {
        parsers = new TreeMap<String, WSDL11Parser>();
    } else {
        parser = parsers.get(wsdlLocation);
    }
    
    if (parser == null) {
        WSDLFactory factory = WSDLFactory.newInstance();
        WSDLReader reader = factory.newWSDLReader();
        reader.setFeature("javax.wsdl.verbose", false);
        Definition definition = reader.readWSDL(wsdlLocation);

        parser = new WSDL11Parser(definition);
        
        parsers.put(wsdlLocation, parser);
    }
    
    return parser;
}
 
Example 34
Project: incubator-taverna-common-activities   File: EncodedBodyBuilder.java   View source code 6 votes vote down vote up
@Override
public SOAPElement build(Map inputMap) throws WSDLException,
		ParserConfigurationException, SOAPException, IOException,
		SAXException, UnknownOperationException {

	SOAPElement result = super.build(inputMap);
               
	for (Iterator iterator = namespaceMappings.keySet().iterator(); iterator.hasNext();) {
		String namespaceURI = (String) iterator.next();
		String ns = namespaceMappings.get(namespaceURI);
		result.addNamespaceDeclaration(ns, namespaceURI);
	}
               
               result.setAttributeNS(SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE, "soapenv:encodingStyle", SOAPConstants.URI_NS_SOAP_ENCODING);

	return result;
}
 
Example 35
Project: incubator-taverna-common-activities   File: WSDLActivityFactory.java   View source code 6 votes vote down vote up
@Override
public Set<ActivityOutputPort> getOutputPorts(JsonNode configuration) {
	Set<ActivityOutputPort> outputPorts = new HashSet<>();
	try {
		WSDLParser parser = new WSDLParser(configuration.get("operation").get("wsdl")
				.textValue());
		List<TypeDescriptor> outputDescriptors = parser
				.getOperationOutputParameters(configuration.get("operation").get("name")
						.textValue());
		for (TypeDescriptor descriptor : outputDescriptors) {
			outputPorts.add(edits.createActivityOutputPort(descriptor.getName(),
					descriptor.getDepth(), descriptor.getDepth()));
		}
		// add output for attachment list
		outputPorts.add(edits.createActivityOutputPort("attachmentList", 1, 1));
	} catch (ParserConfigurationException | WSDLException | IOException | SAXException | UnknownOperationException e) {
		logger.warn(
				"Unable to parse the WSDL " + configuration.get("operation").get("wsdl").textValue(), e);
	}

	return outputPorts;
}
 
Example 36
Project: switchyard   File: WSDLUtil.java   View source code 6 votes vote down vote up
/**
 * Read the WSDL document and create a WSDL Definition.
 *
 * @param wsdlLocation location pointing to a WSDL XML definition.
 * @return the Definition.
 * @throws WSDLException If unable to read the WSDL
 */
public static Definition readWSDL(final String wsdlLocation) throws WSDLException {
    InputStream inputStream = null;
    try {
        URL url = getURL(wsdlLocation);
        inputStream = url.openStream();
        InputSource source = new InputSource(inputStream);
        source.setSystemId(url.toString());
        Document wsdlDoc = XMLHelper.getDocument(source);
        WSDLFactory wsdlFactory = WSDLFactory.newInstance();
        WSDLReader reader = wsdlFactory.newWSDLReader();
        reader.setFeature("javax.wsdl.verbose", false);
        return reader.readWSDL(url.toString(), wsdlDoc);
    } catch (Exception e) {
        throw new WSDLException(WSDLException.OTHER_ERROR,
                SOAPMessages.MESSAGES.unableToReadWSDL(wsdlLocation), e);
    } finally {
        if (inputStream != null) {
            try {
                inputStream.close();
            } catch (IOException ioe) {
                LOGGER.error(ioe);
            }
        }
    }
}
 
Example 37
Project: elpi   File: SoapService.java   View source code 6 votes vote down vote up
/**
 * Generates WSDL-document from this web service model
 * @param dispatchContext dispatch context where nested service models
 *        can be found
 * @param locationURI SOAP location URI
 * @return WSDL-document object model
 * @throws GenericServiceException if exception encountered when
 *         getting nested service model
 * @throws SAXException if XML-schema could not be parsed
 * @throws WSDLException if XML-schema type could not be found
 */
public Document toWSDL(DispatchContext dispatchContext, String locationURI)  throws GenericServiceException, ParserConfigurationException,
           SAXException, TransformerException, WSDLException {
    if (this.wsdl != null) {
        return this.wsdl;
    }
    WSDLFactory factory = WSDLFactory.newInstance();
    Definition definition = factory.newDefinition();
    definition.setTargetNamespace(namespace);
    definition.addNamespace("tns", namespace);
    definition.addNamespace("xsd", ModelService.XSD);
    definition.addNamespace("soap", SOAP);
    definition.addNamespace("wsse", WSSE);
    
    this.wsdl = modelService.generateWSDL(dispatchContext.getDelegator(), locationURI);
    SchemaImpl schemaImpl = makeSchemaImpl(wsdl, namespace);
    
    Element schema = schemaImpl.getElement();
    wsdlSchema = makeValidationSchema(schema);
    return this.wsdl;
}
 
Example 38
Project: FiWare-Template-Handler   File: CxfWSDLImporter.java   View source code 6 votes vote down vote up
public void importFrom(String url) {
  this.wsServices.clear();
  this.wsOperations.clear();
  this.structures.clear();

  this.wsdlLocation = url;

  try {
    Bus bus = BusFactory.getDefaultBus();
    WSDLManager wsdlManager = bus.getExtension(WSDLManager.class);
    Definition def = wsdlManager.getDefinition(url);
    
    WSDLServiceBuilder builder = new WSDLServiceBuilder(bus);
    List<ServiceInfo> services = builder.buildServices(def);
    
    for (ServiceInfo service : services) {
      WSService wsService = this.importService(service);
      this.wsServices.put(this.namespace + wsService.getName(), wsService);
    }
    
    this.importTypes(def.getTypes());
  } catch (WSDLException e) {
    e.printStackTrace();
  }
}
 
Example 39
Project: juddi   File: API_051_BindingTemplateWSDLTest.java   View source code 6 votes vote down vote up
@Test 
public void testClerkCall() throws ConfigurationException, WSDLException, RemoteException, TransportException, MalformedURLException {
	try {
		tckTModel.saveJoePublisherTmodel(authInfoJoe);
		tckBusiness.saveJoePublisherBusiness(authInfoJoe);
		
		UDDIClerk clerk = new UDDIClient("META-INF/uddi.xml").getClerk("joe");
		clerk.registerWsdls();
		
		
		String portTypeName = "StockQuotePortType";
		String namespace    = "http://example.com/stockquote/";
		FindTModel findTModelForPortType = WSDL2UDDI.createFindPortTypeTModelForPortType(portTypeName, namespace);
		System.out.println(new PrintUDDI<FindTModel>().print(findTModelForPortType));
		
		clerk.unRegisterWsdls();
	} catch (Exception e) {
		e.printStackTrace();
		Assert.fail();
	} finally {
		tckBusiness.deleteJoePublisherBusiness(authInfoJoe);
		tckTModel.deleteJoePublisherTmodel(authInfoJoe);
	}
}
 
Example 40
Project: juddi   File: WSDL2UDDI.java   View source code 6 votes vote down vote up
public BusinessServices registerBusinessServices(Definition wsdlDefinition) throws RemoteException, ConfigurationException, TransportException, WSDLException, MalformedURLException {

                BusinessServices businessServices = new BusinessServices();

                for (Object serviceName : wsdlDefinition.getAllServices().keySet()) {
                        QName serviceQName = (QName) serviceName;
                        Service service = wsdlDefinition.getService(serviceQName);
                        BusinessService businessService = null;
                        //add service
                        URL serviceUrl = null;
                        if (service.getPorts() != null && service.getPorts().size() > 0) {
                                for (Object portName : service.getPorts().keySet()) {
                                        businessService = registerBusinessService(serviceQName, (String) portName, serviceUrl, wsdlDefinition).getBusinessService();
                                }
                        }
                        if (businessService != null) {
                                businessServices.getBusinessService().add(businessService);
                        }
                }

                return businessServices;

        }