我有一个使用kso​​ap2的android应用程序。
也是在Tomcat(Axis2)上运行的Web服务

Web服务上有一种返回方法:

    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;
}


在客户端(使用kso​​ap2的android)中,我具有实现KvmSerliazable的相同类

    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;
        }
    }
}


如果运行eclipse中的webservice localy(使用new-> Web service->等),我将按预期方式获得return参数(一个填充数据的数组)。
但是-在Webserice上部署后,我没有得到数据。

searchRecipesNewResponse{return=RecipeSmallReturnType{}; return=RecipeSmallReturnType{}; }


为什么部署后会发生?
如何解决?

最佳答案

您是否在Android应用中使用了正确的网址,并且可以访问该域,例如在手机上的浏览器中?

关于java - WebService复杂类型在部署后返回空,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/8771006/

10-10 21:00