我正在尝试使用BMC Remedy 7.6.04中创建Remedy事件的Web服务。有几个参数是从中选择要发送回Web服务的值的数组,例如Status。当我选择StatusType,UrgencyType和ImpactType时,我收到以下错误.Here是状态类型的错误:
无法隐式转换类型' Client.RemedyInc.StatusType'至 ' Client.RemedyInc.StatusType []'
状态在reference.cs中枚举如下:
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.233")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:HPD_IncidentInterface_Create_WS")]
public enum StatusType {
/// <remarks/>
New,
/// <remarks/>
Assigned,
/// <remarks/>
[System.Xml.Serialization.XmlEnumAttribute("In Progress")]
InProgress,
/// <remarks/>
Pending,
/// <remarks/>
Resolved,
/// <remarks/>
Closed,
/// <remarks/>
Cancelled,
}
和
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="urn:HPD_IncidentInterface_Create_WS", Order=32)]
[System.Xml.Serialization.XmlElementAttribute("Status")]
public StatusType[] Status;
以下是我的代码示例:
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();
RemTicket.AuthenticationInfo = AuthInfo;
RemTicket.Summary = "This is a web service Test";
RemTicket.Last_Name = "LName";
RemTicket.First_Name = "FName";
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";
}
非常感谢任何帮助。 肯
答案 0 :(得分:0)
你的Status
应该被声明为数组吗?这似乎是例外情况,因为您无法将StatusType
分配到StatusType[]
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="urn:HPD_IncidentInterface_Create_WS", Order=32)]
[System.Xml.Serialization.XmlElementAttribute("Status")]
public StatusType Status; // Declared as StatusType instead of StatusType[]
如果声明是正确的,那么您可能只需要调用代码将New值指定为数组。
RemTicket.Status = new StatusType[] { RemedyInc.StatusType.New };