Example usage for javax.xml.namespace QName QName

List of usage examples for javax.xml.namespace QName QName

Introduction

In this page you can find the example usage for javax.xml.namespace QName QName.

Prototype

public QName(final String namespaceURI, final String localPart) 

Source Link

Document

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 .

Usage

From source file:MainClass.java

public void addVariable(String namespaceURI, String localName, Object value) {
    addVariable(new QName(namespaceURI, localName), value);
}

From source file:eu.esdihumboldt.hale.common.instance.orient.internal.ONamespaceMap.java

/**
 * Determine the original namespace of the given qualified name with a
 * namespace previously mapped with {@link #map(QName)} and return the
 * original name./*from w ww  .  j av  a 2  s.  c  o m*/
 * 
 * @param mapped the adapted qualified name
 * @return the original qualified name
 */
public static QName unmap(QName mapped) {
    if (XMLConstants.NULL_NS_URI.equals(mapped.getNamespaceURI())) {
        return mapped;
    }

    return new QName(IDS.getObject(mapped.getNamespaceURI()), mapped.getLocalPart());
}

From source file:org.xdi.oxd.license.test.EjbcaManualTest.java

@Test
public void test() {
    CryptoProviderTools.installBCProvider();
    String urlstr = "https://ejbca.gluu.org:8443/ejbca/ejbcaws/ejbcaws?wsdl";

    //        System.setProperty("javax.net.debug", "ssl:handshake");
    System.setProperty("javax.net.ssl.trustStore", CERT_PATH + "LicenseServer_TrustStore.jks");
    System.setProperty("javax.net.ssl.trustStorePassword", "secret");

    System.setProperty("javax.net.ssl.keyStore", CERT_PATH + "LicenseServer_KeyStore.jks");
    System.setProperty("javax.net.ssl.keyStorePassword", "secret");

    QName qname = new QName("http://ws.protocol.core.ejbca.org/", "EjbcaWSService");
    EjbcaWSService service;/*w w w .jav  a  2  s  .  com*/
    try {
        service = new EjbcaWSService(new URL(urlstr), qname);
        EjbcaWS ejbcaraws = service.getEjbcaWSPort();

        UserMatch usermatch = new UserMatch();
        usermatch.setMatchwith(UserMatch.MATCH_WITH_DN);
        usermatch.setMatchtype(UserMatch.MATCH_TYPE_CONTAINS);
        usermatch.setMatchvalue("License");
        List<UserDataVOWS> result = ejbcaraws.findUser(usermatch);

        System.out.println(result + " : result");
        if (result.size() > 0) {
            for (UserDataVOWS userDataVOWS : result) {
                System.out.println(userDataVOWS.getEmail());
            }
        }

    } catch (Exception ex) {
        // TODO Auto-generated catch block
        ex.printStackTrace();
    }
}

From source file:at.ac.univie.isc.asio.tool.ExpandingQNameSerializerTest.java

@Test
public void should_combine_local_part_and_namespace() throws Exception {
    subject.serialize(new QName("http://test.com/", "local"), generator, null);
    generator.flush();//from  w w  w  .j  av a 2 s  . com
    assertThat(sink.toString(), is("\"http://test.com/local\""));
}

From source file:com.evolveum.midpoint.util.QNameUtil.java

public static QName uriToQName(String uri) {

    if (uri == null) {
        throw new IllegalArgumentException("URI is null");
    }//w ww  . ja  va  2  s .com
    int index = uri.lastIndexOf("#");
    if (index != -1) {
        String ns = uri.substring(0, index);
        String name = uri.substring(index + 1);
        return new QName(ns, name);
    }
    index = uri.lastIndexOf("/");
    // TODO check if this is still in the path section, e.g.
    // if the matched slash is not a beginning of authority
    // section
    if (index != -1) {
        String ns = uri.substring(0, index + 1);
        String name = uri.substring(index + 1);
        return new QName(ns, name);
    }
    throw new IllegalArgumentException("The URI (" + uri + ") does not contain slash character");
}

From source file:org.apache.servicemix.jms.JmsSpringTest.java

public void test() throws Exception {
    DefaultServiceMixClient client = new DefaultServiceMixClient(jbi);
    InOut me = client.createInOutExchange();
    me.setService(new QName("http://test", "MyProviderService"));
    me.getInMessage().setContent(new StringSource("<echo xmlns='http://test'><echoin0>world</echoin0></echo>"));
    client.sendSync(me);//from www.j a va 2s .c  o  m
    if (me.getStatus() == ExchangeStatus.ERROR) {
        if (me.getFault() != null) {
            fail("Received fault: " + new SourceTransformer().toString(me.getFault().getContent()));
        } else if (me.getError() != null) {
            throw me.getError();
        } else {
            fail("Received ERROR status");
        }
    } else {
        logger.info(new SourceTransformer().toString(me.getOutMessage().getContent()));
        client.done(me);
    }
}

From source file:com.tangfan.test.UserServiceTest.java

@Before
public void init() {
    try {/*w  w  w . j  a v  a  2 s  .co m*/
        URL url = new URL("http://localhost:8085/soap/us?wsdl");
        QName qName = new QName(ns, "UserService");
        ws = new UserService_Service(url, qName);
        //         port = ws.getUserServicePort(new MTOMFeature());
        port = ws.getUserServicePort();
        BindingProvider bp = (BindingProvider) port;
        SOAPBinding binding = (SOAPBinding) bp.getBinding();
        binding.setMTOMEnabled(true);
    } catch (MalformedURLException e) {
        e.printStackTrace();
    }
}

From source file:org.cleverbus.modules.in.hello.SyncHelloRoute.java

@Override
protected void doConfigure() throws Exception {
    from(getInWsUri(new QName(HELLO_SERVICE_NS, "syncHelloRequest"))).routeId(ROUTE_ID_SYNC_HELLO)

            .policy("roleWsAuthPolicy")

            .to("throttling:sync:" + OPERATION_NAME)

            .unmarshal(jaxb(SyncHelloRequest.class))

            .log(LoggingLevel.DEBUG, "Calling hello service with name: ${body.name}")

            .bean(this, "composeGreeting")

            .marshal(jaxb(SyncHelloResponse.class));
}

From source file:Main.java

private static QName getNSName(Element e, String qname) {
    if (qname == null) {
        return null;
    }/*from  w w  w  .  j  a v a  2s . com*/
    int i = qname.indexOf(':');
    if (i > 0) {
        String name = qname.substring(i + 1);
        String prefix = qname.substring(0, i);
        return new QName(getNamespaceURI(e, prefix), name);
    } else {
        return new QName(qname);
    }
}

From source file:Main.java

/**
 * @param clazz/*from  w ww .ja v  a  2s  .c  om*/
 * @return namespace of root element qname or null if this is not object does not represent a
 *         root element
 */
public static QName getXmlRootElementQName(Class<?> clazz) {

    // See if the object represents a root element
    XmlRootElement root = (XmlRootElement) getAnnotation(clazz, XmlRootElement.class);
    if (root == null) {
        return null;
    }

    String name = root.name();
    String namespace = root.namespace();

    // The name may need to be defaulted
    if (name == null || name.length() == 0 || name.equals("##default")) {
        name = getSimpleName(clazz.getCanonicalName());
    }

    // The namespace may need to be defaulted
    if (namespace == null || namespace.length() == 0 || namespace.equals("##default")) {
        Package pkg = clazz.getPackage();
        XmlSchema schema = (XmlSchema) getAnnotation(pkg, XmlSchema.class);
        if (schema != null) {
            namespace = schema.namespace();
        } else {
            namespace = "";
        }
    }

    return new QName(namespace, name);
}