自定义类型:类 [英] custom types: classes

查看:96
本文介绍了自定义类型:类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我是网络服务的新手,我在弄清楚如何定义一个自定义对象时遇到了一些麻烦通过网络服务工作。


例如,我在服务器端有以下内容:


公共类令牌

{


私有字符串firstID;


私有字符串secondID;


公共字符串getFirstD (){return firstID; }


公共字符串getSecondID(){return secondID; } $ / $

public void setFirstID(string id){firstID = id; } $ / $

public void setSecondID(string id){secondID = id; }


}


[WebMethod]


public bool GetResellerList2(令牌令牌,字符串languageisocode )


{


返回true;


}

当我在客户端查看对象时,我看不到任何属性

或Token类中定义的方法。我错过了什么?


谢谢,


克里斯

Hi,

I''m new to web services and I''m having some trouble figuring out how to
define a custom object that works through the webservice.

For example, I have the following on the server side:

public class Token
{

private string firstID;

private string secondID;

public string getFirstD() { return firstID; }

public string getSecondID() { return secondID; }

public void setFirstID(string id) { firstID= id; }

public void setSecondID(string id) { secondID= id; }

}

[WebMethod]

public bool GetResellerList2(Token token, string languageisocode)

{

return true;

}
When I view the object on the client side, I can''t see any of the properties
or methods defined in the Token class. What am I missing?

Thanks,

Chris

推荐答案

你好Chris,

如果在ws的asmx文件里面没有使用它没有的自定义类

发布它。检查是否已发布转到您引用ws的

项目的Web引用并按显示所有文件

扩展ws的引用和在那里展开Reference.map它是一个

Reference.cs打开它,如果你的自定义类不在那里

///< remarks /> Web服务类


[System.Diagnostics.DebuggerStepThroughAttribute()]

[System.ComponentModel.DesignerCategoryAttribute(" c ode")]


[System.Web.Services.WebServiceBindingAttribute(Nam e =" LiveUpdateSoap",

Namespace =" http://orama-tech.gr/ Web服务/")]

公共类LiveUpdate:

System.Web.Services.Protocols.SoapHttpClientProtoc ol {


}

///< remarks />


///自定义课程


///< remarks />


[System.Xml.Serialization.XmlTypeAttribute(Namespac e =" http:// l ocalhost / WebServices /")]

公共类DownloadInfo {


}

作为ws类

那么你可以用它做任何事情。您可以在程序中添加Reference.cs



希望帮助。

" Chris" < CH *** @ no-spam.com>在留言中写道

新闻:eN ************* @ TK2MSFTNGP14.phx.gbl ...
Hi Chris,
if inside the asmx file of the ws do not use the custom class it did not
publish it. to check if it is published go to the web reference of the
project that you reference the ws and press "show all files"
expand the reference of the ws and expand the Reference.map in there it is a
Reference.cs open it, if your custom class is not in there
/// <remarks/>Web Service Class

[System.Diagnostics.DebuggerStepThroughAttribute()]

[System.ComponentModel.DesignerCategoryAttribute("c ode")]

[System.Web.Services.WebServiceBindingAttribute(Nam e="LiveUpdateSoap",
Namespace="http://orama-tech.gr/WebServices/")]

public class LiveUpdate :
System.Web.Services.Protocols.SoapHttpClientProtoc ol {

}
/// <remarks/>

///Custom class

/// <remarks/>

[System.Xml.Serialization.XmlTypeAttribute(Namespac e="http://localhost/WebServices/")]

public class DownloadInfo {

}
as the ws class
then you can do anything with it. You can add in the Reference.cs
programmably.
Hope that Helps.
"Chris" <ch***@no-spam.com> wrote in message
news:eN*************@TK2MSFTNGP14.phx.gbl...


我是Web服务的新手,我在确定如何定义通过Web服务工作的自定义对象时遇到了一些麻烦。

例如,我在服务器端有以下内容:

公共类令牌
私有字符串firstID;

私有字符串secondID;

public string getFirstD(){return firstID;公共字符串getSecondID(){return secondID;公共void setFirstID(string id){firstID = id;公共void setSecondID(string id){secondID = id; }


[WebMethod]
公共布尔GetResellerList2(令牌令牌,字符串语言编码)

{

返回true;

}

当我在客户端查看对象时,我看不到任何
属性
或Token类中定义的方法。我错过了什么?

谢谢,

Chris
Hi,

I''m new to web services and I''m having some trouble figuring out how to
define a custom object that works through the webservice.

For example, I have the following on the server side:

public class Token
{

private string firstID;

private string secondID;

public string getFirstD() { return firstID; }

public string getSecondID() { return secondID; }

public void setFirstID(string id) { firstID= id; }

public void setSecondID(string id) { secondID= id; }

}

[WebMethod]

public bool GetResellerList2(Token token, string languageisocode)

{

return true;

}
When I view the object on the client side, I can''t see any of the
properties
or methods defined in the Token class. What am I missing?

Thanks,

Chris



嗨Chris,

如果在ws的asmx文件中没有使用自定义类它没有

发布它。检查是否已发布转到您引用ws的

项目的Web引用并按显示所有文件

扩展ws的引用和在那里展开Reference.map它是一个

Reference.cs打开它,如果你的自定义类不在那里

///< remarks /> Web服务类


[System.Diagnostics.DebuggerStepThroughAttribute()]

[System.ComponentModel.DesignerCategoryAttribute(" c ode")]


[System.Web.Services.WebServiceBindingAttribute(Nam e =" LiveUpdateSoap",

Namespace =" http://orama-tech.gr/ Web服务/")]

公共类LiveUpdate:

System.Web.Services.Protocols.SoapHttpClientProtoc ol {


}

///< remarks />


///自定义课程


///< remarks />


[System.Xml.Serialization.XmlTypeAttribute(Namespac e =" http:// l ocalhost / WebServices /")]

公共类DownloadInfo {


}

作为ws类

那么你可以用它做任何事情。您可以在程序中添加Reference.cs



希望帮助。

" Chris" < CH *** @ no-spam.com>在留言中写道

新闻:eN ************* @ TK2MSFTNGP14.phx.gbl ...
Hi Chris,
if inside the asmx file of the ws do not use the custom class it did not
publish it. to check if it is published go to the web reference of the
project that you reference the ws and press "show all files"
expand the reference of the ws and expand the Reference.map in there it is a
Reference.cs open it, if your custom class is not in there
/// <remarks/>Web Service Class

[System.Diagnostics.DebuggerStepThroughAttribute()]

[System.ComponentModel.DesignerCategoryAttribute("c ode")]

[System.Web.Services.WebServiceBindingAttribute(Nam e="LiveUpdateSoap",
Namespace="http://orama-tech.gr/WebServices/")]

public class LiveUpdate :
System.Web.Services.Protocols.SoapHttpClientProtoc ol {

}
/// <remarks/>

///Custom class

/// <remarks/>

[System.Xml.Serialization.XmlTypeAttribute(Namespac e="http://localhost/WebServices/")]

public class DownloadInfo {

}
as the ws class
then you can do anything with it. You can add in the Reference.cs
programmably.
Hope that Helps.
"Chris" <ch***@no-spam.com> wrote in message
news:eN*************@TK2MSFTNGP14.phx.gbl...


我是Web服务的新手,我在确定如何定义通过Web服务工作的自定义对象时遇到了一些麻烦。

例如,我在服务器端有以下内容:

公共类令牌
私有字符串firstID;

私有字符串secondID;

public string getFirstD(){return firstID;公共字符串getSecondID(){return secondID;公共void setFirstID(string id){firstID = id;公共void setSecondID(string id){secondID = id; }


[WebMethod]
公共布尔GetResellerList2(令牌令牌,字符串语言编码)

{

返回true;

}

当我在客户端查看对象时,我看不到任何
属性
或Token类中定义的方法。我错过了什么?

谢谢,

Chris
Hi,

I''m new to web services and I''m having some trouble figuring out how to
define a custom object that works through the webservice.

For example, I have the following on the server side:

public class Token
{

private string firstID;

private string secondID;

public string getFirstD() { return firstID; }

public string getSecondID() { return secondID; }

public void setFirstID(string id) { firstID= id; }

public void setSecondID(string id) { secondID= id; }

}

[WebMethod]

public bool GetResellerList2(Token token, string languageisocode)

{

return true;

}
When I view the object on the client side, I can''t see any of the
properties
or methods defined in the Token class. What am I missing?

Thanks,

Chris



所以放入Reference.cs如下:

///< remarks />


[System.Xml.Serialization.XmlTypeAttribute(Namespac e =" http://orama-tech.gr/WebServices/")]

公共类令牌

{


私有字符串firstID;


私有字符串secondID;


公共字符串getFirstD();


public string getSecondID();


public void setFirstID(string id);

public void setSecondID(string id);

}

" Chris" < CH *** @ no-spam.com>在留言中写道

新闻:eN ************* @ TK2MSFTNGP14.phx.gbl ...
So put in the Reference.cs the following:
/// <remarks/>

[System.Xml.Serialization.XmlTypeAttribute(Namespac e="http://orama-tech.gr/WebServices/")]

public class Token
{

private string firstID;

private string secondID;

public string getFirstD() ;

public string getSecondID() ;

public void setFirstID(string id) ;
public void setSecondID(string id) ;
}
"Chris" <ch***@no-spam.com> wrote in message
news:eN*************@TK2MSFTNGP14.phx.gbl...


我是Web服务的新手,我在确定如何定义通过Web服务工作的自定义对象时遇到了一些麻烦。

例如,我在服务器端有以下内容:

公共类令牌
私有字符串firstID;

私有字符串secondID;

public string getFirstD(){return firstID;公共字符串getSecondID(){return secondID;公共void setFirstID(string id){firstID = id;公共void setSecondID(string id){secondID = id; }


[WebMethod]
公共布尔GetResellerList2(令牌令牌,字符串语言编码)

{

返回true;

}

当我在客户端查看对象时,我看不到任何
属性
或Token类中定义的方法。我错过了什么?

谢谢,

Chris
Hi,

I''m new to web services and I''m having some trouble figuring out how to
define a custom object that works through the webservice.

For example, I have the following on the server side:

public class Token
{

private string firstID;

private string secondID;

public string getFirstD() { return firstID; }

public string getSecondID() { return secondID; }

public void setFirstID(string id) { firstID= id; }

public void setSecondID(string id) { secondID= id; }

}

[WebMethod]

public bool GetResellerList2(Token token, string languageisocode)

{

return true;

}
When I view the object on the client side, I can''t see any of the
properties
or methods defined in the Token class. What am I missing?

Thanks,

Chris



这篇关于自定义类型:类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆