List of usage examples for javax.xml.namespace QName getNamespaceURI
public String getNamespaceURI()
Get the Namespace URI of this QName
.
From source file:org.apache.juddi.v3.bpel.BPEL_020_IntegrationTest.java
@Test public void parseWSDL_PortTypeTModels() throws WSDLException, Exception { Definition wsdlDefinition = rw.readWSDL("uddi_data/bpel/riftsaw/bpel-technote.wsdl"); @SuppressWarnings("unchecked") Map<QName, PortType> portTypes = (Map<QName, PortType>) wsdlDefinition.getAllPortTypes(); String ns = wsdlDefinition.getTargetNamespace(); System.out.println("Namespace: " + ns); int i = 0;//from w w w.j a v a 2 s . co m for (QName qName : portTypes.keySet()) { String nsp = qName.getNamespaceURI(); String localpart = qName.getLocalPart(); System.out.println("Namespace: " + nsp); System.out.println("LocalPart: " + localpart); if (i++ == 0) { Assert.assertEquals("InterfaceOfTravelAgent", localpart); } else { Assert.assertEquals("InterfaceOfCustomer", localpart); } } }
From source file:org.apache.juddi.v3.client.mapping.wsdl.BPEL2UDDI.java
/** Finds and returns ALL the tModels related to the process, so that i.e. they * can be removed on undeployment of the service. * //from ww w .j av a2s . c o m * @param serviceName * @return a tModel if found */ public FindTModel createFindTModelForProcessName(QName serviceName) { FindTModel findTModel = new FindTModel(); Name name = new Name(); //name.setLang(lang); name.setValue(serviceName.getLocalPart()); findTModel.setName(name); CategoryBag categoryBag = new CategoryBag(); String namespace = serviceName.getNamespaceURI(); if (namespace != null && namespace.length() != 0) { KeyedReference namespaceReference = WSDL2UDDI.newKeyedReference("uddi:uddi.org:xml:namespace", "uddi-org:xml:namespace", namespace); categoryBag.getKeyedReference().add(namespaceReference); } KeyedReference typesReference = WSDL2UDDI.newKeyedReference("uddi:uddi.org:bpel:types", "uddi-org:bpel:types", "process"); categoryBag.getKeyedReference().add(typesReference); findTModel.setCategoryBag(categoryBag); if (log.isDebugEnabled()) { log.debug(new PrintUDDI<FindTModel>().print(findTModel)); } return findTModel; }
From source file:org.apache.juddi.v3.client.mapping.wsdl.WSDL2UDDI.java
/** * <h3>2.4.2 wsdl:binding -> uddi:tModel</h3> * * <p>//from w ww. java 2 s .c o m * A wsdl:binding MUST be modeled as a uddi:tModel. The minimum * information that must be captured about a binding is its entity type, * its local name, its namespace, the location of the WSDL document that * defines the binding, the portType that it implements, its protocol, * and, optionally, the transport information. Capturing the entity type * enables users to search for tModels that represent binding artifacts. * Capturing the local name, namespace, and WSDL location enables users * to locate the definition of the specified binding artifact. The link * to the portType enables users to search for bindings that implement a * particular portType.</p> * * <p> * A wsdl:binding corresponds to a WSDL service interface definition as * defined by the mapping in the Version 1 Best Practice. To maintain * compatibility with the previous mapping, the binding must also be * characterized as type "wsdlSpec".</p> * * <p> * The wsdl:binding information is captured as follows:</p> * * <p> * The uddi:name element of the tModel MUST be the value of the name * attribute of the wsdl:binding.</p> * * <p> * The tModel MUST contain a categoryBag, and the categoryBag MUST * contain at least the following keyedReference elements:</p> <ol> <li> * A keyedReference with a tModelKey of the WSDL Entity Type category * system and a keyValue of "binding".</li> <li> A keyedReference with a * tModelKey of the WSDL portType Reference category system and a * keyValue of the tModelKey that models the wsdl:portType to which the * wsdl:binding relates.</li> <li> A keyedReference with a tModelKey of * the UDDI Types category system and a keyValue of "wsdlSpec" for * backward compatibility[1].</li> <li> One or two keyedReferences as * required to capture the protocol and optionally the transport * information refer to the next section.</li> </ol> * * <p> * If the wsdl:binding has a targetNamespace then the categoryBag MUST * also contain an additional keyedReference with a tModelKey of the XML * Namespace category system and a keyValue of the target namespace of * the wsdl:definitions element that contains the wsdl:binding. If the * targetNamespace is absent from the binding, a categoryBag MUST NOT * contain a keyedReference to the XML Namespace category system.</p> * * <p> * The tModel MUST contain an overviewDoc with an overviewURL containing * the location of the WSDL document that describes the * wsdl:binding.</p> * * <h4>2.4.2.1 wsdl:binding Extensions</h4> * * <p> * Information about the protocol and transport, if applicable, * specified in an extension to the wsdl:binding is used to categorize * the binding tModel as described in the following sections. This * information is specified using two of the category systems defined in * this Technical Note:</p> <ol> <li> Protocol Categorization</li> <li> * Transport Categorization</li> </ol> * <p> * The valid values for the Protocol Categorization category system are * tModelKeys of tModels that are categorized as protocol tModels. * Similarly, the valid values for the Transport Categorization category * system are tModelKeys of tModels that are categorized as transport * tModels.</p> * <p> * The reason for having these two categorization schemes that take * tModel keys as values is to allow other standard or proprietary * protocols and transports to be defined and used in the same way as * the standard SOAP and HTTP protocols and transport.</p> * * <h4>2.4.2.1.1 soap:binding</h4> * * <p> * If the wsdl:binding contains a soap:binding extensibility element * from the http://schemas.xmlsoap.org/wsdl/soap/ namespace then the * categoryBag MUST include a keyedReference with a tModelKey of the * Protocol Categorization category system and a keyValue of the * tModelKey of the SOAP Protocol tModel.</p> * * <p> * If the value of the transport attribute of the soap:binding element * is http://schemas.xmlsoap.org/soap/http then the categoryBag MUST * include a keyedReference with a tModelKey of the Transport * Categorization category system and a keyValue of the tModelKey of the * HTTP Transport tModel.</p> * * <p> * If the value of the transport attribute is anything else, then the * bindingTemplate MUST include an additional keyedReference with a * tModelKey of the Transport Categorization category system and a * keyValue of the tModelKey of an appropriate transport tModel.</p> * * <h4>2.4.2.1.2 http:binding</h4> * * <p> * If the wsdl:binding contains an http:binding extensibility element * from the http://schemas.xmlsoap.org/wsdl/http/ namespace then the * categoryBag MUST include a keyedReference with a tModelKey of the * Protocol Categorization category system and a keyValue of the * tModelKey of the HTTP Protocol tModel.</p> * * <p> * Note that this is a different tModel from the HTTP Transport tModel, * and in this case there is no separate transport tModel, and therefore * no keyedReference in the categoryBag from the Transport * Categorization category system.</p> * * <h4>2.4.2.1.3 Other wsdl:binding Extensions</h4> * * <p> * Other wsdl:binding extensibility elements are handled in a similar * fashion. It is assumed that vendors who provide other bindings will * provide the appropriate protocol and transport tModels.</p> * * Example Code * <pre> * URL url = new URL("http://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php?wsdl"); * String domain = url.getHost(); * ReadWSDL rw = new ReadWSDL(); * Definition wsdlDefinition = rw.readWSDL(url); * properties.put("keyDomain", domain); * properties.put("businessName", domain); * properties.put("serverName", url.getHost()); * properties.put("serverPort", url.getPort()); * wsdlURL = wsdlDefinition.getDocumentBaseURI(); * WSDL2UDDI wsdl2UDDI = new WSDL2UDDI(null, new URLLocalizerDefaultImpl(), properties); * Map allBindings = wsdlDefinition.getAllBindings(); * Set<TModel> createWSDLBindingTModels = wsdl2UDDI.createWSDLBindingTModels(url.toString(), allBindings); * </pre> * * @param wsdlURL * @param bindings Map * @return set of WSDL Binding tModels * @throws WSDLException */ public Set<TModel> createWSDLBindingTModels(String wsdlURL, Map<QName, Binding> bindings) throws WSDLException { Set<TModel> tModels = new HashSet<TModel>(); //Register a tModel for each portType for (QName qName : bindings.keySet()) { String localpart = qName.getLocalPart(); String namespace = qName.getNamespaceURI(); // Build the tModel TModel tModel = new TModel(); // Set the Key tModel.setTModelKey(keyDomainURI + localpart); // Set the Name Name name = new Name(); name.setLang(lang); name.setValue(localpart); tModel.setName(name); // Set the OverviewURL OverviewURL overviewURL = new OverviewURL(); overviewURL.setUseType(AccessPointType.WSDL_DEPLOYMENT.toString()); overviewURL.setValue(wsdlURL); OverviewDoc overviewDoc = new OverviewDoc(); overviewDoc.setOverviewURL(overviewURL); tModel.getOverviewDoc().add(overviewDoc); // Set the categoryBag CategoryBag categoryBag = new CategoryBag(); if (namespace != null && !"".equals(namespace)) { // A keyedReference with a tModelKey of the WSDL Entity Type category system and a keyValue of "binding". KeyedReference namespaceReference = newKeyedReference("uddi:uddi.org:xml:namespace", "uddi-org:xml:namespace", namespace); categoryBag.getKeyedReference().add(namespaceReference); } // A keyedReference with a tModelKey of the WSDL Entity Type category system and a keyValue of "binding". KeyedReference typesReference = newKeyedReference("uddi:uddi.org:wsdl:types", "uddi-org:wsdl:types", "binding"); categoryBag.getKeyedReference().add(typesReference); // A keyedReference with a tModelKey of the WSDL portType Reference category system and a keyValue // of the tModelKey that models the wsdl:portType to which the wsdl:binding relates. Binding binding = bindings.get(qName); String portTypeKey = keyDomainURI + binding.getPortType().getQName().getLocalPart(); KeyedReference namespaceReference = newKeyedReference("uddi:uddi.org:wsdl:porttypereference", "uddi-org:wsdl:portTypeReference", portTypeKey); categoryBag.getKeyedReference().add(namespaceReference); // A keyedReference with a tModelKey of the UDDI Types category system and a keyValue of // "wsdlSpec" for backward compatibility. KeyedReference typesReferenceBackwardsCompatible = newKeyedReference( "uddi:uddi.org:categorization:types", "uddi-org:types", "wsdlSpec"); categoryBag.getKeyedReference().add(typesReferenceBackwardsCompatible); // One or two keyedReferences as required to capture the protocol for (Object object : binding.getExtensibilityElements()) { SOAPBinding sb = null; SOAP12Binding sb12 = null; HTTPBinding hb = null; try { hb = (HTTPBinding) object; } catch (Exception x) { } try { sb = (SOAPBinding) object; } catch (Exception x) { } try { sb12 = (SOAP12Binding) object; } catch (Exception x) { } if (sb != null) { // If the wsdl:binding contains a soap:binding extensibility element from the // 'http://schemas.xmlsoap.org/wsdl/soap/' namespace then the categoryBag MUST //include a keyedReference with a tModelKey of the Protocol Categorization // category system and a keyValue of the tModelKey of the SOAP Protocol tModel. SOAPBinding soapBinding = sb; KeyedReference soapProtocol = newKeyedReference("uddi:uddi.org:wsdl:categorization:protocol", "uddi-org:protocol:soap", "uddi:uddi.org:protocol:soap"); categoryBag.getKeyedReference().add(soapProtocol); // If the value of the transport attribute of the soap:binding element // is 'http://schemas.xmlsoap.org/soap/http' then the categoryBag MUST // include a keyedReference with a tModelKey of the Transport Categorization // category system and a keyValue of the tModelKey of the HTTP Transport tModel. if ("http://schemas.xmlsoap.org/soap/http".equals(soapBinding.getTransportURI())) { KeyedReference httpTransport = newKeyedReference( "uddi:uddi.org:wsdl:categorization:transport", "uddi-org:http", "uddi:uddi.org:transport:http"); categoryBag.getKeyedReference().add(httpTransport); } else if (soapBinding.getTransportURI() != null) { // TODO If the value of the transport attribute is anything else, // then the bindingTemplate MUST include an additional keyedReference with a tModelKey // of the Transport Categorization category system and a keyValue of the tModelKey of // an appropriate transport tModel. log.warn("not implemented, binding transport is " + soapBinding.getTransportURI()); } } else if (hb != null) { // If the wsdl:binding contains an http:binding extensibility element from the // http://schemas.xmlsoap.org/wsdl/http/ namespace then the categoryBag MUST // include a keyedReference with a tModelKey of the Protocol Categorization // category system and a keyValue of the tModelKey of the HTTP Protocol tModel. KeyedReference soapProtocol = newKeyedReference("uddi:uddi.org:wsdl:categorization:protocol", "uddi-org:protocol:http", "uddi:uddi.org:protocol:http"); categoryBag.getKeyedReference().add(soapProtocol); } else if (sb12 != null) { // If the wsdl:binding contains a soap:binding extensibility element from the // 'http://schemas.xmlsoap.org/wsdl/soap/' namespace then the categoryBag MUST //include a keyedReference with a tModelKey of the Protocol Categorization // category system and a keyValue of the tModelKey of the SOAP Protocol tModel. KeyedReference soapProtocol = newKeyedReference("uddi:uddi.org:wsdl:categorization:protocol", "uddi-org:protocol:soap", "uddi:uddi.org:protocol:soap"); categoryBag.getKeyedReference().add(soapProtocol); // If the value of the transport attribute of the soap:binding element // is 'http://schemas.xmlsoap.org/soap/http' then the categoryBag MUST // include a keyedReference with a tModelKey of the Transport Categorization // category system and a keyValue of the tModelKey of the HTTP Transport tModel. if ("http://schemas.xmlsoap.org/soap/http".equals(sb12.getTransportURI())) { KeyedReference httpTransport = newKeyedReference( "uddi:uddi.org:wsdl:categorization:transport", "uddi-org:http", "uddi:uddi.org:transport:http"); categoryBag.getKeyedReference().add(httpTransport); } else if (sb12.getTransportURI() != null) { // TODO If the value of the transport attribute is anything else, // then the bindingTemplate MUST include an additional keyedReference with a tModelKey // of the Transport Categorization category system and a keyValue of the tModelKey of // an appropriate transport tModel. log.warn("not implemented, binding transport is " + sb12.getTransportURI()); } } else { log.warn("Unrecongnized binding type: " + object.getClass().getCanonicalName() + ". Generated" + "binding tModel may be missing the required (according to WSDL2UDDI spec) " + "uddi:uddi.org:wsdl:categorization:protocol keyedReference."); } } tModel.setCategoryBag(categoryBag); tModels.add(tModel); } return tModels; }
From source file:org.apache.juddi.v3.client.mapping.wsdl.WSDL2UDDI.java
/** * <h3>2.4.1 wsdl:portType -> uddi:tModel</h3> * * <p>/*from w w w .ja v a2s. c om*/ * A wsdl:portType MUST be modeled as a uddi:tModel.</p> * * <p> * The minimum information that must be captured about a portType is its * entity type, its local name, its namespace, and the location of the * WSDL document that defines the portType. Capturing the entity type * enables users to search for tModels that represent portType * artifacts. Capturing the local name, namespace, and WSDL location * enables users to locate the definition of the specified portType * artifact.</p> * * <p> * The wsdl:portType information is captured as follows:</p> * * <p> * The uddi:name element of the tModel MUST be the value of the name * attribute of the wsdl:portType.</p> * * <p> * The tModel MUST contain a categoryBag, and the categoryBag MUST * contain a keyedReference with a tModelKey of the WSDL Entity Type * category system and a keyValue of "portType".</p> * * <p> * If the wsdl:portType has a targetNamespace then the categoryBag MUST * also contain an additional keyedReference with a tModelKey of the XML * Namespace category system and a keyValue of the target namespace of * the wsdl:definitions element that contains the wsdl:portType. If the * targetNamespace is absent from the portType, a categoryBag MUST NOT * contain a keyedReference to the XML Namespace category system.</p> * * <p> * The tModel MUST contain an overviewDoc with an overviewURL containing * the location of the WSDL document that describes the * wsdl:portType.</p> * Example Code * <pre> * URL url = new URL("http://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php?wsdl"); * String domain = url.getHost(); * ReadWSDL rw = new ReadWSDL(); * Definition wsdlDefinition = rw.readWSDL(url); * properties.put("keyDomain", domain); * properties.put("businessName", domain); * properties.put("serverName", url.getHost()); * properties.put("serverPort", url.getPort()); * wsdlURL = wsdlDefinition.getDocumentBaseURI(); * WSDL2UDDI wsdl2UDDI = new WSDL2UDDI(null, new URLLocalizerDefaultImpl(), properties); * Map<QName, PortType> portTypes = (Map<QName, PortType>) wsdlDefinition.getAllPortTypes(); * Set<TModel> portTypeTModels = wsdl2UDDI.createWSDLPortTypeTModels(wsdlURL, portTypes); * </pre> * * @param wsdlURL This is used to set the Overview URL * @param portTypes Map * @return set of WSDL PortType tModels * @throws WSDLException */ public Set<TModel> createWSDLPortTypeTModels(String wsdlURL, Map<QName, PortType> portTypes) throws WSDLException { Set<TModel> tModels = new HashSet<TModel>(); // Create a tModel for each portType for (QName qName : portTypes.keySet()) { // Build the tModel TModel tModel = new TModel(); String localpart = qName.getLocalPart(); String namespace = qName.getNamespaceURI(); // Set the Key tModel.setTModelKey(keyDomainURI + localpart); // Set the Name. The uddi:name element of the tModel MUST be the value of // the name attribute of the wsdl:portType. Name name = new Name(); name.setLang(lang); name.setValue(localpart); tModel.setName(name); // Set the OverviewURL. The tModel MUST contain an overviewDoc with an // overviewURL containing the location of the WSDL document that // describes the wsdl:portType. OverviewURL overviewURL = new OverviewURL(); overviewURL.setUseType(AccessPointType.WSDL_DEPLOYMENT.toString()); overviewURL.setValue(wsdlURL); OverviewDoc overviewDoc = new OverviewDoc(); overviewDoc.setOverviewURL(overviewURL); tModel.getOverviewDoc().add(overviewDoc); // Create the categoryBag, The tModel MUST contain a categoryBag CategoryBag categoryBag = new CategoryBag(); // the categoryBag MUST contain a keyedReference with a tModelKey of the WSDL // Entity Type category system and a keyValue of "portType". KeyedReference typesReference = newKeyedReference("uddi:uddi.org:wsdl:types", "uddi-org:wsdl:types", "portType"); categoryBag.getKeyedReference().add(typesReference); // If the wsdl:portType has a targetNamespace then the categoryBag MUST also contain an // additional keyedReference with a tModelKey of the XML Namespace category system and a // keyValue of the target namespace of the wsdl:definitions element that contains the // wsdl:portType. If the targetNamespace is absent from the portType, a categoryBag // MUST NOT contain a keyedReference to the XML Namespace category system. if (namespace != null && !"".equals(namespace)) { KeyedReference namespaceReference = newKeyedReference("uddi:uddi.org:xml:namespace", "uddi-org:xml:namespace", namespace); categoryBag.getKeyedReference().add(namespaceReference); } tModel.setCategoryBag(categoryBag); tModels.add(tModel); } return tModels; }
From source file:org.apache.juddi.v3.client.mapping.wsdl.WSDL2UDDI.java
/** * Creates a UDDI Business Service./* www .j ava 2 s . co m*/ * * @param serviceQName * @param wsdlDefinition * @return a business service */ protected BusinessService createBusinessService(QName serviceQName, Definition wsdlDefinition) { log.debug("Constructing Service UDDI Information for " + serviceQName); BusinessService service = new BusinessService(); // BusinessKey service.setBusinessKey(businessKey); // ServiceKey service.setServiceKey(UDDIKeyConvention.getServiceKey(properties, serviceQName.getLocalPart())); // Description String serviceDescription = properties.getProperty(Property.SERVICE_DESCRIPTION, Property.DEFAULT_SERVICE_DESCRIPTION); // Override with the service description from the WSDL if present if (wsdlDefinition.getService(serviceQName) != null) { Element docElement = wsdlDefinition.getService(serviceQName).getDocumentationElement(); if (docElement != null && docElement.getTextContent() != null) { serviceDescription = docElement.getTextContent(); } } service.getDescription().addAll(Common2UDDI.mapDescription(serviceDescription, lang)); // Service name Name sName = new Name(); sName.setLang(lang); sName.setValue(serviceQName.getLocalPart()); service.getName().add(sName); CategoryBag categoryBag = new CategoryBag(); String namespace = serviceQName.getNamespaceURI(); if (namespace != null && namespace.length() != 0) { KeyedReference namespaceReference = newKeyedReference("uddi:uddi.org:xml:namespace", "uddi-org:xml:namespace", namespace); categoryBag.getKeyedReference().add(namespaceReference); } KeyedReference serviceReference = newKeyedReference("uddi:uddi.org:wsdl:types", "uddi-org:wsdl:types", "service"); categoryBag.getKeyedReference().add(serviceReference); KeyedReference localNameReference = newKeyedReference("uddi:uddi.org:xml:localname", "uddi-org:xml:localName", serviceQName.getLocalPart()); categoryBag.getKeyedReference().add(localNameReference); service.setCategoryBag(categoryBag); return service; }
From source file:org.apache.myfaces.trinidadbuild.plugin.tagdoc.TagdocReport.java
private String _getPrefix(QName qName) { if ((qName.getPrefix() != null) && !"".equals(qName.getPrefix())) return qName.getPrefix(); String namespace = qName.getNamespaceURI(); if (namespace == null) return null; for (Iterator<Map.Entry> i = taglibs.entrySet().iterator(); i.hasNext();) { Map.Entry entry = i.next(); if (namespace.equals(entry.getValue())) return (String) entry.getKey(); }//from w ww.java 2s . c o m return "unknown"; }
From source file:org.apache.ode.axis2.service.DeploymentBrowser.java
public boolean doFilter(final HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { final String requestURI = request.getRequestURI(); final int deplUri = requestURI.indexOf("/deployment"); if (deplUri > 0) { final String root = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + requestURI.substring(0, deplUri); int offset = requestURI.length() > (deplUri + 11) ? 1 : 0; final String[] segments = requestURI.substring(deplUri + 11 + offset).split("/"); if (segments.length == 0 || segments[0].length() == 0) { renderHtml(response, "ODE Deployment Browser", new DocBody() { public void render(Writer out) throws IOException { out.write("<p><a href=\"bundles/\">Deployed Bundles</a></p>"); out.write("<p><a href=\"services/\">Process Services</a></p>"); out.write("<p><a href=\"processes/\">Process Definitions</a></p>"); }/* w w w. j a va 2s . co m*/ }); } else if (segments.length > 0) { if ("services".equals(segments[0])) { if (segments.length == 1) { renderHtml(response, "Services Implemented by Your Processes", new DocBody() { public void render(Writer out) throws IOException { for (Object serviceName : _config.getServices().keySet()) if (!"Version".equals(serviceName)) { AxisService service = _config.getService(serviceName.toString()); // The service can be one of the dynamically registered ODE services, a process // service or an unknown service deployed in the same Axis2 instance. String url = null; if ("DeploymentService".equals(service.getName()) || "InstanceManagement".equals(service.getName()) || "ProcessManagement".equals(service.getName())) url = service.getName(); else if (service.getFileName() != null) { String relative = bundleUrlFor(service.getFileName().getFile()); if (relative != null) url = root + relative; else url = root + "/services/" + service.getName() + "?wsdl"; } out.write("<p><a href=\"" + url + "\">" + serviceName + "</a></p>"); String axis2wsdl = root + "/processes/" + serviceName + "?wsdl"; out.write("<ul><li>Axis2 WSDL: <a href=\"" + axis2wsdl + "\">" + axis2wsdl + "</a></li>"); out.write( "<li>Endpoint: " + (root + "/processes/" + serviceName) + "</li>"); Iterator iter = service.getOperations(); ArrayList<String> ops = new ArrayList<String>(); while (iter.hasNext()) ops.add(((AxisOperation) iter.next()).getName().getLocalPart()); out.write("<li>Operations: " + StringUtils.join(ops, ", ") + "</li></ul>"); } } }); } else { final String serviceName = requestURI.substring(deplUri + 12 + 9); final AxisService axisService = _config.getService(serviceName); if (axisService != null) { renderXml(response, new DocBody() { public void render(Writer out) throws IOException { if ("InstanceManagement".equals(serviceName) || "ProcessManagement".equals(serviceName)) write(out, new File(_appRoot, "pmapi.wsdl").getPath()); else if (requestURI.indexOf("pmapi.xsd") > 0) write(out, new File(_appRoot, "pmapi.xsd").getPath()); else if ("DeploymentService".equals(serviceName)) write(out, new File(_appRoot, "deploy.wsdl").getPath()); else write(out, axisService.getFileName().getFile()); } }); } else { renderHtml(response, "Service Not Found", new DocBody() { public void render(Writer out) throws IOException { out.write("<p>Couldn't find service " + serviceName + "</p>"); } }); } } } else if ("processes".equals(segments[0])) { if (segments.length == 1) { renderHtml(response, "Deployed Processes", new DocBody() { public void render(Writer out) throws IOException { for (QName process : _store.getProcesses()) { String url = root + bundleUrlFor( _store.getProcessConfiguration(process).getBpelDocument()); String[] nameVer = process.getLocalPart().split("-"); out.write("<p><a href=\"" + url + "\">" + nameVer[0] + "</a> (v" + nameVer[1] + ")"); out.write(" - " + process.getNamespaceURI() + "</p>"); } } }); } } else if ("bundles".equals(segments[0])) { if (segments.length == 1) { renderHtml(response, "Deployment Bundles", new DocBody() { public void render(Writer out) throws IOException { for (String bundle : _store.getPackages()) out.write("<p><a href=\"" + bundle + "\">" + bundle + "</a></p>"); } }); } else if (segments.length == 2) { renderHtml(response, "Files in Bundle " + segments[1], new DocBody() { public void render(Writer out) throws IOException { List<QName> processes = _store.listProcesses(segments[1]); if (processes != null && processes.size() > 0) { List<File> files = _store.getProcessConfiguration(processes.get(0)).getFiles(); for (File file : files) { String relativePath = file.getPath() .substring(file.getPath().indexOf("processes") + 10) .replaceAll("\\\\", "/"); out.write( "<p><a href=\"" + relativePath + "\">" + relativePath + "</a></p>"); } } else { out.write("<p>Couldn't find bundle " + segments[1] + "</p>"); } } }); } else if (segments.length > 2) { List<QName> processes = _store.listProcesses(segments[1]); if (processes != null && processes.size() > 0) { List<File> files = _store.getProcessConfiguration(processes.get(0)).getFiles(); for (final File file : files) { String relativePath = requestURI.substring(deplUri + 12 + 9 + segments[1].length()); // replace slashes with the correct file separator so the match below is not always false relativePath = relativePath.replace('/', File.separatorChar); if (file.getPath().endsWith(relativePath)) { renderXml(response, new DocBody() { public void render(Writer out) throws IOException { write(out, file.getPath()); } }); return true; } } } else { renderHtml(response, "No Bundle Found", new DocBody() { public void render(Writer out) throws IOException { out.write("<p>Couldn't find bundle " + segments[2] + "</p>"); } }); } } } else if ("getBundleDocs".equals(segments[0])) { if (segments.length == 1) { renderXml(response, new DocBody() { public void render(Writer out) throws IOException { out.write("<getBundleDocsResponse>"); out.write("<error>Not enough args..</error>"); out.write("</getBundleDocsResponse>"); } }); } else if (segments.length == 2) { final String bundleName = segments[1]; final List<QName> processes = _store.listProcesses(bundleName); if (processes != null) { renderXml(response, new DocBody() { public void render(Writer out) throws IOException { out.write("<getBundleDocsResponse><name>" + bundleName + "</name>"); //final List<File> files = _store.getProcessConfiguration(processes.get(0)).getFiles(); //final String pid = _store.getProcessConfiguration(processes.get(0)).getProcessId().toString(); for (final QName process : processes) { List<File> files = _store.getProcessConfiguration(process).getFiles(); String pid = _store.getProcessConfiguration(process).getProcessId() .toString(); out.write("<process><pid>" + pid + "</pid>"); for (final File file : files) { if (file.getPath().endsWith(".wsdl")) { String relativePath = file.getPath().substring( _store.getDeployDir().getCanonicalPath().length() + 1) .replace(File.separatorChar, '/'); out.write("<wsdl>" + relativePath + "</wsdl>"); } if (file.getPath().endsWith(".bpel")) { String relativePath = file.getPath().substring( _store.getDeployDir().getCanonicalPath().length() + 1) .replace(File.separatorChar, '/'); out.write("<bpel>" + relativePath + "</bpel>"); } } out.write("</process>"); } out.write("</getBundleDocsResponse>"); } }); } } } else if ("getProcessDefinition".equals(segments[0])) { if (segments.length == 1) { renderXml(response, new DocBody() { public void render(Writer out) throws IOException { out.write("<getProcessDefinitionResponse>"); out.write("<error>Not enough args..</error>"); out.write("</getProcessDefinitionResponse>"); } }); } else if (segments.length == 2) { String processName = segments[1]; for (QName process : _store.getProcesses()) { String[] nameVer = process.getLocalPart().split("-"); if (processName.equals(nameVer[0])) { final String url = root + bundleUrlFor(_store.getProcessConfiguration(process).getBpelDocument()); renderXml(response, new DocBody() { public void render(Writer out) throws IOException { out.write("<getProcessDefinition>"); out.write("<url>" + url + "</url>"); out.write("</getProcessDefinition>"); } }); } } } } } return true; } return false; }
From source file:org.apache.ode.axis2.soapbinding.SoapMessageConverter.java
private OMElement buildSoapDetail(Element message, QName faultName, Operation op) throws AxisFault { if (faultName.getNamespaceURI() == null) return toFaultDetail(faultName, message); Fault f = op.getFault(faultName.getLocalPart()); if (f == null) return toFaultDetail(faultName, message); // For faults, there will be exactly one part. Part p = (Part) f.getMessage().getParts().values().iterator().next(); if (p == null) return toFaultDetail(faultName, message); Element partEl = DOMUtils.findChildByName(message, new QName(null, p.getName())); if (partEl == null) return toFaultDetail(faultName, message); Element detail = DOMUtils.findChildByName(partEl, p.getElementName()); if (detail == null) return toFaultDetail(faultName, message); return OMUtils.toOM(detail, _soapFactory); }
From source file:org.apache.ode.axis2.util.SoapMessageConverter.java
private OMElement buildSoapDetail(Element message, QName faultName, Operation op) throws AxisFault { if (faultName.getNamespaceURI() == null) return toFaultDetail(faultName, message); if (op == null) { return toFaultDetail(faultName, message); }//from w ww. j ava 2s.com Fault f = op.getFault(faultName.getLocalPart()); if (f == null) return toFaultDetail(faultName, message); // For faults, there will be exactly one part. Part p = (Part) f.getMessage().getParts().values().iterator().next(); if (p == null) return toFaultDetail(faultName, message); Element partEl = DOMUtils.findChildByName(message, new QName(null, p.getName())); if (partEl == null) return toFaultDetail(faultName, message); Element detail = DOMUtils.findChildByName(partEl, p.getElementName()); if (detail == null) return toFaultDetail(faultName, message); return OMUtils.toOM(detail, _soapFactory); }
From source file:org.apache.ode.bpel.compiler.BpelCompiler.java
@SuppressWarnings("unchecked") public OMessageVarType resolveMessageType(QName messageType) { OMessageVarType msgType = _oprocess.messageTypes.get(messageType); if (msgType == null) { Message msg = _wsdlRegistry.getMessage(messageType); if (msg == null) { throw new CompilationException( __cmsgs.errUndeclaredMessage(messageType.getLocalPart(), messageType.getNamespaceURI())); }//w w w . jav a 2 s. c om List<OMessageVarType.Part> parts = new ArrayList<OMessageVarType.Part>(); CollectionsX.transform(parts, ((List<Part>) msg.getOrderedParts(null)), new UnaryFunction<Part, OMessageVarType.Part>() { public OMessageVarType.Part apply(Part part) { OVarType partType; if (part.getElementName() != null) { partType = resolveElementType(part.getElementName()); } else { partType = resolveXsdType(part.getTypeName()); } OMessageVarType.Part opart = new OMessageVarType.Part(_oprocess, part.getName(), partType); opart.debugInfo = createDebugInfo(_processDef, "Message Variable Part: " + part.getName()); return opart; } }); msgType = new OMessageVarType(_oprocess, msg.getQName(), parts); msgType.debugInfo = createDebugInfo(_processDef, "Message Type: " + msg.getQName()); _oprocess.messageTypes.put(msg.getQName(), msgType); } return msgType; }