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:org.apache.servicemix.jms.JmsProviderEndpointTest.java
public void testSoapProviderInOnly() throws Exception { JmsComponent component = new JmsComponent(); JmsSoapProviderEndpoint endpoint = new JmsSoapProviderEndpoint(); endpoint.setService(new QName("uri:HelloWorld", "HelloService")); endpoint.setEndpoint("HelloPort"); endpoint.setConnectionFactory(connectionFactory); endpoint.setDestinationName("destination"); endpoint.setWsdl(new ClassPathResource("org/apache/servicemix/jms/HelloWorld-RPC.wsdl")); component.setEndpoints(new JmsProviderEndpoint[] { endpoint }); container.activateComponent(component, "servicemix-jms"); ByteArrayOutputStream baos = new ByteArrayOutputStream(); FileUtil.copyInputStream(/*from w w w .j av a 2 s.com*/ new ClassPathResource("org/apache/servicemix/jms/HelloWorld-RPC-Input-OneWay.xml").getInputStream(), baos); InOnly me = client.createInOnlyExchange(); me.getInMessage().setContent(new StringSource(baos.toString())); me.setOperation(new QName("uri:HelloWorld", "OneWay")); me.setService(new QName("uri:HelloWorld", "HelloService")); client.sendSync(me); assertEquals(ExchangeStatus.DONE, me.getStatus()); Message msg = jmsTemplate.receive("destination"); assertNotNull(msg); System.err.println(((TextMessage) msg).getText()); }
From source file:com._4dconcept.springframework.data.marklogic.repository.query.PartTreeMarklogicQueryTest.java
@Test public void multipleFieldsShouldBeConsidered() { Query query = deriveQueryFromMethod("findByLastnameAndFirstname", "foo", "bar"); assertThat(query.getCriteria().getOperator(), is(Criteria.Operator.and)); assertThat(query.getCriteria().getCriteriaObject(), instanceOf(List.class)); List<Criteria> criteriaList = extractListCriteria(query.getCriteria()); assertCriteria(criteriaList.get(0), is(new QName("http://spring.data.marklogic/test/contact", "lastname")), is("foo")); assertCriteria(criteriaList.get(1), is(new QName("http://spring.data.marklogic/test/contact", "firstname")), is("bar")); }
From source file:org.javelin.sws.ext.bind.jaxb.JaxbTest.java
@Test public void unmarshalSameQNames() throws Exception { JAXBContext ctx = JAXBContext.newInstance(org.javelin.sws.ext.bind.jaxb.context1.MyClassJ1.class, org.javelin.sws.ext.bind.jaxb.context2.MyClassJ2.class); Marshaller m = ctx.createMarshaller(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); log.info("context1"); org.javelin.sws.ext.bind.jaxb.context1.MyClassJ1 mc1 = new org.javelin.sws.ext.bind.jaxb.context1.MyClassJ1(); mc1.setP(new MyProperty1()); m.marshal(new JAXBElement<org.javelin.sws.ext.bind.jaxb.context1.MyClassJ1>(new QName("a", "a"), org.javelin.sws.ext.bind.jaxb.context1.MyClassJ1.class, mc1), System.out); log.info("context2"); org.javelin.sws.ext.bind.jaxb.context2.MyClassJ2 mc2 = new org.javelin.sws.ext.bind.jaxb.context2.MyClassJ2(); mc2.setP(new MyProperty2()); m.marshal(new JAXBElement<org.javelin.sws.ext.bind.jaxb.context2.MyClassJ2>(new QName("a", "a"), org.javelin.sws.ext.bind.jaxb.context2.MyClassJ2.class, mc2), System.out); Object object = ctx.createUnmarshaller().unmarshal( new StreamSource( new StringReader("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\r\n" + "<ns2:a xmlns=\"urn:x\" xmlns:ns2=\"a\">\r\n" + " <p/>\r\n" + "</ns2:a>")), org.javelin.sws.ext.bind.jaxb.context2.MyClassJ2.class); log.info("Class: {}", ((JAXBElement<?>) object).getValue().getClass()); }
From source file:org.cleverbus.core.common.ws.HeaderAndPayloadValidatingInterceptor.java
/** * Checks if input request should be ignored from header checking. * * @param messageContext the msg context * @return {@code true} when input request should be ignored, otherwise {@code false} *//* w w w .j a v a2s . c o m*/ private boolean ignoreRequest(MessageContext messageContext) { Node reqNode = ((DOMSource) messageContext.getRequest().getPayloadSource()).getNode(); QName reqName = new QName(reqNode.getNamespaceURI(), reqNode.getLocalName()); return ignoreRequests.contains(reqName); }
From source file:de.ii.xtraplatform.ogc.api.gml.parser.GMLParser.java
private void parseRoot(ListenableFuture<SMInputCursor> rootFuture, String ns, String ft) throws ExecutionException { QName featureType = new QName(ns, ft); SMInputCursor root = null;// ww w . j a v a 2 s. com try { analyzer.analyzeStart(rootFuture); root = rootFuture.get(); if (root == null) { return; } LOGGER.debug("Parsing GetFeature response for '{}'", ft); // parse for exceptions if (root.getLocalName().equals(WFS.getWord(WFS.VOCABULARY.EXCEPTION_REPORT))) { parseException(root); } if (root.hasName(featureType)) { parseFeature(root); } else { SMInputCursor body = root.descendantElementCursor().advance(); while (body.readerAccessible()) { if (body.hasName(featureType)) { parseFeature(body); } else if (body.hasLocalName(ft)) { if (analyzer.analyzeNamespaceRewrite(ns, body.getNsUri(), ft)) { parseFeature(body); } } body = body.advance(); } } analyzer.analyzeEnd(); } catch (GMLAnalyzeFailed ex) { LOGGER.debug("GMLParser recieved 'stop parsing' {}", ex.getMessage()); } catch (XMLStreamException ex) { LOGGER.debug("Error parsing WFS GetFeature (IOException) {}", ex.getMessage()); } catch (Exception ex) { LOGGER.debug("Error parsing WFS GetFeature (IOException) {}", ex.getMessage()); ex.printStackTrace(); } finally { if (root != null) { try { root.getStreamReader().closeCompletely(); } catch (XMLStreamException ex) { } } } }
From source file:gov.nih.nci.cagrid.encoding.AxisContentHandler.java
/** * delegates to the serialization context *///w ww. ja v a 2s .c o m public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { try { context.startElement(new QName(uri, localName), attributes); } catch (IOException ioe) { throw new SAXException(ioe); } }
From source file:uk.ac.ebi.metabolights.referencelayer.importer.ChebiMetaboliteScanner.java
public ChebiWebServiceClient getChebiWS() { if (chebiWS == null) try {/*ww w. j a v a2 s . c o m*/ LOGGER.info("Starting a new instance of the ChEBI ChebiWebServiceClient"); chebiWS = new ChebiWebServiceClient(new URL(chebiWSUrl), new QName("http://www.ebi.ac.uk/webservices/chebi", "ChebiWebServiceService")); } catch (MalformedURLException e) { LOGGER.error("Error instanciating a new ChebiWebServiceClient " + e.getMessage()); } return chebiWS; }
From source file:in.gov.uidai.core.aua.client.BfdClient.java
private String generateSignedBfdXML(Bfd bfd) throws JAXBException, Exception { StringWriter bfdXML = new StringWriter(); JAXBElement bfdElement = new JAXBElement( new QName("http://www.uidai.gov.in/auth/uid-bfd-request/1.0", "Bfd"), Bfd.class, bfd); JAXBContext.newInstance(Bfd.class).createMarshaller().marshal(bfdElement, bfdXML); boolean includeKeyInfo = true; if (System.getenv().get("SKIP_DIGITAL_SIGNATURE") != null) { return bfdXML.toString(); } else {//from w w w.j av a 2s .c o m return this.digitalSignator.signXML(bfdXML.toString(), includeKeyInfo); } }
From source file:com.temenos.useragent.generic.mediatype.AtomEntryHandler.java
@Override public void setContent(InputStream stream) { if (stream == null) { throw new IllegalArgumentException("Entity input stream is null"); }//from w w w . ja v a2 s . c o m Document<Element> entityDoc = null; try { entityDoc = new Abdera().getParser().parse(stream); } catch (ParseException e) { throw new IllegalArgumentException("Unexpected entity for media type '" + AtomUtil.MEDIA_TYPE + "'.", e); } QName rootElementQName = entityDoc.getRoot().getQName(); if (new QName(AtomUtil.NS_ATOM, "entry").equals(rootElementQName)) { initHandler((Entry) entityDoc.getRoot()); } else { throw new IllegalArgumentException("Unexpected entity for media type '" + MEDIA_TYPE + "'. Payload [" + entityDoc.getRoot().toString() + "]"); } }
From source file:com.twinsoft.convertigo.beans.transactions.couchdb.CustomTransaction.java
@Override public QName getComplexTypeAffectation() { return new QName(COUCHDB_XSD_NAMESPACE, "customType"); }