Package org.jboss.ws.core.soap

Examples of org.jboss.ws.core.soap.MessageFactoryImpl


  
   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

         + "  </tns:echoString>"
         + " </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);

      SecurityEncoder encoder = new SecurityEncoder(buildOperations(), new SecurityStore());
      encoder.encode(doc);

      log.debug("Encoded message:" + DOMWriter.printNode(doc, true));

      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

            + "    </requires>"
            + "  </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

   {
   }

   public MessageFactory getMessageFactory()
   {
      return new MessageFactoryImpl();
   }
View Full Code Here

public class SOAPEnvelopeTestCase extends JBossWSTest
{
   /** 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

              " </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();

      assertEquals("env:Envelope", env.getNodeName());
      assertEquals(Constants.NS_SOAP12_ENV, env.getNamespaceURI());
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 wasEnv = soapMsg.getSOAPPart().getEnvelope();

      Element expEnv = DOMUtils.parse(envStr);
      assertEquals(expEnv, wasEnv);
   }
View Full Code Here

public class SOAPHeaderTestCase extends JBossWSTest
{

   public void testAddHeaderElement() throws Exception
   {
      MessageFactory factory = new MessageFactoryImpl();
      SOAPMessage soapMessage = factory.createMessage();
      SOAPEnvelope soapEnv = soapMessage.getSOAPPart().getEnvelope();
      SOAPHeader soapHeader = soapEnv.getHeader();

      // Test if we see the right NS URI for the env prefix
      assertEquals(Constants.NS_SOAP11_ENV, soapHeader.getNamespaceURI("env"));
View Full Code Here

              "  <ns2:Bar xmlns:ns2='http://org.jboss.ws/header2'>SomeOtherValue</ns2:Bar>" +
              " </env:Header>" +
              " <env:Body/>" +
              "</env:Envelope>";

      MessageFactory factory = new MessageFactoryImpl();
      SOAPMessage soapMessage = factory.createMessage(null, new ByteArrayInputStream(envStr.getBytes()));
      SOAPEnvelope soapEnv = soapMessage.getSOAPPart().getEnvelope();
      SOAPHeader soapHeader = soapEnv.getHeader();

      Iterator it = soapHeader.examineAllHeaderElements();
      SOAPHeaderElement foo = (SOAPHeaderElement)it.next();
View Full Code Here

TOP

Related Classes of org.jboss.ws.core.soap.MessageFactoryImpl

Copyright © 2018 www.massapicom. 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.