public List getWsdlServicesFromWsilFile(IFile wsil) { List result = new ArrayList(); WebServiceEntity entity = parseWsilFile(wsil); if (entity != null && entity.getType() == WebServiceEntity.TYPE_WSIL) { // get all the WSDL references from the WSIL entity List wsdlList = entity.getChildren(); for (Iterator it = wsdlList.iterator(); it.hasNext();) { Object item = it.next(); if (item != null && item instanceof WebServiceEntity) { if (((WebServiceEntity) item).getModel() != null && ((WebServiceEntity) item).getModel() instanceof Definition) { Definition def = (Definition) ((WebServiceEntity) item).getModel(); if (def != null && !def.getServices().isEmpty()) result.addAll(def.getServices().values()); } } } } return result; } public WebServiceEntity parseWsilFile(IFile wsil) {
public Definition getWSDLDefinitionVerbose(String wsdlURI) throws MalformedURLException, IOException, WWWAuthenticationException, WSDLException { WebServiceEntity wsEntity = getWebServiceEntityByURI(wsdlURI); if (wsEntity == null) { wsEntity = new WebServiceEntity(); wsEntity.setURI(wsdlURI); uriToEntityTable_.put(wsdlURI, wsEntity); } Definition definition = (Definition)wsEntity.getModel(); if (definition == null) { byte[] b = getInputStreamAsByteArray(wsdlURI); wsEntity.setBytes(b); setHTTPSettings(wsEntity); ByteArrayInputStream bais = new ByteArrayInputStream(b); WSDLFactory factory = WSDLPlugin.INSTANCE.createWSDL4JFactory(); WSDLReader wsdlReader = factory.newWSDLReader(); definition = wsdlReader.readWSDL(wsdlURI, new InputSource(bais)); wsEntity.setType(WebServiceEntity.TYPE_WSDL); wsEntity.setModel(definition); } return definition; }
discoEntity.setBytes(b); setHTTPSettings(discoEntity); ByteArrayInputStream bais = new ByteArrayInputStream(b); String ref = reference.getRef(); String docRef = reference.getDocRef(); WebServiceEntity wsdlEntity = new WebServiceEntity(); wsdlEntity.setType(WebServiceEntity.TYPE_WSDL); wsdlEntity.setURI(ref); wsdlEntity.setDocumentation(docRef); associate(discoEntity,wsdlEntity); uriToEntityTable_.put(ref,wsdlEntity); if (discoLinkEntity == null) discoLinkEntity = new WebServiceEntity(); discoLinkEntity.setType(WebServiceEntity.TYPE_DISCO); discoLinkEntity.setURI(ref); uriToEntityTable_.put(ref,discoLinkEntity); if ((parseOption | PARSE_LINKS) == parseOption)
public IStatus getStatus() { entity_ = getSelectionAsWebServiceEntity(); if (entity_ == null || entity_.getType() != WebServiceEntity.TYPE_WSDL) return StatusUtils.errorStatus( ConsumptionUIMessages.PAGE_MSG_SELECTION_MUST_BE_WSDL ); else return Status.OK_STATUS; }
private void parseWSIL(String wsilURI, int parseOption, String byteEncoding ) throws WSILException, MalformedURLException, IOException, WSDLException, WWWAuthenticationException WSILDocument wsilDoc = (WSILDocument)wsilEntity.getModel(); if (wsilDoc != null) WebServiceEntity wsdlEntity = new WebServiceEntity(); wsdlEntity.setType(WebServiceEntity.TYPE_WSDL); wsdlEntity.setURI(absoluteURI); wsdlEntity.setDocumentation(documentation); associate(wsilEntity, wsdlEntity); uriToEntityTable_.put(absoluteURI, wsdlEntity); String inquiryURL = sd.getLocation(); String serviceKey = sd.getServiceKey().getText(); WebServiceEntity uddiServiceEntity = new WebServiceEntity(); uddiServiceEntity.setType(WebServiceEntity.TYPE_UDDI_SERVICE); String uddiServiceKeyURI = UDDIURIHelper.getServiceKeyURI(serviceKey,inquiryURL); uddiServiceEntity.setURI(uddiServiceKeyURI); uddiServiceEntity.setDocumentation(documentation); associate(wsilEntity,uddiServiceEntity); uriToEntityTable_.put(uddiServiceKeyURI,uddiServiceEntity); wsilLinkEntity = new WebServiceEntity(); wsilLinkEntity.setType(WebServiceEntity.TYPE_WSIL); wsilLinkEntity.setURI(absoluteURI); wsilLinkEntity.setDocumentation(documentation); uriToEntityTable_.put(absoluteURI, wsilLinkEntity); if ((parseOption | PARSE_LINKS) == parseOption)
if (wsEntity == null || !wsEntity.isEntityResolved()) if (wsEntity != null && wsEntity.getType() == WebServiceEntity.TYPE_WSDL) String httpUsername = wsEntity.getHTTPUsername(); String httpPassword = wsEntity.getHTTPPassword(); if (httpUsername != null && httpPassword != null)
public Object[] getChildren(Object parentElement) { if (parentElement instanceof WebServiceEntity) { List list = ((WebServiceEntity)parentElement).getChildren(); Object[] objects = new Object[list.size()]; for (int i = 0; i < objects.length; i++) objects[i] = list.get(i); return objects; } return new Object[0]; }
public Object getParent(Object element) { if (element instanceof WebServiceEntity) return ((WebServiceEntity)element).getParent(); return new Object[0]; }
if (wsEntity != null) byte[] bytes = wsEntity.getBytes(); if (bytes != null) return bytes;
WebServiceEntity wsEntity = new WebServiceEntity(); wsEntity.setURI(theUri); byte[] b = getInputStreamAsByteArray(theUri); wsEntity.setBytes(b); setHTTPSettings(wsEntity); uriToEntityTable_.put(theUri, wsEntity); wsEntity.setType(WebServiceEntity.TYPE_HTML); for (int i = 0; i < wsilURIs.length; i++) WebServiceEntity wsilEntity = new WebServiceEntity(); wsilEntity.setType(WebServiceEntity.TYPE_WSIL); wsilEntity.setURI(absoluteURI); associate(wsEntity, wsilEntity); uriToEntityTable_.put(absoluteURI, wsilEntity); WebServiceEntity discoEntity = new WebServiceEntity(); discoEntity.setType(WebServiceEntity.TYPE_DISCO); discoEntity.setURI(discoURIs[i]); associate(wsEntity,discoEntity); uriToEntityTable_.put(discoURIs[i],discoEntity); wsEntity.setType(WebServiceEntity.TYPE_WSIL); wsEntity.setType(WebServiceEntity.TYPE_DISCO); wsEntity.setType(WebServiceEntity.TYPE_WSDL);
public Image getImage(Object element) { switch (((WebServiceEntity)element).getType()) { case WebServiceEntity.TYPE_HTML: return WebServiceConsumptionUIPlugin.getImageDescriptor("icons/wsil/html.gif").createImage(); case WebServiceEntity.TYPE_WSIL: return WebServiceConsumptionUIPlugin.getImageDescriptor("icons/wsil/wsil.gif").createImage(); case WebServiceEntity.TYPE_WSDL: return WebServiceConsumptionUIPlugin.getImageDescriptor("icons/wsil/wsdl.gif").createImage(); default: return null; } }
public boolean validate(String s) { String wsURI = s; if (wsURI.indexOf(':') < 0) { IFile file = uri2IFile(wsURI); if (file != null) wsURI = iFile2URI(file); } if (wsURI != null && wsURI.indexOf(':') >= 0 && webServicesParser.getWebServiceEntityByURI(wsURI) == null) { TimedWSDLSelectionConditionCommand cmd = new TimedWSDLSelectionConditionCommand(); cmd.setWebServicesParser(webServicesParser); cmd.setWebServiceURI(wsURI); cmd.execute(null, null); } // prime widget based on the string wsdlURI_ = wsURI; if (tree != null) tree.setWebServiceURI(wsURI); WebServiceEntity entity = webServicesParser.getWebServiceEntityByURI(wsURI); if (entity != null && entity.getType() == WebServiceEntity.TYPE_WSDL) return true; else return false; } }
private void handleWebServiceURI(String wsURI) { if (wsURI.indexOf(':') < 0) { IFile file = uri2IFile(wsURI); if (file != null) wsURI = iFile2URI(file); } if (wsURI != null && wsURI.indexOf(':') >= 0 && webServicesParser.getWebServiceEntityByURI(wsURI) == null) { TimedWSDLSelectionConditionCommand cmd = new TimedWSDLSelectionConditionCommand(); cmd.setWebServicesParser(webServicesParser); cmd.setWebServiceURI(wsURI); cmd.execute(null, null); } WebServiceEntity entity = webServicesParser.getWebServiceEntityByURI(wsURI); if (entity != null && entity.getType() == WebServiceEntity.TYPE_WSDL) tree.setEnabled(false); else tree.setEnabled(true); tree.setWebServiceURI(wsURI); tree.refreshTreeViewer(); wsdlURI_ = wsURI; }
if (wsEntity != null) int type = wsEntity.getType(); if (type != WebServiceEntity.TYPE_WSDL) needWSDLSelectionTreeWidget = true;