Package javax.xml.soap

Examples of javax.xml.soap.DetailEntry


         TypeMapping typeMapping = serContext.getTypeMapping();

         Iterator it = detail.getDetailEntries();
         while (it.hasNext())
         {
            DetailEntry deElement = (DetailEntry)it.next();
            QName xmlName = deElement.getElementQName();
            log.debug("Processing detail entry: " + xmlName);

            OperationMetaData opMetaData = msgContext.getOperationMetaData();
            FaultMetaData faultMetaData = opMetaData.getFault(xmlName);
            if (faultMetaData != null)
            {
               log.debug("Deserialize fault: " + faultMetaData);
               QName xmlType = faultMetaData.getXmlType();
               Class<?> faultBeanClass = faultMetaData.getFaultBean();

               // Get the deserializer from the type mapping
               AbstractDeserializerFactory desFactory = (AbstractDeserializerFactory)typeMapping.getDeserializer(faultBeanClass, xmlType);
               if (desFactory == null)
                  throw new WebServiceException("Cannot obtain deserializer factory: xmlType=" + xmlType + ", javaType=" + faultBeanClass);

               // http://jira.jboss.org/jira/browse/JBWS-955
               // Cannot deserialize fault detail
               String prefix = deElement.getPrefix();
               if (prefix != null && prefix.length() > 0)
               {
                  String nsURI = deElement.getNamespaceURI();
                  if (nsURI.length() > 0 && deElement.getAttributeNS(Constants.NS_XMLNS, prefix).length() == 0)
                  {
                     try
                     {
                        deElement.addNamespaceDeclaration(prefix, nsURI);
                     }
                     catch (SOAPException e)
                     {
                        log.warn("Declaration of detail entry namespace failed", e);
                     }
View Full Code Here


                OMBlockFactory bf =
                        (OMBlockFactory)FactoryRegistry.getFactory(OMBlockFactory.class);
                ArrayList<Block> list = new ArrayList<Block>();
                Iterator it = detail.getDetailEntries();
                while (it.hasNext()) {
                    DetailEntry de = (DetailEntry)it.next();
                    OMElement om = converter.toOM(de);
                    Block b = bf.createFrom(om, null, om.getQName());
                    list.add(b);
                }
                blocks = new Block[list.size()];
View Full Code Here

    ArrayList aList = new ArrayList();
    while(detailEntryIter.hasNext()){
      Object o = detailEntryIter.next();
      if(o instanceof org.apache.axis2.om.OMElement){
        OMElement omDetailEntry = (OMElement)o;
        DetailEntry detailEntry = new DetailEntryImpl(omDetailEntry);
        aList.add(detailEntry);
      }
    }
    return aList.iterator();
  }
View Full Code Here

        Detail detail = new Detail(fault);
        Element[] darray = fault.getFaultDetails();
        for (int i = 0; i < darray.length; i++)
        {
            Element detailtEntryElem = darray[i];
            DetailEntry detailEntry = detail.addDetailEntry(
                    new PrefixedQName(detailtEntryElem.getNamespaceURI(),
                            detailtEntryElem.getLocalName(), detailtEntryElem.getPrefix()));
            copyChildren(detailEntry, detailtEntryElem);
        }
        return detail;
View Full Code Here

     * @param   name a <code>Name</code> object identifying the new <code>DetailEntry</code> object
     * @return DetailEntry.
     * @throws SOAPException  thrown when there is a problem in adding a DetailEntry object to this Detail object.
     */
    public DetailEntry addDetailEntry(Name name) throws SOAPException {
        DetailEntry entry = new org.apache.axis.message.DetailEntry(name);
        addChildElement(entry);
        return entry;
    }
View Full Code Here

   private Detail createDetailElement() throws SOAPException
   {
      SOAPFactory factory = SOAPFactory.newInstance();
      Detail detail = factory.createDetail();
      Name name = factory.createName("name", "ns1", "http://somens");
      DetailEntry detailEntry = detail.addDetailEntry(name);
      detailEntry.setValue("Kermit");
      return detail;
   }
View Full Code Here

         TypeMapping typeMapping = serContext.getTypeMapping();

         Iterator it = detail.getDetailEntries();
         while (it.hasNext())
         {
            DetailEntry deElement = (DetailEntry)it.next();
            QName xmlName = deElement.getElementQName();
            log.debug("Processing detail entry: " + xmlName);

            OperationMetaData opMetaData = msgContext.getOperationMetaData();
            FaultMetaData faultMetaData = opMetaData.getFault(xmlName);
            if (faultMetaData != null)
            {
               log.debug("Deserialize fault: " + faultMetaData);
               QName xmlType = faultMetaData.getXmlType();
               Class<?> faultBeanClass = faultMetaData.getFaultBean();

               // Get the deserializer from the type mapping
               AbstractDeserializerFactory desFactory = (AbstractDeserializerFactory)typeMapping.getDeserializer(faultBeanClass, xmlType);
               if (desFactory == null)
                  throw new WebServiceException("Cannot obtain deserializer factory: xmlType=" + xmlType + ", javaType=" + faultBeanClass);

               // http://jira.jboss.org/jira/browse/JBWS-955
               // Cannot deserialize fault detail
               String prefix = deElement.getPrefix();
               if (prefix != null && prefix.length() > 0)
               {
                  String nsURI = deElement.getNamespaceURI();
                  if (nsURI.length() > 0 && deElement.getAttributeNS(Constants.NS_XMLNS, prefix).length() == 0)
                  {
                     try
                     {
                        deElement.addNamespaceDeclaration(prefix, nsURI);
                     }
                     catch (SOAPException e)
                     {
                        log.warn("Declaration of detail entry namespace failed", e);
                     }
View Full Code Here

      //
      Detail detail = soapFault.getDetail();
      Iterator it = detail.getDetailEntries();
      while (it.hasNext())
      {
         DetailEntry deElement = (DetailEntry)it.next();
         Name deName = deElement.getElementName();

         String nsURI = deName.getURI();
         String prefix = deName.getPrefix();
         String attrValue = deElement.getAttribute("xmlns:" + prefix);
         if (nsURI.length() > 0 && attrValue.length() == 0)
            deElement.addNamespaceDeclaration(prefix, nsURI);
        
         String xmlFragment = DOMWriter.printNode(deElement, false);
         Element domElement = DOMUtils.parse(xmlFragment);
         assertNotNull(domElement);
      }
View Full Code Here

            try {
                SOAPFault soapFault = createSOAPFault();
                soapFault.setFaultString("hello world2");
                soapFault.setFaultActor("actor2");
                Detail detail = soapFault.addDetail();
                DetailEntry de = detail.addDetailEntry(new QName("urn://sample", "detailEntry"));
                de.setValue("Texas");
                throw new SOAPFaultException(soapFault);
            } catch (SOAPException se) {}
        } else if (b.equals("NPE")) {
            throw new NullPointerException();
        } else if (b.equals("NPE2")) {
View Full Code Here

        SOAPFault soapFault = sfe.getFault();
        assertNotNull(soapFault);
        assertEquals("hello world2", soapFault.getFaultString());
        assertEquals("actor2", soapFault.getFaultActor());
        assertNotNull(soapFault.getDetail());
        DetailEntry de = (DetailEntry) soapFault.getDetail().getDetailEntries().next();
        assertNotNull(de);
        assertEquals("urn://sample", de.getNamespaceURI());
        assertEquals("detailEntry", de.getLocalName());
        assertEquals("Texas", de.getValue());
       
        // Repeat to verify behavior
        try{
            exception = null;
           
            // the invoke will throw an exception, if the test is performed right
            int total = proxy.throwFault(2, "SOAPFaultException2", 2)// "SOAPFaultException" will cause service to throw SOAPFaultException
           
        }catch(SOAPFaultException e){
            // Okay
            exception = e;
        } catch (Exception e) {
            fail("Did not get a SOAPFaultException");
        }

        TestLogger.logger.debug("----------------------------------");
       
        assertNotNull(exception);
        sfe = (SOAPFaultException) exception;
        soapFault = sfe.getFault();
        assertNotNull(soapFault);
        assertEquals("hello world2", soapFault.getFaultString());
        assertEquals("actor2", soapFault.getFaultActor());
        assertNotNull(soapFault.getDetail());
        de = (DetailEntry) soapFault.getDetail().getDetailEntries().next();
        assertNotNull(de);
        assertEquals("urn://sample", de.getNamespaceURI());
        assertEquals("detailEntry", de.getLocalName());
        assertEquals("Texas", de.getValue());
    }
View Full Code Here

TOP

Related Classes of javax.xml.soap.DetailEntry

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.