我有一个名为RemedyInc的Web服务。我试图使用以下c#代码来使用此Web服务:
protected void ToRemedy_Click(object sender, EventArgs e)
{
RemedyInc.AuthenticationInfo AuthInfo = new RemedyInc.AuthenticationInfo();
AuthInfo.userName = "user";
AuthInfo.password = "password";
RemedyInc.HelpDesk_Submit_ServiceRequest RemTicket = new RemedyInc.HelpDesk_Submit_ServiceRequest();
RemedyInc.HelpDesk_Submit_ServiceResponse Response = new RemedyInc.HelpDesk_Submit_ServiceResponse();
RemTicket.AuthenticationInfo = AuthInfo;
RemTicket.Summary = "This is a web service Test";
RemTicket.Last_Name = "Peck";
RemTicket.First_Name = "Kenneth";
RemTicket.Service_Type = RemedyInc.Service_TypeType.UserServiceRequest;
RemTicket.Reported_Source = RemedyInc.Reported_SourceType.SelfService;
RemTicket.Status = RemedyInc.StatusType.New;
RemTicket.Urgency = RemedyInc.UrgencyType.Item4Low;
RemTicket.Impact = RemedyInc.ImpactType.Item4MinorLocalized;
RemTicket.Notes = "This is a web service test";
RemTicket.TemplateID = "AGGAAHHLITMRAAMBGOJWBIN45LBV62";
RemTicket.Action = "CREATE";
}
在我访问RemTicket之前,一切似乎都很好.Status我只是选择了Web服务提供的其中一个选项但是我得到了这个转换错误。
枚举客户端RemedyInc.StatusType
错误: 不能隐式地将类型'Client.RemedyInc.StatusType'转换为'Client.RemedyInc.StatusType []'
Web服务引用如下。
public string HelpDesk_Submit_Service(
Client.RemedyInc.AuthenticationInfo AuthenticationInfo,
string Summary,
string Last_Name,
string First_Name,
System.Nullable<Service_TypeType> Service_Type,
System.Nullable<Reported_SourceType> Reported_Source,
StatusType[] Status,
System.Nullable<UrgencyType>[] Urgency,
System.Nullable<ImpactType>[] Impact,
string Notes,
string TemplateID,
string Action)
HelpDesk_Submit_Service(inValue);
return retVal.Incident_Number;
}
RemTicket.Status是StatusType []
类型 [System.ServiceModel.MessageBodyMemberAttribute(Namespace="urn:HPD_IncidentInterface_Create_WS", Order=32)]
[System.Xml.Serialization.XmlElementAttribute("Status")]
public StatusType[] Status;
如何从Web服务提供的列表中选择“新建”并将其传递给RemTicket.Status?
public enum StatusType {
New,
Assigned,
[System.Xml.Serialization.XmlEnumAttribute("In Progress")]
InProgress,
Pending,
Resolved,
Closed,
Cancelled,
}
这应该很简单,但我似乎无法通过正确的'类型'任何帮助都将不胜感激。
答案 0 :(得分:0)
状态是 StatusType
的数组RemTicket.Status = new RemedyInc.StatusType[] { RemedyInc.StatusType.New };