public BPELFromWSDLManager(URL wsdlURL) throws WSDLException, MalformedURLException, IOException, URISyntaxException{ Description wsdlBpel = reader.read(wsdlURL); Iterator<InterfaceType> itInterfaces = wsdlBpel.getInterfaces().iterator(); while(itInterfaces.hasNext()){ InterfaceType currentInterface = itInterfaces.next(); BPELProject project = new BPELGeneratorImpl().generateDefaultBPELProjectFromInterface(currentInterface.getQName(), wsdlBpel); this.bpelProjects.add(project); } }
/** * Add an import and its PLT in artefacts from a WSDL Description, a corresponding PL in BPEL * and variables corresponding to operations * @throws WSDLImportException * @throws WSDLException */ public void addPartner(Description wsdlDesc, String wsdlFileName) throws WSDLException, WSDLImportException{ addArtefactImport(URI.create(wsdlFileName), wsdlDesc); if(wsdlDesc.getInterfaces().size()>0){ PartnerLinkType plt = addPartnerLinkType(wsdlDesc.getInterfaces().get(0), wsdlDesc.getInterfaces().get(0).getQName().getLocalPart()+"Role"); PartnerLink pl = this.bpelDef.createPartnerLink(); pl.setPartnerLinkType(plt.getQName()); pl.setName(pl.getPartnerLinkType().getLocalPart().substring(0, pl.getPartnerLinkType().getLocalPart().length()-1)); if(plt.getRoles().size()>0){ pl.setPartnerRole(plt.getRoles().get(0).getName()); } createVariables(wsdlDesc); } }
public void createVariables(Description desc) { Iterator<InterfaceType> itInterface = desc.getInterfaces().iterator();//this.wsdlBpel.getInterfaces().iterator(); while(itInterface.hasNext()){ InterfaceType current = itInterface.next();
private void initWsdlArtefact(String wsdlFileName) throws SchemaException, WSDLImportException{ //Add import Import import1 = this.wsdlArtefacts.createImport(); import1.setLocationURI(URI.create(wsdlFileName)); import1.setNamespaceURI(this.wsdlBpel.getTargetNamespace()); import1.setDescription(this.wsdlBpel); this.wsdlArtefacts.addImport(import1); this.wsdlArtefacts.setTargetNamespace(this.wsdlBpel.getTargetNamespace()+"Artifacts"); Iterator<InterfaceType> itInterfaces = this.wsdlBpel.getInterfaces().iterator(); while(itInterfaces.hasNext()){ InterfaceType current = itInterfaces.next(); // Create PartnerLinkType for Bpel Interface (will be MyRole) PartnerLinkType plt = new PartnerLinkTypeImpl(new TPartnerLinkType(), this.wsdlArtefacts); QName pltQName = new QName(this.wsdlArtefacts.getTargetNamespace(), current.getQName().getLocalPart()+"PLT"); plt.setQName(pltQName); Role role = new RoleImpl(new TRole(),plt); role.setName(current.getQName().getLocalPart()+"Role"); role.setInterface(current); plt.addRole(role); this.wsdlArtefacts.addPartnerLinkType(plt); } }