BPEL2UDDI extends AnnotationProcessor { public BindingTemplate createBPELBinding(QName serviceName, String portName, URL serviceUrl, Definition wsdlDefinition) { BindingTemplate bindingTemplate = new BindingTemplate(); bindingTemplate.setServiceKey(UDDIKeyConvention.getServiceKey(properties, serviceName.getLocalPart())); String bindingKey = UDDIKeyConvention.getBindingKey(properties, serviceName, portName, serviceUrl); bindingTemplate.setBindingKey(bindingKey); AccessPoint accessPoint = new AccessPoint(); accessPoint.setUseType(AccessPointType.END_POINT.toString()); accessPoint.setValue(urlLocalizer.rewrite(serviceUrl)); bindingTemplate.setAccessPoint(accessPoint); Service service = wsdlDefinition.getService(serviceName); if (service!=null) { TModelInstanceDetails tModelInstanceDetails = new TModelInstanceDetails(); Port port = service.getPort(portName); if (port!=null) { Binding binding = port.getBinding(); String bindingDescription = properties.getProperty(Property.BINDING_DESCRIPTION, Property.DEFAULT_BINDING_DESCRIPTION); Element docElement = binding.getDocumentationElement(); if (docElement!=null && docElement.getTextContent()!=null) { bindingDescription = docElement.getTextContent(); } bindingTemplate.getDescription().addAll(Common2UDDI.mapDescription(bindingDescription, lang)); TModelInstanceInfo tModelInstanceInfoBinding = new TModelInstanceInfo(); tModelInstanceInfoBinding.setTModelKey(keyDomainURI + binding.getQName().getLocalPart()); InstanceDetails instanceDetails = new InstanceDetails(); instanceDetails.setInstanceParms(portName); tModelInstanceInfoBinding.setInstanceDetails(instanceDetails); tModelInstanceInfoBinding.getDescription().addAll(Common2UDDI.mapDescription("The wsdl:binding that this wsdl:port implements. " + bindingDescription + " The instanceParms specifies the port local name.", lang)); tModelInstanceDetails.getTModelInstanceInfo().add(tModelInstanceInfoBinding); PortType portType = binding.getPortType(); TModelInstanceInfo tModelInstanceInfoPortType = new TModelInstanceInfo(); tModelInstanceInfoPortType.setTModelKey(keyDomainURI + portType.getQName().getLocalPart()); String portTypeDescription = ""; docElement = portType.getDocumentationElement(); if (docElement!=null && docElement.getTextContent()!=null) { portTypeDescription = docElement.getTextContent(); } tModelInstanceInfoPortType.getDescription().addAll(Common2UDDI.mapDescription("The wsdl:portType that this wsdl:port implements." + portTypeDescription, lang)); tModelInstanceDetails.getTModelInstanceInfo().add(tModelInstanceInfoPortType); TModelInstanceInfo tModelInstanceInfoBPEL = new TModelInstanceInfo(); tModelInstanceInfoBPEL.setTModelKey(keyDomainURI + service.getQName().getLocalPart() + "Process"); String serviceDescription = properties.getProperty(Property.SERVICE_DESCRIPTION, Property.DEFAULT_SERVICE_DESCRIPTION); docElement = wsdlDefinition.getService(serviceName).getDocumentationElement(); if (docElement!=null && docElement.getTextContent()!=null) { serviceDescription = docElement.getTextContent(); } tModelInstanceInfoBPEL.getDescription().addAll(Common2UDDI.mapDescription("The bpel:process this wsdl:port supports." + serviceDescription, lang)); tModelInstanceDetails.getTModelInstanceInfo().add(tModelInstanceInfoBPEL); bindingTemplate.setTModelInstanceDetails(tModelInstanceDetails); } else { log.error("Could not find Port with portName: " + portName); } } else { log.error("Could not find Service with serviceName: " + serviceName.getLocalPart()); } if (log.isDebugEnabled()) { log.debug(new PrintUDDI<BindingTemplate>().print(bindingTemplate)); } return bindingTemplate; } BPEL2UDDI(UDDIClerk clerk, URLLocalizer urlLocalizer, Properties properties); String getKeyDomainURI(); void setKeyDomainURI(String keyDomainURI); UDDIClerk getClerk(); void setClerk(UDDIClerk clerk); String getLang(); void setLang(String lang); URLLocalizer getUrlLocalizer(); void setUrlLocalizer(URLLocalizer urlLocalizer); @SuppressWarnings("unchecked") BindingTemplate register(QName serviceName, String portName, URL serviceUrl, Definition wsdlDefinition); String unRegister(QName serviceName, String portName, URL serviceUrl); BusinessService lookupService(String serviceKey); BusinessService createBusinessService(QName serviceName, Definition wsdlDefinition); Set<TModel> createWSDLPortTypeTModels(String wsdlURL, Map<QName,PortType> portTypes); Set<TModel> createWSDLBindingTModels(String wsdlURL, Map<QName,Binding> bindings); TModel createBPEL4WSProcessTModel(QName serviceName, String targetNamespace, Map<QName,PortType> portTypes, String bpelOverviewURL); BindingTemplate createBPELBinding(QName serviceName, String portName, URL serviceUrl, Definition wsdlDefinition); FindTModel createFindTModelForProcessName(QName serviceName); FindTModel createFindProcessesForPortTypes(String portTypeKey); GetTModelDetail createFindAllPortTypesForProcess_1(String processKey); GetTModelDetail createFindAllPortTypesForProcess_2(List<String> portTypeTModelKeys); FindBinding createFindImplementationsForProcess(String processKey);  }
@Test public void testHelloWorld_BPELBinding() throws WSDLException, JAXBException, MalformedURLException, Exception { String portName = "HelloPort"; QName serviceName = new QName ("http: URL serviceUrl = new URL("http: Definition wsdlDefinition = rw.readWSDL("bpel/HelloWorld.wsdl"); BindingTemplate binding = bpel2UDDI.createBPELBinding(serviceName, portName, serviceUrl, wsdlDefinition); System.out.println("***** WSDL Port BindingTemplate: " + binding.getBindingKey()); if (serialize) System.out.println(pBinding.print(binding)); Assert.assertNotNull(binding.getTModelInstanceDetails()); }