Package org.apache.axis

Examples of org.apache.axis.AxisFault


        if (qname == null ||
            (Constants.isSOAP_ENC(qname.getNamespaceURI()) &&
             "Array".equals(qname.getLocalPart()))) {
            qname = getTypeQName(type);
            if (qname == null) {
                throw new AxisFault("Class:" +type.getName());
            }
        }

        // Return null it a simple type (not an element)
        String nsURI = qname.getNamespaceURI();
View Full Code Here


            ser = (Serializer)factory.getSerializerAs(Constants.AXIS_SAX);
        }

        // if we can't get a serializer, that is bad.
        if (ser == null) {
            throw new AxisFault(
                    Messages.getMessage("NoSerializer00", type.getName()));
        }

        // Write the namespace
        writeTypeNamespace(type, qName);

        // If an array the component type should be processed first
        String componentTypeName = null;
        Class componentType = null;
        if (type.isArray()) {
            String dimString = "[]";
            componentType = type.getComponentType();
            if (componentType.isArray()) {
                while (componentType.isArray()) {
                    dimString += "[]";
                    componentType = componentType.getComponentType();
                }
            }
            componentTypeName = writeType(componentType, null) + dimString;
        }

        String prefix = namespaces.getCreatePrefix(qName.getNamespaceURI());
        String prefixedName = prefix+":"+qName.getLocalPart();

        // If processed before, or this is a known namespace, return
        if (!addToTypesList(qName))
          return prefixedName;
        if (type.isArray()) {
            // ComplexType representation of array
            Element complexType = docHolder.createElement("complexType");
            writeSchemaElement(qName, complexType);
            complexType.setAttribute("name", qName.getLocalPart());

            Element complexContent = docHolder.createElement("complexContent");
            complexType.appendChild(complexContent);

            Element restriction = docHolder.createElement("restriction");
            complexContent.appendChild(restriction);
            restriction.setAttribute("base",
                                     Constants.NS_PREFIX_SOAP_ENC + ":Array");

            Element attribute = docHolder.createElement("attribute");
            restriction.appendChild(attribute);
            attribute.setAttribute("ref",
                                   Constants.NS_PREFIX_SOAP_ENC +":arrayType");
            attribute.setAttribute(Constants.NS_PREFIX_WSDL +":arrayType",
                                   componentTypeName );
        } else {
            try {
                if (isEnumClass(type)) {
                    writeEnumType(qName, type);
                } else {
                    ser.writeSchema(this);
                }
            } catch (Exception e) {
                throw new AxisFault(Messages.getMessage("writeSchemaProblem00", type.getName()), e);
            }
        }
        return prefixedName;
    }
View Full Code Here

        // NOTE: Do we really need to have this in the config file
        // since we can get it from ejbHome.getClass()???
        String homeName = (String) getStrOption(OPTION_HOMEINTERFACENAME,
                                                msgContext.getService());
        if (homeName == null)
            throw new AxisFault(
                    Messages.getMessage("noOption00",
                                         OPTION_HOMEINTERFACENAME,
                                         msgContext.getTargetService()));

        // Load the Home class name given in the config file
View Full Code Here

                Object ejbHome = getEJBHome(service, msgContext, beanJndiName);

                String homeName = (String)getStrOption(OPTION_HOMEINTERFACENAME,
                                                        service);
                if (homeName == null)
                    throw new AxisFault(
                            Messages.getMessage("noOption00",
                                                 OPTION_HOMEINTERFACENAME,
                                                 service.getName()));

                // Load the Home class name given in the config file
View Full Code Here

                }
            ); //Add the attachment.

        if (null == ret) {
            System.out.println("Received null ");
            throw new AxisFault("", "Received null", null, null);
        }

        if (ret instanceof String) {
            System.out.println("Received problem response from server: " + ret);
            throw new AxisFault("", (String) ret, null, null);
        }

        if (!(ret instanceof DataHandler)) {
            //The wrong type of object that what was expected.
            System.out.println("Received problem response from server:" +
                ret.getClass().getName());
            throw new AxisFault("", "Received problem response from server:" +
                    ret.getClass().getName(), null, null);

        }
        //Still here, so far so good.
        //Now lets brute force compare the source attachment
        // to the one we received.
        DataHandler rdh = (DataHandler) ret;

        //From here we'll just treat the data resource as file.
        String receivedfileName = rdh.getName();//Get the filename.

        if ( receivedfileName == null) {
            System.err.println("Could not get the file name.");
            throw new AxisFault("", "Could not get the file name.", null, null);
        }


        System.out.println("Going to compare the files..");
        boolean retv = compareFiles( filename,  receivedfileName);
View Full Code Here

                }
            ); //Add the attachment.

        if (null == ret) {
            System.out.println("Received null ");
            throw new AxisFault("", "Received null", null, null);
        }

        if (ret instanceof String) {
            System.out.println("Received problem response from server: " + ret);
            throw new AxisFault("", (String) ret, null, null);
        }

        if (!(ret instanceof javax.activation.DataHandler[])) {
            //The wrong type of object that what was expected.
            System.out.println("Received unexpected type :" +
                ret.getClass().getName());
            throw new AxisFault("", "Received unexpected type:" +
                    ret.getClass().getName(), null, null);

        }
        //Still here, so far so good.
        //Now lets brute force compare the source attachment
View Full Code Here

    }

    void validate(Object ret, Call call, final String expOrdPattern) throws Exception{  
        if (null == ret) {
            System.out.println("Received null ");
            throw new AxisFault("", "Received null", null, null);
        }

        if (ret instanceof String) {
            System.out.println("Received problem response from server: " + ret);
            throw new AxisFault("", (String) ret, null, null);
        }

        Vector vret= (Vector) ret;

        if (!(ret instanceof java.util.Vector )) {
            //The wrong type of object that what was expected.
            System.out.println("Received unexpected type :" +
                ret.getClass().getName());
            throw new AxisFault("", "Received unexpected type:" +
                    ret.getClass().getName(), null, null);

        }

        org.apache.axis.message.RPCElement retrpc= (org.apache.axis.message.RPCElement )
          ((Vector)ret).elementAt(0);

        Document retDoc= org.apache.axis.utils.XMLUtils.newDocument(
          new org.xml.sax.InputSource(new java.io.ByteArrayInputStream(
            retrpc.toString().getBytes())));

        //get at the attachments.   
        org.apache.axis.attachments.Attachments attachments=
          call.getResponseMessage().getAttachmentsImpl();

        //Still here, so far so good.
        Element rootEl= retDoc.getDocumentElement();

        Element caEl= getNextFirstChildElement(rootEl);
        //this should be the only child element with the ref to our attachment
        // response.
        String href= caEl.getAttribute("href");
        org.apache.axis.Part p= attachments.getAttachmentByReference(href);
        if(null == p)
         throw new org.apache.axis.AxisFault("Attachment for ref='"+href+"' not found." );

         //Check to see the the attachment were sent in order
        String ordPattern= caEl.getAttribute("ordinalPattern");
        if(!expOrdPattern.equals(ordPattern))
          throw new org.apache.axis.AxisFault(
           "Attachments sent out of order expected:'" +expOrdPattern + "', got:'"+ordPattern+"'."  );

         //now get at the data...
         DataHandler dh= ((org.apache.axis.attachments.AttachmentPart)p).getDataHandler();
         System.err.println("content-type:" + dh.getContentType());

       java.util.Vector rspVector= null;
       Object rspObject =  dh.getContent();//This SHOULD just return the vector but reality strikes...
       if(rspObject == null)
           throw new AxisFault("", "Received unexpected object:null", null, null);
       else if(rspObject instanceof java.util.Vector) rspVector= (java.util.Vector)rspObject;
       else if(rspObject instanceof java.io.InputStream)
          rspVector= (java.util.Vector)
           new java.io.ObjectInputStream((java.io.InputStream)rspObject ).readObject();
       else   
           throw new AxisFault("", "Received unexpected object:" +
                    rspObject.getClass().getName(), null, null);

      StringBuffer fullmsg= new StringBuffer();
      for(java.util.Iterator ri= rspVector.iterator(); ri.hasNext();){
        String part= (String)ri.next();
View Full Code Here

          Object ret = null;
          try {         
            ret = call.waitForReturnValue(1000 * 20); //wait 20 seconds
          } catch (Throwable t) {
            System.out.println("Received problem response: " + t);
            throw new AxisFault("", t.toString(), null,null);
          }
         
          if (ret instanceof String) {
              System.out.println("Received problem response from server: "+ret);
              throw new AxisFault("", (String)ret, null, null);
          }
         
          res = (Float) ret;
      }

View Full Code Here

        public void invoke(MessageContext msgContext) throws AxisFault {
            TestMessageContext mc = (TestMessageContext)msgContext;
            assertEquals("Handler.invoke out of sequence", chainPos, mc.count());
            invoked = true;
            if (doFault) {
                throw new AxisFault(TestChainFault.FAULT_MESSAGE);
            }
            mc.incCount();
        }
View Full Code Here

            }
            else {
            // We don't already have a transport for this address.  Create one.
                transport = getTransportForProtocol(protocol);
                if (transport == null)
                    throw new AxisFault("Call.setTargetEndpointAddress",
                                 Messages.getMessage("noTransport01",
                                 protocol), null, null);
                transport.setUrl(address.toString());
                setTransport(transport);
                service.registerTransportForURL(address, transport);
View Full Code Here

TOP

Related Classes of org.apache.axis.AxisFault

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.