IVirtualComponent component = ComponentCore.createComponent(Util.getProject(projectText));
WebArtifactEdit artifactEdit = WebArtifactEdit.getWebArtifactEditForWrite(component);
WebApp webApp = (WebApp) artifactEdit.getContentModelRoot();
webApp.getServlets().add(servlet);
ServletMapping mapping = WebapplicationFactory.eINSTANCE.createServletMapping();
mapping.setServlet(servlet);
mapping.setName(servlet.getServletName());
mapping.setUrlPattern("/" + serviceUri);
webApp.getServletMappings().add(mapping);
artifactEdit.saveIfNecessary(monitor);
artifactEdit.dispose();