私はweserviceメソッドを持っています、
public string SearchProperties(string pPropertySearch, string pSort)
{
string[] _propSearch = pPropertySearch.Split(',');
string searchType = (_propSearch)[_propSearch.Length - 1];
List<Property> returnResults = new List<Property>();
try
{
PropertySearch _MyPropertySearch = (PropertySearch)JavaScriptConvert.DeserializeObject(pPropertySearch, typeof(PropertySearch));
returnResults = PropertyDALC.SearchPropertyNew(_MyPropertySearch, pSort, searchType, 25);
}
catch (Exception e)
{
}
string output = JavaScriptConvert.SerializeObject(returnResults);
return output;
}
PropertySearch.cs、
[Serializable]
public class PropertySearch
{
private string userId;
private string sessionId;
private string priceMin;
private string priceMax;
public string UserId
{
get { return userId; }
set { userId = value; }
}
public string SessionId
{
get { return sessionId; }
set { sessionId = value; }
}
public string PriceMin
{
get { return priceMin; }
set { priceMin = value; }
}
public string PriceMax
{
get { return priceMax; }
set { priceMax = value; }
}
public string BedsMin
{
get { return bedsMin; }
set { bedsMin = value; }
}
}
文字列「pPropertySearch」を次のように指定しました。
"0000-0000","gghuk","6666","8888"
InVokeボタンをクリックすると、Webサービスが呼び出され、この行の近くに
" PropertySearch _MyPropertySearch = (PropertySearch)JavaScriptConvert.DeserializeObject(pPropertySearch, typeof(PropertySearch));"
それはこの例外を与えています、
"Cannot convert object of type 'System.String' to type 'PropertySearch'"
このコードの何が問題なのですか。私を修正してください。
文字列を間違った形式で渡していますか? 助けてください。Web サービスでのこれらのシリアライゼーション、デシリアライゼーションの概念がわかりません。
どんな助けでも大歓迎です!!