Package org.jboss.ws.core.soap

Examples of org.jboss.ws.core.soap.MessageFactoryImpl.createMessage()


      ByteArrayOutputStream stream = new ByteArrayOutputStream();
      soapMsg.writeTo(stream);

      ByteArrayInputStream instream = new ByteArrayInputStream(stream.toByteArray());
      soapMsg = factory.createMessage(null, instream);
      env = soapMsg.getSOAPPart().getEnvelope();
      doc = env.getOwnerDocument();


      SecurityDecoder decoder = new SecurityDecoder(new SecurityStore(), null);
View Full Code Here


      if (isSOAP12() == true)
      {
         factory.setEnvNamespace(Constants.NS_SOAP12_ENV);
      }

      return (SOAPMessageImpl)factory.createMessage();
   }

   private static boolean isSOAP12()
   {
      CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
View Full Code Here

   private SOAPMessage getMessage(Calendar created, String envStr) throws Exception
   {
      envStr = envStr.replaceAll("CREATED", SimpleTypeBindings.marshalDateTime(created));
      ByteArrayInputStream inputStream = new ByteArrayInputStream(envStr.getBytes());
      MessageFactory factory = new MessageFactoryImpl();
      return factory.createMessage(null, inputStream);
   }
  
   public void testEncodeMessageWithNonceAndCreated() throws Exception
   {
      WSSecurityConfiguration configuration = WSSecurityOMFactory.newInstance().parse(new StringReader(clientConf));
View Full Code Here

   public void testEncodeMessageWithNonceAndCreated() throws Exception
   {
      WSSecurityConfiguration configuration = WSSecurityOMFactory.newInstance().parse(new StringReader(clientConf));
      ByteArrayInputStream inputStream = new ByteArrayInputStream(testMessage.getBytes());
      MessageFactory factory = new MessageFactoryImpl();
      SOAPMessage soapMsg = factory.createMessage(null, inputStream);
      sec.encodeMessage(configuration, soapMsg, null, "kermit", "therealfrog");
      Element securityEl = (Element)soapMsg.getSOAPHeader().getChildElements(Constants.WSSE_HEADER_QNAME).next();
      Element usernameTokenEl = (Element)DOMUtils.getChildElements(securityEl, new QName(Constants.WSSE_NS, "UsernameToken")).next();
      assertPassword(usernameTokenEl);
      Element nonceEl = (Element)DOMUtils.getChildElements(usernameTokenEl, new QName(Constants.WSSE_NS, "Nonce")).next();
View Full Code Here

   public void testEncodeMessageWithNonce() throws Exception
   {
      WSSecurityConfiguration configuration = WSSecurityOMFactory.newInstance().parse(new StringReader(clientConf));
      ByteArrayInputStream inputStream = new ByteArrayInputStream(testMessage.getBytes());
      MessageFactory factory = new MessageFactoryImpl();
      SOAPMessage soapMsg = factory.createMessage(null, inputStream);
      Username username = new Username(true, true, false);
      Config config = new Config();
      config.setUsername(username);
      sec.encodeMessage(configuration, soapMsg, config, "kermit", "therealfrog");
      Element securityEl = (Element)soapMsg.getSOAPHeader().getChildElements(Constants.WSSE_HEADER_QNAME).next();
View Full Code Here

   public void testEncodeMessageWithCreated() throws Exception
   {
      WSSecurityConfiguration configuration = WSSecurityOMFactory.newInstance().parse(new StringReader(clientConf));
      ByteArrayInputStream inputStream = new ByteArrayInputStream(testMessage.getBytes());
      MessageFactory factory = new MessageFactoryImpl();
      SOAPMessage soapMsg = factory.createMessage(null, inputStream);
      Username username = new Username(true, false, true);
      Config config = new Config();
      config.setUsername(username);
      sec.encodeMessage(configuration, soapMsg, config, "kermit", "therealfrog");
      Element securityEl = (Element)soapMsg.getSOAPHeader().getChildElements(Constants.WSSE_HEADER_QNAME).next();
View Full Code Here

         + " </env:Body>"
         + "</env:Envelope>";

      ByteArrayInputStream inputStream = new ByteArrayInputStream(envStr.getBytes());
      MessageFactory factory = new MessageFactoryImpl();
      SOAPMessage soapMsg = factory.createMessage(null, inputStream);
      SOAPEnvelope env = soapMsg.getSOAPPart().getEnvelope();
      Document doc = env.getOwnerDocument();

      String inputString = DOMWriter.printNode(soapMsg.getSOAPPart(), true);
View Full Code Here

      ByteArrayOutputStream stream = new ByteArrayOutputStream();
      soapMsg.writeTo(stream);

      ByteArrayInputStream instream = new ByteArrayInputStream(stream.toByteArray());
      soapMsg = factory.createMessage(null, instream);
      env = soapMsg.getSOAPPart().getEnvelope();
      doc = env.getOwnerDocument();

      SecurityDecoder decoder = new SecurityDecoder(new SecurityStore(), null, null, null);
      decoder.decode(doc);
View Full Code Here

            + "  </config>"
            + "</jboss-ws-security>";
      WSSecurityConfiguration configuration = WSSecurityOMFactory.newInstance().parse(new StringReader(conf));
      ByteArrayInputStream inputStream = new ByteArrayInputStream(envStr.getBytes());
      MessageFactory factory = new MessageFactoryImpl();
      SOAPMessage soapMsg = factory.createMessage(null, inputStream);
      String expected = DOMWriter.printNode(soapMsg.getSOAPPart().getEnvelope(), true);

      WSSecurityAPI sec = new WSSecurityDispatcher();
      try
      {
View Full Code Here

{
   /** Test that we can create the default envelope. */
   public void testCreateDefaultEnvelope() throws Exception
   {
      MessageFactory factory = new MessageFactoryImpl();
      SOAPMessage soapMessage = factory.createMessage();

      SOAPEnvelope env = soapMessage.getSOAPPart().getEnvelope();
      assertEquals("env:Envelope", env.getNodeName());
      assertEquals(Constants.NS_SOAP11_ENV, env.getNamespaceURI());
      assertEquals(Constants.NS_SOAP11_ENV, env.getNamespaceURI("env"));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.