在我的 WCF 服务中,我有带有“int”参数的方法:
[OperationContract]
PublishResult PublishEnrollmentProfile(
string siteName, int methodId,...
);
当我创建对此 WCF 服务的 WebService 引用时,生成了以下签名:
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("...",
RequestNamespace="...", ResponseNamespace="...",
Use=System.Web.Services.Description.SoapBindingUse.Literal,
ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
[return: System.Xml.Serialization.XmlElementAttribute(IsNullable=true)]
public PublishResult PublishEnrollmentProfile(
[System.Xml.Serialization.XmlElementAttribute(IsNullable=true)]
string siteName,
int methodId,
[System.Xml.Serialization.XmlIgnoreAttribute()]
bool methodIdSpecified, ...)
{
object[] results = this.Invoke("PublishEnrollmentProfile", new object[] {
siteName,
deployServerName,
methodId,
methodIdSpecified,
deviceClass,
deviceName,
registrationCode});
return ((PublishResult)(results[0]));
}
您可以看到,我得到了 2 个整数参数,而不是一个整数参数:整数(用于值)和布尔值(用于标记 '如果指定了值)。
这个可以吗?为什么我需要第二个参数(bool)?
非常感谢!