List of usage examples for javax.xml.namespace QName QName
public QName(final String namespaceURI, final String localPart)
QName
constructor specifying the Namespace URI and local part.
If the Namespace URI is null
, it is set to javax.xml.XMLConstants#NULL_NS_URI XMLConstants.NULL_NS_URI .
From source file:mp.platform.cyclone.webservices.utils.WebServiceHelper.java
/** * Returns a qualified name for a fault code */// w w w .ja v a 2 s . c o m private static QName faultCode(final String code) { return new QName(CODE_PREFIX, code); }
From source file:com.evolveum.midpoint.prism.marshaller.ItemPathHolder.java
/** * Parses XPath-like expression (midPoint flavour), with regards to domNode from where the namespace declarations * (embedded in XML using xmlns attributes) are taken. * * @param itemPath text representation of the item path * @param domNode context (DOM node from which the expression was taken) * @param namespaceMap externally specified namespaces *//*w ww . j a va 2 s . c o m*/ private void parse(String itemPath, Node domNode, Map<String, String> namespaceMap) { segments = new ArrayList<>(); absolute = false; if (".".equals(itemPath)) { return; } // Check for explicit namespace declarations. TrivialItemPathParser parser = TrivialItemPathParser.parse(itemPath); explicitNamespaceDeclarations.putAll(parser.getNamespaceMap()); // Continue parsing with Xpath without the "preamble" itemPath = parser.getPureItemPathString(); String[] segArray = itemPath.split("/"); for (int i = 0; i < segArray.length; i++) { if (segArray[i] == null || segArray[i].isEmpty()) { if (i == 0) { absolute = true; // ignore the first empty segment of absolute path continue; } else { throw new IllegalArgumentException( "ItemPath " + itemPath + " has an empty segment (number " + i + ")"); } } String segmentStr = segArray[i]; PathHolderSegment idValueFilterSegment; // is ID value filter attached to this segment? int idValuePosition = segmentStr.indexOf('['); if (idValuePosition >= 0) { if (!segmentStr.endsWith("]")) { throw new IllegalArgumentException( "ItemPath " + itemPath + " has a ID segment not ending with ']': '" + segmentStr + "'"); } String value = segmentStr.substring(idValuePosition + 1, segmentStr.length() - 1); segmentStr = segmentStr.substring(0, idValuePosition); idValueFilterSegment = new PathHolderSegment(value); } else { idValueFilterSegment = null; } // processing the rest (i.e. the first part) of the segment boolean variable = false; if (segmentStr.startsWith("$")) { // We have variable here variable = true; segmentStr = segmentStr.substring(1); } String[] qnameArray = segmentStr.split(":"); if (qnameArray.length > 2) { throw new IllegalArgumentException( "Unsupported format: more than one colon in XPath segment: " + segArray[i]); } QName qname; if (qnameArray.length == 1 || qnameArray[1] == null || qnameArray[1].isEmpty()) { if (ParentPathSegment.SYMBOL.equals(qnameArray[0])) { qname = ParentPathSegment.QNAME; } else if (ObjectReferencePathSegment.SYMBOL.equals(qnameArray[0])) { qname = ObjectReferencePathSegment.QNAME; } else if (IdentifierPathSegment.SYMBOL.equals(qnameArray[0])) { qname = IdentifierPathSegment.QNAME; } else { // default namespace <= empty prefix String namespace = findNamespace(null, domNode, namespaceMap); qname = new QName(namespace, qnameArray[0]); } } else { String namespacePrefix = qnameArray[0]; String namespace = findNamespace(namespacePrefix, domNode, namespaceMap); if (namespace == null) { QNameUtil.reportUndeclaredNamespacePrefix(namespacePrefix, itemPath); namespacePrefix = QNameUtil.markPrefixAsUndeclared(namespacePrefix); } qname = new QName(namespace, qnameArray[1], namespacePrefix); } segments.add(new PathHolderSegment(qname, variable)); if (idValueFilterSegment != null) { segments.add(idValueFilterSegment); } } }
From source file:org.apache.servicemix.jms.JMSComponentTest.java
public void testProviderConsumerInOut() throws Exception { // JMS Component JmsComponent component = new JmsComponent(); container.activateComponent(component, "JMSComponent"); // Add an echo component EchoComponent echo = new EchoComponent(); ActivationSpec asEcho = new ActivationSpec("receiver", echo); asEcho.setService(new QName("http://jms.servicemix.org/Test", "Echo")); container.activateComponent(asEcho); // Deploy Provider SU URL url = getClass().getClassLoader().getResource("provider/jms.wsdl"); File path = new File(new URI(url.toString())); path = path.getParentFile();//from www . j av a 2 s . co m component.getServiceUnitManager().deploy("provider", path.getAbsolutePath()); component.getServiceUnitManager().init("provider", path.getAbsolutePath()); component.getServiceUnitManager().start("provider"); // Deploy Consumer SU url = getClass().getClassLoader().getResource("consumer/jms.wsdl"); path = new File(new URI(url.toString())); path = path.getParentFile(); component.getServiceUnitManager().deploy("consumer", path.getAbsolutePath()); component.getServiceUnitManager().init("consumer", path.getAbsolutePath()); component.getServiceUnitManager().start("consumer"); // Call it InOut inout = client.createInOutExchange(); inout.setInterfaceName(new QName("http://jms.servicemix.org/Test", "ProviderInterface")); inout.getInMessage().setContent(new StringSource("<hello>world</hello>")); boolean result = client.sendSync(inout); assertTrue(result); NormalizedMessage out = inout.getOutMessage(); assertNotNull(out); Source src = out.getContent(); assertNotNull(src); logger.info(new SourceTransformer().toString(src)); }
From source file:dk.statsbiblioteket.doms.central.CentralWebserviceImpl.java
/** * Create a new summa search client. Reads the property dk.statsbiblioteket.doms.central.summaWSDL to get the location * @return/*from w ww. j ava 2 s . c o m*/ * @throws MalformedURLException */ protected SearchWS getSearchWSService() throws MalformedURLException { String summaLocation = ConfigCollection.getProperties() .getProperty("dk.statsbiblioteket.doms.central.summaWSDL"); return new SearchWSService(new java.net.URL(summaLocation), new QName("http://statsbiblioteket.dk/summa/search", "SearchWSService")).getSearchWS(); }
From source file:com._4dconcept.springframework.data.marklogic.repository.query.PartTreeMarklogicQueryTest.java
@Test public void booleanFieldShouldBeConsideredFalse() { Query query = deriveQueryFromMethod("findByActiveIsFalse"); assertCriteria(query.getCriteria(), is(new QName("http://spring.data.marklogic/test/contact", "active")), is(false));//from w ww .j ava 2s. c o m }
From source file:ddf.security.pep.interceptor.PEPAuthorizingInterceptor.java
/** * This method is an implementation of the WSA-M and WSA-W specs for determining the action URI.<br> * <ul>/* w ww. j a va2 s . c om*/ * <li>http://www.w3.org/TR/ws-addr-metadata/#actioninwsdl</li> * <li>http://www.w3.org/TR/ws-addr-wsdl/#actioninwsdl</li> * </ul> * Adapted from {@link org.apache.cxf.ws.addressing.impl.MAPAggregatorImpl} and * {@link org.apache.cxf.ws.addressing.impl.InternalContextUtils} * * @param message * @return */ private String getActionUri(Message message) { String actionURI = null; /** * See if the action is explicitly defined in the WSDL message service model. Retrieves one * of the Action attribute in the wsdl:input message. */ MessageInfo msgInfo = (MessageInfo) message.get(MessageInfo.class.getName()); if (msgInfo != null && msgInfo.getExtensionAttributes() != null) { // wsaw:Action Object attr = msgInfo.getExtensionAttribute(JAXWSAConstants.WSAW_ACTION_QNAME); // wsam:Action if (attr == null) { attr = msgInfo.getExtensionAttribute(JAXWSAConstants.WSAM_ACTION_QNAME); } // support for older usages if (attr == null) { attr = msgInfo.getExtensionAttributes() .get(new QName(JAXWSAConstants.NS_WSA, Names.WSAW_ACTION_NAME)); } if (attr == null) { attr = msgInfo.getExtensionAttributes() .get(new QName(Names.WSA_NAMESPACE_WSDL_NAME_OLD, Names.WSAW_ACTION_NAME)); } if (attr instanceof QName) { actionURI = ((QName) attr).getLocalPart(); } else { actionURI = attr == null ? null : attr.toString(); } } /** * See if the action is explicitly defined in the WSDL operation service model. Retrieves * the operation soap:soapAction property. */ if (StringUtils.isEmpty(actionURI)) { BindingOperationInfo bindingOpInfo = message.getExchange().get(BindingOperationInfo.class); SoapOperationInfo soi = bindingOpInfo.getExtensor(SoapOperationInfo.class); if (soi == null && bindingOpInfo.isUnwrapped()) { soi = bindingOpInfo.getWrappedOperation().getExtensor(SoapOperationInfo.class); } actionURI = soi == null ? null : soi.getAction(); actionURI = StringUtils.isEmpty(actionURI) ? null : actionURI; } /** * If the service model doesn't explicitly defines the action, we'll construct the default * URI string. */ if (StringUtils.isEmpty(actionURI)) { QName op = (QName) message.get(MessageContext.WSDL_OPERATION); QName port = (QName) message.get(MessageContext.WSDL_PORT); if (op != null && port != null) { actionURI = port.getNamespaceURI(); actionURI = addPath(actionURI, port.getLocalPart()); actionURI = addPath(actionURI, op.getLocalPart() + "Request"); } } return actionURI; }
From source file:com.eviware.soapui.impl.wsdl.submit.transports.http.AttachmentUtils.java
public static String getXmlMimeContentType(XmlCursor cursor) { String attributeText = cursor .getAttributeText(new QName("http://www.w3.org/2004/11/xmlmime", "contentType")); if (attributeText == null) attributeText = cursor.getAttributeText(new QName("http://www.w3.org/2005/05/xmlmime", "contentType")); return attributeText; }
From source file:org.deegree.securityproxy.wcs.responsefilter.capabilities.WcsCapabilitiesModificationManagerCreator.java
private LinkedList<ElementPathStep> createPath(String operation, String method) { LinkedList<ElementPathStep> path = new LinkedList<ElementPathStep>(); path.add(new ElementPathStep(new QName(WCS_1_0_0_NS_URI, "WCS_Capabilities"))); path.add(new ElementPathStep(new QName(WCS_1_0_0_NS_URI, "Capability"))); path.add(new ElementPathStep(new QName(WCS_1_0_0_NS_URI, "Request"))); path.add(new ElementPathStep(new QName(WCS_1_0_0_NS_URI, operation))); path.add(new ElementPathStep(new QName(WCS_1_0_0_NS_URI, "DCPType"))); path.add(new ElementPathStep(new QName(WCS_1_0_0_NS_URI, "HTTP"))); path.add(new ElementPathStep(new QName(WCS_1_0_0_NS_URI, method))); path.add(new ElementPathStep(new QName(WCS_1_0_0_NS_URI, "OnlineResource"))); return path;/*from w w w . j a va 2 s.c om*/ }
From source file:com.evolveum.midpoint.testing.longtest.TestLdapUniversity.java
@Test public void test100BigImportWithLinking() throws Exception { final String TEST_NAME = "test100BigImportWithLinking"; TestUtil.displayTestTile(this, TEST_NAME); // GIVEN//from w w w . ja v a 2 s .com InternalsConfig.turnOffAllChecks(); Task task = taskManager.createTaskInstance(TestLdapUniversity.class.getName() + "." + TEST_NAME); task.setOwner(getUser(USER_ADMINISTRATOR_OID)); OperationResult result = task.getResult(); loadEntries("u"); createUsers("u", new OperationResult("createUsers")); // we do not want to have all this in the task's result display("e0", findUserByUsername("e0")); // WHEN TestUtil.displayWhen(TEST_NAME); //task.setExtensionPropertyValue(SchemaConstants.MODEL_EXTENSION_WORKER_THREADS, 5); modelService.importFromResource(RESOURCE_OPENDJ_OID, new QName(RESOURCE_OPENDJ_NAMESPACE, "AccountObjectClass"), task, result); // THEN TestUtil.displayThen(TEST_NAME); OperationResult subresult = result.getLastSubresult(); TestUtil.assertInProgress("importAccountsFromResource result", subresult); waitForTaskFinish(task, true, 20000 + NUM_LDAP_ENTRIES * 2000, 10000L); // THEN TestUtil.displayThen(TEST_NAME); int userCount = modelService.countObjects(UserType.class, null, null, task, result); display("Users", userCount); assertEquals("Unexpected number of users", NUM_LDAP_ENTRIES + 1, userCount); display("e0(u0)", findUserByUsername("e0(u0)")); display("e1(u1)", findUserByUsername("e1(u1)")); assertUser("e0(u0)", task, result); assertUser("e1(u1)", task, result); }