Java Web服务复杂类型
我有一个使用ksoap2的android应用程序和一个运行在tomcat axis2上的java Web服务 webservice中有一个方法返回:Java Web服务复杂类型,java,android,web-services,Java,Android,Web Services,我有一个使用ksoap2的android应用程序和一个运行在tomcat axis2上的java Web服务 webservice中有一个方法返回: public class RecipeSmallReturnType { public int mId; public String mName; public String mDescription; public String mUsername; public int
public class RecipeSmallReturnType
{
public int mId;
public String mName;
public String mDescription;
public String mUsername;
public int mDifficulty;
public int mServeCount;
public int mPreparationTime;
public float mTotalRating;
public int mNumOfVotes;
public int mOwnerId;
public int mUserRating;
public int mNumOfViews;
public String mReleaseDate;
}
当我在本地pc上使用webservice(使用new->web service等)时,我会得到一个填充有数据的这种类型的数组
但是。
当我发布它时,我会得到一个这种类型的数组-但其中没有数据
有什么想法吗?
也许我需要加一些罐子?
有什么问题吗
我被困在这上面差不多一个星期了
求求你,我需要帮助
我还在Android中实现了返回类型:
public class RecipeSmallReturnType implements KvmSerializable
{
public int mId;
public String mName;
public String mDescription;
public String mUsername;
public int mDifficulty;
public int mServeCount;
public int mPreparationTime;
public float mTotalRating;
public int mNumOfVotes;
public int mOwnerId;
public int mUserRating;
public int mNumOfViews;
public String mReleaseDate;
public Object getProperty( int param )
{
switch( param )
{
case 0: return new Integer( mId );
case 1: return mName;
case 2: return mDescription;
case 3: return mUsername;
case 4: return new Integer( mDifficulty );
case 5: return new Integer( mServeCount );
case 6: return new Integer( mPreparationTime );
case 7: return new Float( mTotalRating );
case 8: return new Integer( mNumOfVotes );
case 9: return new Integer( mOwnerId );
case 10: return new Integer( mUserRating );
case 11: return new Integer( mNumOfViews );
case 12: return mReleaseDate;
default: return null;
}
}
public int getPropertyCount()
{
return 13;
}
public void getPropertyInfo( int param, Hashtable arg1, PropertyInfo arg2)
{
switch( param )
{
case 0:
arg2.type = PropertyInfo.INTEGER_CLASS;
arg2.name = "mId";
break;
case 1:
arg2.type = PropertyInfo.STRING_CLASS;
arg2.name = "mName";
break;
case 2:
arg2.type = PropertyInfo.STRING_CLASS;
arg2.name = "mDescription";
break;
case 3:
arg2.type = PropertyInfo.STRING_CLASS;
arg2.name = "mUsername";
break;
case 4:
arg2.type = PropertyInfo.INTEGER_CLASS;
arg2.name = "mDifficulty";
break;
case 5:
arg2.type = PropertyInfo.INTEGER_CLASS;
arg2.name = "mServeCount";
break;
case 6:
arg2.type = PropertyInfo.INTEGER_CLASS;
arg2.name = "mPreparationTime";
break;
case 7:
arg2.type = Float.class;
arg2.name = "mTotalRating";
break;
case 8:
arg2.type = PropertyInfo.INTEGER_CLASS;
arg2.name = "mNumOfVotes";
break;
case 9:
arg2.type = PropertyInfo.INTEGER_CLASS;
arg2.name = "mOwnerId";
break;
case 10:
arg2.type = PropertyInfo.INTEGER_CLASS;
arg2.name = "mUserRating";
break;
case 11:
arg2.type = PropertyInfo.INTEGER_CLASS;
arg2.name = "mNumOfViews";
break;
case 12:
arg2.type = PropertyInfo.STRING_CLASS;
arg2.name = "mReleaseDate";
break;
default: break;
}
}
public void setProperty( int param, Object obj )
{
switch( param )
{
case 0: mId = (Integer)obj; break;
case 1: mName = (String)obj; break;
case 2: mDescription = (String)obj; break;
case 3: mUsername = (String)obj; break;
case 4: mDifficulty = (Integer)obj; break;
case 5: mServeCount = (Integer)obj; break;
case 6: mPreparationTime = (Integer)obj; break;
case 7: mTotalRating = (Float)obj; break;
case 8: mNumOfVotes = (Integer)obj; break;
case 9: mOwnerId = (Integer)obj; break;
case 10: mUserRating = (Integer)obj; break;
case 11: mNumOfViews = (Integer)obj; break;
case 12: mReleaseDate = (String)obj; break;
default: return;
}
}
}
但我得到的是:
searchRecipesNewResponse{return=RecipeSmallReturnType{}; return=RecipeSmallReturnType{}; return=RecipeSmallReturnType{}; return=RecipeSmallReturnType{}; return=RecipeSmallReturnType{}; }
而不是填充数据(当webservice不在主机上,而是在loacl PC上时,我会获取数据)
Yoav在RecipeSmallReturnType中实现KSerializable类。在webservice或android中实现它?KSerializable或kvmserlizable-用于返回类型。为什么它可以在本地Web服务上工作,而不能在主机上工作?好的,它的KvmSerializable,并在android应用程序中实现它,在类中使用返回类型,并对KvmSerialization的实现细节进行一点搜索