Hi Everybody,

I was able to solve my problem of serialization.
The solution is as follows:
I had to mark every member variable of my user-defined object "public".
Also I had to make a few modifications in my deployment descriptor. 
I got this info from
http://www.javaranch.com/journal/200603/WSComplexTypes.html


Now I'm facing a problem with deserializing the object on client side. 
My Object contains a 2D Array of objects of type java.lang.Object, 2 int
values and 1 String object.
While deserializing I'm getting the following error:

Caused by: org.xml.sax.SAXException: No object was found for class type
int
   at
org.apache.axis.encoding.ConstructorTarget.set(ConstructorTarget.java:97)
   at
org.apache.axis.encoding.DeserializerImpl.valueComplete(DeserializerImpl.java:249)
   at
org.apache.axis.encoding.ser.ArrayDeserializer.valueComplete(ArrayDeserializer.java:583)
   at
org.apache.axis.encoding.DeserializerImpl.endElement(DeserializerImpl.java:509)
   at
org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
   at
org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:171)
   at
org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141)
   at
org.apache.axis.encoding.DeserializerImpl.startElement(DeserializerImpl.java:369)
   at
org.apache.axis.encoding.ser.BeanDeserializer.startElement(BeanDeserializer.java:154)
   at
org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1048)
   at
org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
   at
org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141)
   at
org.apache.axis.message.RPCElement.deserialize(RPCElement.java:345)
   at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
   at org.apache.axis.client.Call.invoke(Call.java:2467)

I'm attaching my server-config.wsdd and my client-side program.
Can anyone help me here?

Thanks,
Pratiksha

On Tue, 2008-01-29 at 12:25 +0530, Pratiksha Powar wrote:
> Hi Everybody,
> 
> I'm trying to return a user-defined object which contains two primitives
> namely : int and Java String and a 2D array of objects of
> type :java.lang.Object
> Can you tell how should I map these objects in the server-config.wsdd
> file so that axis produces the correct wsdl ?
> I'm attaching my copy of server-config.wsdd.
> Also is it possible to write your own wsdl and make axis point to it?
> 
> Thanks,
> Pratiksha
> 
> 
> ==============================
> DISCLAIMER: The information in this message is confidential and may be 
> legally privileged. It is intended solely for the addressee. Access to this 
> message by anyone else is unauthorized. If you are not the intended 
> recipient, any disclosure, copying, or distribution of the message, or any 
> action or omission taken by you in reliance on it, is prohibited and may be 
> unlawful. Please immediately contact the sender if you have received this 
> message in error. Further, this e-mail may contain viruses and all reasonable 
> precaution to minimize the risk arising there from is taken by OnMobile. 
> OnMobile is not liable for any damage sustained by you as a result of any 
> virus in this e-mail. All applicable virus checks should be carried out by 
> you before opening this e-mail or any attachment thereto. 
> Thank you - OnMobile Global Limited.
> ==============================
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
package db;

import java.net.MalformedURLException;
import java.rmi.RemoteException;
import javax.xml.rpc.ServiceException;
import javax.xml.namespace.QName;

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.ser.BeanSerializerFactory;
import org.apache.axis.encoding.ser.BeanDeserializerFactory;
import org.apache.axis.encoding.ser.ArraySerializerFactory;
import org.apache.axis.encoding.ser.ArrayDeserializerFactory;
import content.OnMobileResultSet;

public class DBManager 
{
	private static final String CLASS_NAME = "DBManager";
	//pratiksha: have to obtain endpoint from SPInteractor in DBUtils.java
	//use the following endpoint while going via tcpMon to connect to Axis
	private String endpoint = "http://127.0.0.1:1234/DBAccess/servlet/AxisServlet";;
	//private String endpoint = "http://172.16.27.23:8010/DBAccess/servlet/AxisServlet";;
	private Service  service ;
	
	private String cdNameSpc = "BeanOnMobileResultSet";
	private Class cdClass = OnMobileResultSet.class;
	private String cdClassName = "OnMobileResultSet";

	private String caNameSpc = "BeanOnMobileResultSet";
	private Class caClass = Object[][].class;
	private String caClassName ="ArrayOf_Content";
	private QName cdQName = null;
	private QName caQName = null;
	 
	
	public DBManager()
	{
		service = new Service();
		cdQName = new QName(cdNameSpc, cdClassName);
		caQName = new QName(caNameSpc, caClassName);
	}
	public  OnMobileResultSet executeStatement(String query)
	{
		OnMobileResultSet omrs = null;
		try
		{
			Call    call    = (Call) service.createCall();
			
			call.registerTypeMapping(cdClass, cdQName, new BeanSerializerFactory(cdClass, cdQName), new BeanDeserializerFactory(cdClass, cdQName));
			call.registerTypeMapping(caClass, caQName, new ArraySerializerFactory(caClass,caQName), new ArrayDeserializerFactory(caQName));
			call.setTargetEndpointAddress( new java.net.URL(endpoint) );
			call.setOperationName(new QName("urn:OnMobileDBServices","executeStatement"));
					     
            Object [] objArr = new Object []{query};  
            omrs =  (OnMobileResultSet)call.invoke(objArr);
            System.out.println("Result \n" + omrs.statusCode +" "+ omrs.statusMessage);
            
            
            Object row[]=null;
            String value=null;
            int row_count = omrs.row_Count;
            
            for(int i=0;i<row_count;i++)
            {
            	row =(Object []) omrs.result[i];
            	for(int j=0;j<row.length;j++)
            	{
            		value=(String)row[j];
            		
            		System.out.println("value :"+ value);
            	}
            }
                 
		}
		catch(ServiceException se)
		{
			se.printStackTrace();
			System.out.println(se);
		}
		catch(MalformedURLException me)
		{
			me.printStackTrace();
			System.out.println(me);
		}
		catch(RemoteException re)
		{
			re.printStackTrace();
			System.out.println(re);
		}
		
		return omrs;	

	}
	
	public  int  executeUpdate(String query)
	{
		int iRetVal = -1;
		OnMobileResultSet omrs = null;
		try
		{
			Call    call    = (Call) service.createCall();

			call.setTargetEndpointAddress( new java.net.URL(endpoint) );
			call.setOperationName(new QName("OnMobileDBServices","executeUpdate"));
		    
                       
            Object [] objArr = new Object []{query};  
            omrs =  (OnMobileResultSet)call.invoke(objArr);
            iRetVal = omrs.row_Count;
            return iRetVal; 
			
		}
		catch(ServiceException se)
		{
			se.printStackTrace();
			System.out.println(se);
		}
		catch(MalformedURLException me)
		{
			me.printStackTrace();
			System.out.println(me);
		}
		catch(RemoteException re)
		{
			re.printStackTrace();
			System.out.println(re);
		}
		
		return iRetVal ;
	}
	 public static void main(String [] args) 
	 {
		try
		{
			DBManager dbManager = new DBManager();
			dbManager.executeStatement("Select * from Service_Parameters");
					
		} 
		catch (Exception e)
		{			
			e.printStackTrace();
			    
		}
	 }
}

Attachment: server-config.wsdd
Description: XML document


==============================
DISCLAIMER: The information in this message is confidential and may be legally 
privileged. It is intended solely for the addressee. Access to this message by 
anyone else is unauthorized. If you are not the intended recipient, any 
disclosure, copying, or distribution of the message, or any action or omission 
taken by you in reliance on it, is prohibited and may be unlawful. Please 
immediately contact the sender if you have received this message in error. 
Further, this e-mail may contain viruses and all reasonable precaution to 
minimize the risk arising there from is taken by OnMobile. OnMobile is not 
liable for any damage sustained by you as a result of any virus in this e-mail. 
All applicable virus checks should be carried out by you before opening this 
e-mail or any attachment thereto. 
Thank you - OnMobile Global Limited.
==============================

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to