Package org.jboss.ws.core.soap

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


   //JBWS-3164
   public void testStreamSourceConstructedWithFile() throws Exception {
      //File file = new File(this.getClass().getResource("request.xml").toString()) will break this test
      File file = new File(this.getClass().getResource("request.xml").getFile());     
      StreamSource requestSource = new StreamSource(file);     
      XMLFragment xmlFragment = new XMLFragment(requestSource);
      java.io.ByteArrayOutputStream bout = new java.io.ByteArrayOutputStream();
      xmlFragment.writeTo(bout);
      assertTrue(new String(bout.toByteArray()).indexOf("Hello") > -1);    
   }
View Full Code Here


         "<return>WSEjbWebServiceProvider-SayHello</return></ns2:sayHelloResponse>";
  
   public void testDOMSourceFragment() throws Exception
   {
      Element srcElement = DOMUtils.parse(XML_STRING);
      XMLFragment xmlFragment = new XMLFragment( new DOMSource(srcElement) );
      testSourceAPI(xmlFragment);
   }
View Full Code Here

   public void testJAXBFragments() throws Exception
   {
      ByteArrayOutputStream bout = new ByteArrayOutputStream();
      PrintWriter writer = new PrintWriter( bout);

      XMLFragment fragment = new XMLFragment(JAXB_FRAGMENT);
      fragment.writeTo(writer);
      writer.flush();

      String s = bout.toString();
      //System.out.println(s);
View Full Code Here

   public void testJAXBFragments2() throws Exception
   {
      ByteArrayOutputStream bout = new ByteArrayOutputStream();
      PrintWriter writer = new PrintWriter( bout);

      XMLFragment fragment = new XMLFragment(XML_STRING);
      fragment.writeTo(writer);
      writer.flush();

      String s = bout.toString();

      assertTrue("Empty result returned", s.length()>0);
View Full Code Here

        "<Name>Thomas</Name>" +
       "</Customer>" +
      "</tns:Order>";

      SOAPContentElement soapEl = new SOAPContentElement(name);
      soapEl.setXMLFragment(new XMLFragment(xmlFragment) );

      assertEquals(name, soapEl.getElementName());

      Iterator it = soapEl.getChildElements();
      SOAPElement child1 = (SOAPElement)it.next();
View Full Code Here

   {
      Name name = new NameImpl("Order", "tns", "http://someURI");
      String xmlFragment = "<tns:Order xmlns:tns='http://someURI'>No child element</tns:Order>";

      SOAPContentElement soapEl = new SOAPContentElement(name);
      soapEl.setXMLFragment(new XMLFragment(xmlFragment) );

      assertEquals(name, soapEl.getElementName());
      assertEquals("No child element", soapEl.getValue());
   }
View Full Code Here

   {
      Name name = new NameImpl("Order", "tns", "http://someURI");
      String xmlFragment = "<tns:Order xmlns:tns='http://someURI'/>";

      SOAPContentElement soapEl = new SOAPContentElement(name);
      soapEl.setXMLFragment(new XMLFragment(xmlFragment) );

      assertEquals(name, soapEl.getElementName());
      assertFalse(soapEl.hasChildNodes());
      assertNull(soapEl.getValue());
   }
View Full Code Here

   {
      Name name = new NameImpl("Order", "tns", "http://someURI");
      String xmlFragment = "<tns:BadName xmlns:tns='http://someURI'>No child element</tns:BadName>";

      SOAPContentElement soapEl = new SOAPContentElement(name);
      soapEl.setXMLFragment(new XMLFragment(xmlFragment) );

      try
      {
         assertEquals(name, soapEl.getElementName());
         assertEquals("No child element", soapEl.getValue());
View Full Code Here

      Name name = new NameImpl("Bar", "ns2", "http://org.jboss.ws/header2");
      String xmlFragment = "<ns2:Bar xmlns:ns2='http://org.jboss.ws/header2' foo='Kermit'>SomeOtherValue</ns2:Bar>";

      SOAPContentElement soapEl = new SOAPContentElement(name);
      soapEl.setAttribute("foo", "Kermit");
      soapEl.setXMLFragment(new XMLFragment(xmlFragment) );
      assertEquals(name, soapEl.getElementName());

      assertEquals("Kermit", soapEl.getAttributeValue(new NameImpl("foo")));
      assertEquals("SomeOtherValue", soapEl.getValue());
   }
View Full Code Here

      SOAPMessage soapMessage = factory.createMessage(null, new ByteArrayInputStream(envStr.getBytes()));
     
      SOAPContentElement sce = getSOAPContentElement(soapMessage);
     
      //force transition to XML_VALID and set an equivalent XMLFragment (but having a new ns declaration that would overwrite the one in the original fragment)
      sce.setXMLFragment(new XMLFragment("<Foo xmlns='firstNS' xmlns:ns2='secondNs'/>"));
     
      SOAPBody soapBody = soapMessage.getSOAPBody();
      //force transition to DOM_VALID
      soapBody.getFirstChild().getChildNodes();
     
View Full Code Here

TOP

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

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.