CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2011
    Posts
    1

    Serialize Java object

    I'm developing an android application, where I get some object from a .NET web service using SOAP. I have no problem getting my object. I use ksoap2-android to handle the request.

    I need a good way to parse this object's types to a complementary Java object. Anyone knows a good way to do this?

    It's composed of simple types and other objects composed of simple types.

    The only way I know right now, is something like:

    Code:
    String[] types =  o.toString().split(";");
    Then parse the string array. There most be an more convenient way to do it?

    My object looks like this:
    Code:
    anyType{
    	Success=true; 
    	UserMessage=anyType{}; 
    	TechnicalMessage=anyType{}; 
    	IntValue=0; 
    	DoubleValue=0; 
    	DateTimeValue=0001-01-01T00:00:00; 
    	AgeGroups=anyType{}; 
    	SessionConfigurations=anyType{
    		Client_SessionConfiguration=anyType{
    			ID=2; 
    			Name=Skoleklasser; 
    		}; 
    		Client_SessionConfiguration=anyType{
    			ID=3; 
    			Name=Virksomheder; 
    		}; 
    		Client_SessionConfiguration=anyType{
    			ID=4; 
    			Name=Gæster; 
    		}; 
    	}; 
    	ClientSettings=anyType{
    		ID=1;
    		HeartBeatIntervalInSeconds=5;
    		DataVersion=0.15;
    	}; 
    }

  2. #2
    Join Date
    May 2006
    Location
    UK
    Posts
    4,473

    Re: Serialize Java object

    Have you looked at reflection which I believe is supported on Android.
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured