Hi,

I am getting the below exception when I try to deploy my web service using the AdminClient utlity. I am using Axis 1.2 Beta .  I am able to successfully deploy my service in Axis 1.1.  I have also attached the sources of my sample web service along with a README file.

Please let me know what is the problem as I need to file a bug report for another issue of mine. I wanted to the test the sample with Axis 1.2 Beta before filing the bug.



May 4, 2004 5:09:02 PM org.apache.axis.utils.JavaUtils isAttachmentSupported
WARNING: Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.
Processing file src/MySoapService.wsdd
Exception: AxisFault
 faultCode: {http://xml.apache.org/axis/}HTTP
 faultSubcode:
 faultString: (500)Internal Server Error
 faultActor:
 faultNode:
 faultDetail:
        {}:return code:  500
<html><head><title>Apache Tomcat/4.1.29 - Error report</title><STYLE><!--H1{font-family : sans-serif,Arial,Tahoma;color : white;background-color : #0086b2;} H3{font-family : sans-serif,Arial,Tahoma;color : white;background-color : #0086b2;} BODY{font-family : sans-serif,Arial,Tahoma;color : black;background-color : white;} B{color : white;background-color : #0086b2;} HR{color : #0086b2;} --></STYLE> </head><body><h1>HTTP Status 500 - </h1><HR size="1" noshade><p><b>type</b> Exception report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>The server encountered an internal error () that prevented it from fulfilling this request.</u></p><p><b>exception</b> <pre>java.lang.NullPointerException
        at org.apache.axis.encoding.DeserializationContextImpl.getTypeMapping(DeserializationContextImpl.java:528)
        at org.apache.axis.encoding.DeserializationContextImpl.getDeserializer(DeserializationContextImpl.java:435)
        at org.apache.axis.encoding.DeserializationContextImpl.getDeserializerForType(DeserializationContextImpl.java:515)
        at org.apache.axis.message.SOAPFaultBuilder.onStartChild(SOAPFaultBuilder.java:281)
        at org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:1001)
        at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
        at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at javax.xml.parsers.SAXParser.parse(Unknown Source)
        at org.apache.axis.encoding.DeserializationContextImpl.parse(DeserializationContextImpl.java:218)
        at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:568)
        at org.apache.axis.Message.getSOAPEnvelope(Message.java:427)
        at org.apache.axis.Message.getContentType(Message.java:484)
        at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:683)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
        at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:301)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
        at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
        at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
        at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
        at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
        at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
        at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
        at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
        at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:193)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:781)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:549)
        at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:589)
        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:666)
        at java.lang.Thread.run(Thread.java:534)
</pre></p><HR size="1" noshade><h3>Apache Tomcat/4.1.29</h3></body></html>
        {http://xml.apache.org/axis/}HttpErrorCode:500



Regards,
Jagannath


--
Signature -------------------------------------------------------
Jagannath.C
AdventNet ManageEngine JMX Studio
Off : 2243115 Extn:5252
Res: 22790045
Nortel: 925-895-6380
www.adventnet.com
-------------------------------------------------------
package com.samples.soap.axis.ser;

import java.io.*;

import org.apache.axis.encoding.DeserializationContext;
import org.apache.axis.encoding.Deserializer;
import org.apache.axis.encoding.DeserializerImpl;
import org.apache.axis.encoding.DeserializerTarget;
import org.apache.axis.encoding.FieldTarget;
import org.apache.axis.Constants;
import org.apache.axis.message.SOAPHandler;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import javax.xml.namespace.QName;
import java.util.Hashtable;
import java.util.ArrayList;
import java.util.HashSet;
/**
* This class is used for representing a pair (attribute name, attribute value).
* @version C_VERSION
**/
public class ArrayListDeser extends DeserializerImpl{

        private final String NAME = "item";
        private Hashtable typesByMemberName = new Hashtable();
        private ArrayList list  = null;

        public ArrayListDeser(){
        list  = new ArrayList();
                System.out.println("**** Inside ArrayListDeser ........ ");
        //typesByMemberName.put(NAME,Constants.XSD_STRING);
                typesByMemberName.put(NAME,Constants.QNAME_LITERAL_ITEM);

                //typesByMemberName.put(READABLE, Constants.XSD_BOOLEAN);
                //typesByMemberName.put(WRITABLE,Constants.XSD_BOOLEAN);
                //typesByMemberName.put(ISIS,Constants.XSD_BOOLEAN);
        //value = new Data();
    }

        /**
    * This method is invoked when an element start tag is encountered.
    * @param namespace is the namespace of the element
    * @param localName is the name of the element
    * @param prefix is the element's prefix
    * @param attributes are the attributes on the element...used to get the type
    * @param context is the DeserializationContext
    */
    public SOAPHandler onStartChild(String namespace,
                                        String localName,
                                        String prefix,
                                        Attributes attributes,
                                        DeserializationContext context)
            throws SAXException
        {
            //System.out.println("Inside OnstartChild of Attribute......... ");
            //System.out.println("The name space is "+namespace+"  local name is 
"+localName);
            QName typeQName = (QName)typesByMemberName.get(localName);
            if (typeQName == null)
                throw new SAXException("Invalid element in Data struct - " + 
localName);

            // These can come in either order.
            Deserializer dSer = context.getDeserializerForType(typeQName);
            if(dSer == null){
                                dSer = new DeserializerImpl();
                        }
                        try {
                //dSer.registerValueTarget(new FieldTarget(value, localName));
                                dSer.registerValueTarget(new 
DeserializerTarget(this,localName));
            } catch (Exception e) {
                throw new SAXException(e);
            }

            if (dSer == null)
                throw new SAXException("No deserializer for a " + typeQName + "???");

            return (SOAPHandler)dSer;
        }

                public void setChildValue(Object value,Object hint) throws 
SAXException{

                        System.out.println("######### ^^^^^^^^^ THE HINT IS "+hint+" 
######## THE VALUE IS "+value);
                        if(hint.equals(NAME)){
                                list.add(value);
                                //name = (String)value;
                        }
                        /*
                        else if(hint.equals(VALUE)){
                                attrValue = value;
                                //readable = ((Boolean)value).booleanValue();
                                //featureName = value;
                        }
                        //System.out.println(" The value is "+value);
                        */
                }

                public void onEndElement(String namespace,String 
localName,DeserializationContext context){
                        //System.out.println(" The llllllllllllllllllocal name is 
"+localName);
                        value = list;
                        //System.out.println("rtrrruururuytutititti :::::::: 
"+buff.toString());
                        /*try{
                                 value = new Attribute(name,attrValue);
                        }catch(Exception e){
                                e.printStackTrace();
                        }*/
        }


}
package com.samples.soap.axis.ser;

import org.xml.sax.Attributes;
import org.xml.sax.SAXException;

import javax.xml.namespace.QName;
import java.io.IOException;

import org.apache.axis.encoding.Serializer;
import org.apache.axis.encoding.SerializerFactory;
import org.apache.axis.encoding.SerializationContext;
import org.apache.axis.encoding.Deserializer;
import org.apache.axis.encoding.DeserializerFactory;
import org.apache.axis.encoding.DeserializationContext;
import org.apache.axis.encoding.Deserializer;
import org.apache.axis.Constants;

import java.util.Iterator;
import java.util.Vector;

/**
 * DeserializerFactory for ObjectName
 *
 * @author
 */
public class ArrayListDeserFactory implements DeserializerFactory {
    private Vector mechanisms;

    public javax.xml.rpc.encoding.Deserializer getDeserializerAs(String mechanismType) 
{
        return new ArrayListDeser();
    }
    public Iterator getSupportedMechanismTypes() {
        if (mechanisms == null) {
            mechanisms = new Vector();
            mechanisms.add(Constants.AXIS_SAX);
        }
        return mechanisms.iterator();
    }
}
package com.samples.soap.axis.ser;

import java.io.*;
import java.util.*;
import java.net.*;

import org.w3c.dom.Element;

import org.apache.axis.encoding.SerializationContext;
import org.apache.axis.encoding.Serializer;
import org.apache.axis.encoding.XMLType;
import org.apache.axis.message.SOAPHandler;
import org.apache.axis.Constants;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.apache.axis.Constants;
import org.apache.axis.wsdl.fromJava.Types;

import javax.xml.namespace.QName;


/**
* This class is used for representing a pair (attribute name, attribute value).
* @version C_VERSION
**/
public class ArrayListSer implements Serializer{

        public void serialize(QName name, Attributes attributes,
                                        Object value, SerializationContext context)
                        throws IOException
        {
                if (!(value instanceof ArrayList))
                        throw new IOException("Can't serialize a " + 
value.getClass().getName() + " with a DataSerializer.");
                ArrayList list  = (ArrayList)value;
                context.startElement(name, attributes);
                Object[] arr = list.toArray();
                for(int i=0; i<arr.length; i++){
                        System.out.println("90000000000000000000000 
"+Constants.QNAME_LITERAL_ITEM+"  "+arr[i]);
                        context.serialize(Constants.QNAME_LITERAL_ITEM,null,arr[i]);
                }
                context.endElement();
        }

        public String getMechanismType() {
                return Constants.AXIS_SAX;
        }

        /**
        * Return XML schema for the specified type, suitable for insertion into
        * the <types> element of a WSDL document.
        *
        * @param types the Java2WSDL Types object which holds the context
        *              for the WSDL being generated.
        * @return true if we wrote a schema, false if we didn't.
        * @see org.apache.axis.wsdl.fromJava.Types
        */
        public Element writeSchema(Class javaType, Types types) throws Exception {
                Element complexType = types.createElement("complexType");
        complexType.setAttribute("name","ArrayList");

        Element all = types.createElement("all");
        Element item = types.createElement("element");
        item.setAttribute("name","item");
        item.setAttribute("type", XMLType.XSD_ANYTYPE.getLocalPart());
        item.setAttribute("minOccurs","0");
        item.setAttribute("maxOccurs","unbounded");

        all.appendChild(item);

        complexType.appendChild(all);

                return complexType;
        }

}
package com.samples.soap.axis.ser;

import org.xml.sax.Attributes;
import org.xml.sax.SAXException;

import javax.xml.namespace.QName;
import java.io.IOException;

import org.apache.axis.encoding.Serializer;
import org.apache.axis.encoding.SerializerFactory;
import org.apache.axis.encoding.SerializationContext;
import org.apache.axis.encoding.Deserializer;
import org.apache.axis.encoding.DeserializerFactory;
import org.apache.axis.encoding.DeserializationContext;
import org.apache.axis.encoding.Deserializer;
import org.apache.axis.Constants;

import java.util.Iterator;
import java.util.Vector;

public class ArrayListSerFactory implements SerializerFactory {
                private Vector mechanisms;
                
                public javax.xml.rpc.encoding.Serializer getSerializerAs(String 
mechanismType) {
                                return new ArrayListSer();
                }
                public Iterator getSupportedMechanismTypes() {
                                if (mechanisms == null) {
                                                mechanisms = new Vector();
                                                mechanisms.add(Constants.AXIS_SAX);
                                }
                                return mechanisms.iterator();
                }
}
package com.samples.soap;

import java.util.ArrayList;

public class MySoapService
{
    public MySoapService() {
    }

    public ArrayList getData() {
        Object[] arr1 = new Object[]{"Hello"};
        Object[] arr2 = new Object[]{"How"};
        Object[] arr3 = new Object[]{"Are"};
        Object[] arr4 = new Object[]{"You"};

        ArrayList list = new ArrayList();
        list.add(arr1);
        list.add(arr2);
        list.add(arr3);
        list.add(arr4);

        return list;
    }
}
<deployment name="MySoapService" xmlns="http://xml.apache.org/axis/wsdd/"; 
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"; 
xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance";>
        <service name="MySoapService" provider="java:RPC">
                <parameter name="className" value="com.samples.soap.MySoapService" />
                <parameter name="allowedMethods" value="*" />
                <parameter name="scope" value="Application" />
        </service>

        <typeMapping xmlns:ns1="urn:MySoapServiceTypes" qname="ns1:ArrayList" 
type="java:java.util.ArrayList" 
serializer="com.samples.soap.axis.ser.ArrayListSerFactory" 
deserializer="com.samples.soap.axis.ser.ArrayListDeserFactory" 
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; />

        <typeMapping xmlns:ns1="urn:MySoapServiceTypes" qname="ns1:ArrayOfObject" 
type="java:java.lang.Object[]" 
serializer="org.apache.axis.encoding.ser.ArraySerializerFactory" 
deserializer="org.apache.axis.encoding.ser.ArrayDeserializerFactory" 
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; />

</deployment>
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="urn:MySoapService" xmlns:apachesoap="http://xml.apache.org/xml-soap"; xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"; xmlns:tns2="urn:MySoapServiceTypes" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; xmlns:tns1="urn:AdventNetSoapAgentTypes" xmlns:impl="urn:MySoapService" xmlns:intf="urn:MySoapService" xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"; xmlns="http://schemas.xmlsoap.org/wsdl/";>
<wsdl:types>
	<schema xmlns="http://www.w3.org/2001/XMLSchema"; targetNamespace="urn:MySoapServiceTypes">
		<import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
			<complexType name="ArrayList">
				<all>
					<element name="item" type="anyType" minOccurs="0" maxOccurs="unbounded"/>
				</all>
			</complexType>
	</schema>
</wsdl:types>
  <wsdl:message name="getDataResponse">
    <wsdl:part name="getDataReturn" type="tns2:ArrayList"/>
  </wsdl:message>
  <wsdl:message name="getDataRequest">
  </wsdl:message>
  <wsdl:portType name="MySoapService">
    <wsdl:operation name="getData">
      <wsdl:input name="getDataRequest" message="impl:getDataRequest"/>

      <wsdl:output name="getDataResponse" message="impl:getDataResponse"/>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="MySoapServiceSoapBinding" type="impl:MySoapService">
    <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="getData">
      <wsdlsoap:operation soapAction=""/>
      <wsdl:input name="getDataRequest">
        <wsdlsoap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; namespace="http://soap.samples.com"/>
      </wsdl:input>
      
      <wsdl:output name="getDataResponse">
        <wsdlsoap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; namespace="urn:MySoapService"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="MySoapServiceService">
    <wsdl:port name="MySoapService" binding="impl:MySoapServiceSoapBinding">
      <wsdlsoap:address location="http://localhost:8030/jmx/soapServices/MySoapService"/>

    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>
package com.samples.soap.client;


import MySoapServiceTypes.*;
import MySoapService_pkg.*;

public class MySoapServiceClient
{
        public static void main(String[] args) throws Exception
        {
                MySoapServiceServiceLocator locator = new 
MySoapServiceServiceLocator();
                MySoapServiceSoapBindingStub stub = 
(MySoapServiceSoapBindingStub)locator.getMySoapService();
                ArrayList list = stub.getData();
                Object[] items = list.getItem();
                System.out.println("No. of items : "+items[0]);
        }
}
Title: README
Steps to run the MySoapService sample

  1. Compile the sources except MySoapServiceClient.java . Keep the axis jars in the classpath.
  2. Add the ArrayList serializer files to the web server classpath
  3. Use the AdminClient utility to deploy the MySoapService
  4. Generate the client stubs using WSDL2Java utility with MySoapService.wsdl file as input
  5. Compile the generated stubs and add the classes to the classpath
  6. Compile MySoapServiceClient.java file
  7. Run the file to view the output.

Reply via email to