Package javax.xml.soap

Examples of javax.xml.soap.SOAPFactory


        }
    }

    public void testCreateFault() {
        try {
            SOAPFactory factory = SOAPFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
            //SOAPFactory factory = SOAPFactory.newInstance();
            SOAPFault sf = factory.createFault("This is the fault reason.",
                                               SOAPConstants.SOAP_RECEIVER_FAULT);
            assertNotNull(sf);
            assertTrue(sf instanceof SOAPFault);
            QName fc = sf.getFaultCodeAsQName();
            //Expect FaultCode="+SOAPConstants.SOAP_RECEIVER_FAULT
View Full Code Here


    }

    public void testCreateFault1() {
        try {
            //SOAPFactory factory = SOAPFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
            SOAPFactory factory = SOAPFactory.newInstance();
            SOAPFault sf = factory.createFault("This is the fault reason.",
                                               SOAPConstants.SOAP_RECEIVER_FAULT);
            assertNotNull(sf);
            QName fc = sf.getFaultCodeAsQName();
            Iterator i = sf.getFaultReasonTexts();
View Full Code Here

    }

    /** for soap 1.1 */
    public void testSOAPFaultException1() {
        try {
            SOAPFactory factory = SOAPFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
            SOAPFault fault = factory.createFault("This is the fault reason.",
                                                  new QName("http://MyNamespaceURI.org/",
                                                            "My Fault Code"));
        } catch (UnsupportedOperationException e) {
            //Caught expected UnsupportedOperationException
        } catch (SOAPException e) {
View Full Code Here

    }

    /** for soap 1.2 */
    public void testSOAPFaultException2() {
        try {
            SOAPFactory factory = SOAPFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
            SOAPFault sf = factory.createFault("This is the fault reason.",
                                               new QName("http://MyNamespaceURI.org/",
                                                         "My Fault Code"));
            fail("Did not throw expected SOAPException");
        } catch (UnsupportedOperationException e) {
            //Caught expected UnsupportedOperationException
View Full Code Here

      String localName = domElement.getLocalName();
      String prefix = domElement.getPrefix() != null ? domElement.getPrefix() : "";
      String nsURI = domElement.getNamespaceURI() != null ? domElement.getNamespaceURI() : "";

      SOAPFactory factory = SOAPFactory.newInstance();
      SOAPElement soapElement = factory.createElement(localName, prefix, nsURI);

      if (domElement instanceof Element)
         DOMUtils.copyAttributes(soapElement, (Element)domElement);

      if (deep)
View Full Code Here

      // jaxws/api/javax_xml_ws/Dispatch/Client.java#invokeTestJAXBNull
      if (obj == null)
      {
         try
         {
            SOAPFactory factory = SOAPFactory.newInstance();
            SOAPFault fault = factory.createFault("Request object cannot be null", new QName("http://org.jboss.ws", "Dispatch"));
            fault.setFaultActor("client");
            throw new SOAPFaultException(fault);
         }
         catch (SOAPException e)
         {
View Full Code Here

   public void throwSoapFaultException()
   {
      // This should be thrown as-is
      try
      {
         SOAPFactory factory = SOAPFactory.newInstance();
         SOAPFault fault = factory.createFault("this is a fault string!", new QName("http://foo", "FooCode"));
         fault.setFaultActor("mr.actor");
         fault.addDetail().addChildElement("test");
         throw new SOAPFaultException(fault);
      }
      catch (SOAPException s)
View Full Code Here

         "<np:bear name='ted' zoo:species='ursus maritimus' xmlns:np='http://northpole.net' xmlns:zoo='http://zoofan.net'/>" +
         "</soap:Body>" +
         "</soap:Envelope>";

      SOAPMessage soapMessage = MessageFactory.newInstance().createMessage(null, new ByteArrayInputStream(xml.getBytes()));
      SOAPFactory soapFactory = SOAPFactory.newInstance();
      SOAPElement bearElement = (SOAPElement)soapMessage.getSOAPBody().getChildElements().next();

      assertEquals(2, getIteratorCount(bearElement.getAllAttributes()));

      Iterator it = bearElement.getAllAttributes();
      assertEquals(soapFactory.createName("name"), it.next());
      assertEquals(soapFactory.createName("species", null, "http://zoofan.net"), it.next());
   }
View Full Code Here

public class DocLitBareCodeFirstServiceImpl implements DocLitBareCodeFirstService {

    public GreetMeResponse greetMe(GreetMeRequest gmr) {
        if ("fault".equals(gmr.getName())) {
            try {
                SOAPFactory factory = SOAPFactory.newInstance();
                SOAPFault fault = factory.createFault("this is a fault string!",
                                                      new QName("http://foo", "FooCode"));
                fault.setFaultActor("mr.actor");
                fault.addDetail().addChildElement("test").addTextNode("TestText");
                throw new SOAPFaultException(fault);
            } catch (SOAPException ex) {
View Full Code Here

import javax.xml.soap.SOAPFault;

public class SoapFactoryImpl extends SOAPFactory {

    private SOAPFactory getSOAPFactory() throws SOAPException {
        final SOAPFactory factory =
            (SOAPFactory) SaajFactoryFinder.find("javax.xml.soap.SOAPFactory");
        return factory;

    }
View Full Code Here

TOP

Related Classes of javax.xml.soap.SOAPFactory

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.