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:org.javelin.sws.ext.jws.invocation.MessageFactoryTest.java

@Test
public void createRpcOperation() throws Exception {
    OperationDescription op = new OperationDescription();
    op.setRootName(new QName("urn:test", "document"));
    WebServiceInvocationMessage message = this.invocationFactory.createInvocation(op);
    message.getSoapMessage().writeTo(System.out);
}

From source file:com.lin.umws.service.impl.UserServiceImpl.java

public User login(String username, String password) throws UserException {
    System.out.println("spring: " + springService);
    HeaderList headerList = (HeaderList) cxt.getMessageContext()
            .get(JAXWSProperties.INBOUND_HEADER_LIST_PROPERTY);
    Header header = headerList.get(new QName("http://service.umws.lin.com/", "licenseType"), true);
    try {//  www  .j a  v  a 2s  .  c om
        XMLStreamReader reader = header.readHeader();
        while (reader.hasNext()) {
            int type = reader.next();
            if (type == XMLStreamReader.CHARACTERS) {
                System.out.println(reader.getText());
            }
        }
    } catch (XMLStreamException e) {
        e.printStackTrace();
    }

    for (User user : userMap.values()) {
        if (username.equals(user.getUsername()) && password.equals(user.getPassword())) {
            return user;
        }
    }

    throw new UserException("?");
}

From source file:org.apache.cxf.fediz.service.idp.STSUPAuthenticationProvider.java

@Override
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
    // We only handle UsernamePasswordAuthenticationTokens
    if (!(authentication instanceof UsernamePasswordAuthenticationToken)) {
        return null;
    }/*from ww w .ja v  a  2s  .c  om*/

    Bus cxfBus = getBus();
    IdpSTSClient sts = new IdpSTSClient(cxfBus);
    sts.setAddressingNamespace("http://www.w3.org/2005/08/addressing");
    if (tokenType != null && tokenType.length() > 0) {
        sts.setTokenType(tokenType);
    } else {
        sts.setTokenType(WSConstants.WSS_SAML2_TOKEN_TYPE);
    }
    sts.setKeyType(HTTP_DOCS_OASIS_OPEN_ORG_WS_SX_WS_TRUST_200512_BEARER);
    sts.setWsdlLocation(wsdlLocation);
    sts.setServiceQName(new QName(namespace, wsdlService));
    sts.setEndpointQName(new QName(namespace, wsdlEndpoint));

    sts.getProperties().putAll(properties);
    if (use200502Namespace) {
        sts.setNamespace(HTTP_SCHEMAS_XMLSOAP_ORG_WS_2005_02_TRUST);
    }

    if (lifetime != null) {
        sts.setEnableLifetime(true);
        sts.setTtl(lifetime.intValue());
    }

    return handleUsernamePassword((UsernamePasswordAuthenticationToken) authentication, sts);
}

From source file:org.semispace.ws.client.SemiSpaceTokenProxy.java

protected static TokenWsSpace readSpaceServiceAsStandardPort(String endpointAddress) {
    QName SERVICE_NAME = new QName("http://ws.semispace.org/", "TokenWsSpace");
    QName PORT_NAME = new QName("http://ws.semispace.org/", "TokenWsSpacePort");

    Service service = Service.create(SERVICE_NAME);

    // Add a port to the Service
    service.addPort(PORT_NAME, SOAPBinding.SOAP11HTTP_BINDING, endpointAddress);

    TokenWsSpace hw = service.getPort(TokenWsSpace.class);
    return hw;/*from w  ww.  jav a2  s .c om*/
}

From source file:edu.internet2.middleware.shibboleth.common.config.attribute.filtering.AttributeRuleBeanDefinitionParser.java

/** {@inheritDoc} */
protected void doParse(Element configElement, ParserContext parserContext, BeanDefinitionBuilder builder) {
    super.doParse(configElement, parserContext, builder);

    builder.addConstructorArgValue(/*from   ww w . ja  v a 2 s .  com*/
            DatatypeHelper.safeTrimOrNullString(configElement.getAttributeNS(null, "attributeID")));

    Map<QName, List<Element>> children = XMLHelper.getChildElements(configElement);

    List<Element> permitValueRule = children
            .get(new QName(AttributeFilterNamespaceHandler.NAMESPACE, "PermitValueRule"));
    if (permitValueRule != null && !permitValueRule.isEmpty()) {
        builder.addPropertyValue("permitValueRule",
                SpringConfigurationUtils.parseInnerCustomElement(permitValueRule.get(0), parserContext));
    }

    List<Element> permitValueRuleRef = children
            .get(new QName(AttributeFilterNamespaceHandler.NAMESPACE, "PermitValueRuleReference"));
    if (permitValueRuleRef != null && !permitValueRuleRef.isEmpty()) {
        String reference = getAbsoluteReference(configElement, "PermitValueRule",
                permitValueRuleRef.get(0).getTextContent());
        builder.addPropertyReference("permitValueRule", reference);
    }

    List<Element> denyValueRule = children
            .get(new QName(AttributeFilterNamespaceHandler.NAMESPACE, "DenyValueRule"));
    if (denyValueRule != null && !denyValueRule.isEmpty()) {
        builder.addPropertyValue("denyValueRule",
                SpringConfigurationUtils.parseInnerCustomElement(denyValueRule.get(0), parserContext));
    }

    List<Element> denyValueRuleRef = children
            .get(new QName(AttributeFilterNamespaceHandler.NAMESPACE, "DenyValueRuleReference"));
    if (denyValueRuleRef != null && !denyValueRuleRef.isEmpty()) {
        String reference = getAbsoluteReference(configElement, "DenyValueRule",
                denyValueRuleRef.get(0).getTextContent());
        builder.addPropertyReference("denyValueRule", reference);
    }
}

From source file:be.e_contract.mycarenet.tarification.TarificationClient.java

public TarificationClient(String location) {
    MycarenetTarificationService service = MycarenetTarificationServiceFactory.newInstance();

    this.port = service.getMycarenetTarifationServiceSOAP11();

    QName portQName = new QName("urn:be:fgov:ehealth:mycarenet:tarification:protocol:v1",
            "MycarenetTarifationServiceSOAP11");
    this.dispatch = service.createDispatch(portQName, Source.class, Service.Mode.PAYLOAD);

    this.wsSecuritySOAPHandler = new WSSecuritySOAPHandler();

    configureBindingProvider(this.dispatch, location);
    configureBindingProvider((BindingProvider) this.port, location);
}

From source file:com.vangent.hieos.services.sts.util.STSUtil.java

/**
 *
 * @param request/*from   w ww  .  j  a va2  s .co m*/
 * @return
 * @throws STSException
 */
public static String getRequestType(OMElement request) throws STSException {
    OMElement reqTypeElem = request.getFirstChildWithName(new QName(STSConstants.WSTRUST_NS, "RequestType"));
    if (reqTypeElem == null || reqTypeElem.getText() == null || reqTypeElem.getText().trim().length() == 0) {
        throw new STSException("Unable to locate RequestType on request");
    } else {
        return reqTypeElem.getText().trim();
    }
}

From source file:org.cloudml.connectors.FlexiantConnector.java

@SuppressWarnings("restriction")
public FlexiantConnector(String endPoint, String login, String secretKey) throws MalformedURLException {
    this.endpoint = endPoint;
    System.setProperty("jsse.enableSNIExtension", "false");

    journal.log(Level.INFO, ">> Connecting to Flexiant ...");

    URL url = ClassLoader.getSystemClassLoader().getResource("UserAdmin.wsdl");

    // Get the UserAPI
    UserAPI api = new UserAPI(url, new QName("http://extility.flexiant.net", "UserAPI"));

    // and set the service port on the service
    service = api.getUserServicePort();/*from w  w w  .ja  v a  2 s  .com*/

    // Get the binding provider
    BindingProvider portBP = (BindingProvider) service;

    // and set the service endpoint
    portBP.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endPoint);

    journal.log(Level.INFO, ">> Authenticating ...");
    // and the caller's authentication details and password
    portBP.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, login);
    portBP.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, secretKey);

}

From source file:org.javelin.sws.ext.bind.SweJaxbContextFactoryTest.java

@Test
public void emptySetOfClasses() throws Exception {
    JAXBContext ctx = SweJaxbContextFactory.createContext(new Class[] {}, null);
    ctx.createMarshaller().marshal(//from w w w .  j a va2 s .  c om
            new JAXBElement<String>(new QName("urn:test", "str"), String.class, "content"), System.out);
}

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

public void testProviderInOnly() throws Exception {
    // JMS Component
    JmsComponent component = new JmsComponent();
    container.activateComponent(component, "JMSComponent");

    // Add a jms receiver
    JmsReceiverComponent jmsReceiver = new JmsReceiverComponent();
    jmsTemplate.setDefaultDestinationName("queue/A");
    jmsReceiver.setTemplate(jmsTemplate);
    jmsReceiver.afterPropertiesSet();//from  ww  w . jav  a2 s. co m
    ActivationSpec asJmsReceiver = new ActivationSpec("jmsReceiver", jmsReceiver);
    asJmsReceiver.setDestinationService(new QName("test", "receiver"));
    container.activateComponent(asJmsReceiver);

    // Add a receiver component
    Receiver receiver = new ReceiverComponent();
    ActivationSpec asReceiver = new ActivationSpec("receiver", receiver);
    asReceiver.setService(new QName("test", "receiver"));
    container.activateComponent(asReceiver);

    // Deploy SU
    URL url = getClass().getClassLoader().getResource("provider/jms.wsdl");
    File path = new File(new URI(url.toString()));
    path = path.getParentFile();
    component.getServiceUnitManager().deploy("provider", path.getAbsolutePath());
    component.getServiceUnitManager().init("provider", path.getAbsolutePath());
    component.getServiceUnitManager().start("provider");

    // Call it
    InOnly in = client.createInOnlyExchange();
    in.setInterfaceName(new QName("http://jms.servicemix.org/Test", "ProviderInterface"));
    in.getInMessage().setContent(new StringSource("<hello>world</hello>"));
    client.send(in);

    // Check we received the message
    receiver.getMessageList().assertMessagesReceived(1);
}