Java Code Examples for javax.wsdl.Definition#getAllBindings()

The following examples show how to use javax.wsdl.Definition#getAllBindings() . These examples are extracted from open source projects. 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 Project: juddi   File: BPEL2UDDITest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testHelloWorld_UDDIBindingModel() throws WSDLException, JAXBException, Exception {

	// Reading the WSDL
	Definition wsdlDefinition = rw.readWSDL("bpel/HelloWorld.wsdl");
    @SuppressWarnings("unchecked")
	Map<QName,Binding> bindings = (Map<QName,Binding>) wsdlDefinition.getAllBindings();
    Set<TModel> bindingTModels = bpel2UDDI.createWSDLBindingTModels(wsdlDefinition.getDocumentBaseURI(), bindings);
    
	for (TModel tModel : bindingTModels) {
		System.out.println("***** UDDI Binding TModel: " + tModel.getName().getValue());
                       if (serialize)
		System.out.println(pTModel.print(tModel));
	}
	Assert.assertEquals(1,bindingTModels.size());
}
 
Example 2
Source Project: juddi   File: WSDL2UDDITest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testWSDLBindingModel() throws WSDLException, JAXBException, ConfigurationException, Exception {

	// Reading the WSDL
	Definition wsdlDefinition = rw.readWSDL("wsdl/HelloWorld.wsdl");
	String wsdlURL = wsdlDefinition.getDocumentBaseURI();
	
	Properties properties = new Properties();
	properties.put("keyDomain", "juddi.apache.org");
	WSDL2UDDI wsdl2UDDI = new WSDL2UDDI(null, new URLLocalizerDefaultImpl(), properties);
	Set<TModel> tModels = new HashSet<TModel>();
    @SuppressWarnings("unchecked")
	Map<QName,Binding> bindings= (Map<QName,Binding>) wsdlDefinition.getAllBindings();
    Set<TModel> bindingTModels = wsdl2UDDI.createWSDLBindingTModels(wsdlURL, bindings);
    tModels.addAll(bindingTModels);
    
	for (TModel tModel : tModels) {
		System.out.println("UDDI Binding TModel " + tModel.getName().getValue());
                       if (serialize)
		System.out.println(pTModel.print(tModel));
	}
	Assert.assertEquals(1,tModels.size());
}
 
Example 3
Source Project: juddi   File: WSDL2UDDI.java    License: Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public ServiceRegistrationResponse registerBusinessService(QName serviceQName, String portName, URL serviceUrl, Definition wsdlDefinition) throws RemoteException, ConfigurationException, TransportException, WSDLException, MalformedURLException {

        String genericWSDLURL = wsdlDefinition.getDocumentBaseURI();   //TODO maybe point to repository version
        ServiceRegistrationResponse response = new ServiceRegistrationResponse();
        String serviceKey = UDDIKeyConvention.getServiceKey(properties, serviceQName.getLocalPart());
        BusinessService businessService = lookupService(serviceKey);
        if (businessService == null) {
                List<TModel> tModels = new ArrayList<TModel>();
                // Create the PortType tModels
                Map<QName, PortType> portTypes = (Map<QName, PortType>) wsdlDefinition.getAllPortTypes();
                tModels.addAll(createWSDLPortTypeTModels(genericWSDLURL, portTypes));
                // Create the Binding tModels
                Map<QName, Binding> bindings = (Map<QName, Binding>) wsdlDefinition.getAllBindings();
                tModels.addAll(createWSDLBindingTModels(genericWSDLURL, bindings));
                // Register these tModels
                for (TModel tModel : tModels) {
                        clerk.register(tModel);
                }
                // Service
                businessService = createBusinessService(serviceQName, wsdlDefinition);
                // Register this Service
                clerk.register(businessService);
        }
        //Add the BindingTemplate to this Service
        BindingTemplate binding = createWSDLBinding(serviceQName, portName, serviceUrl, wsdlDefinition);
        // Register BindingTemplate
        if (binding.getAccessPoint() != null) {
                clerk.register(binding);
                if (businessService.getBindingTemplates() == null) {
                        businessService.setBindingTemplates(new BindingTemplates());
                }
                businessService.getBindingTemplates().getBindingTemplate().add(binding);
                response.setBindingKey(binding.getBindingKey());
        }
        response.setBusinessService(businessService);
        return response;
}
 
Example 4
Source Project: juddi   File: BPEL2UDDI.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 1. Register PortType tModels
 * 2. Register WSDL BPEL4WS Process
 * 3. Register WSDL Port
 * 4. Register Process Service
 * 5. Register Binding
 * 
 * @param serviceName - QName of the service
 * @param portName - portName of the service
 * @param serviceUrl - URL at which the service can be invoked
 * @param wsdlDefinition - WSDL Definition of the Web Service
        * @return a binding template
 * @throws WSDLException 
 * @throws MalformedURLException 
 * @throws TransportException 
 * @throws ConfigurationException 
 * @throws RemoteException 
 */
@SuppressWarnings("unchecked")
public BindingTemplate register(QName serviceName, String portName, URL serviceUrl, Definition wsdlDefinition) 
	throws WSDLException, MalformedURLException, RemoteException, ConfigurationException, TransportException 
{
	String targetNamespace = wsdlDefinition.getTargetNamespace();
	String genericWSDLURL  = wsdlDefinition.getDocumentBaseURI();   //TODO maybe point to repository version
	String bpelOverviewURL = "http://localhost:8080/bpel-console/"; //TODO maybe point to bpel in console
	
	String serviceKey = UDDIKeyConvention.getServiceKey(properties, serviceName.getLocalPart());
	BusinessService service = lookupService(serviceKey);
	if (service==null) {
		List<TModel> tModels = new ArrayList<TModel>();
		// Create the PortType tModels
		Map<QName,PortType> portTypes = (Map<QName,PortType>) wsdlDefinition.getAllPortTypes();
		tModels.addAll(createWSDLPortTypeTModels(genericWSDLURL, portTypes));
		// Create the Binding tModels
		Map<QName,Binding> bindings = (Map<QName,Binding>) wsdlDefinition.getAllBindings();
		tModels.addAll(createWSDLBindingTModels(genericWSDLURL, bindings));
		// Create the BPEL4WS tModel
		TModel bpel4WSTModel = createBPEL4WSProcessTModel(serviceName, targetNamespace, portTypes, bpelOverviewURL);
	    tModels.add(bpel4WSTModel);
	    // Register these tModels
	    for (TModel tModel : tModels) {
			clerk.register(tModel);
		}
	    // BPEL Service
	    service = createBusinessService(serviceName, wsdlDefinition);
	    // Register this BPEL Service
	    clerk.register(service);
	}
	//Add the BindingTemplate to this Service
	BindingTemplate binding = createBPELBinding(serviceName, portName, serviceUrl, wsdlDefinition);
	// Register BindingTemplate
	clerk.register(binding);
	return binding;
}