public static AddFileASRTaskResponse postVoiceRecognitionXML(AddFileASRTaskRequest addFileASRTaskRequest) { string url = UrlConstant.VOICE_RECOGNITION_BASE_URL + "/LeoVideoAPI/service/addFileASRTask"; string data = XMLHelper.XmlSerialize(addFileASRTaskRequest); string responseContent = Http.HttpPostXML(url, data); //return PackageResponse.Response(); return(null); }
private void button1_Click(object sender, EventArgs e) { AddFileASRTaskRequest addFileASRTaskRequest = new AddFileASRTaskRequest(); var uuid = Guid.NewGuid().ToString(); addFileASRTaskRequest.UserID = "DYMAM"; addFileASRTaskRequest.TaskID = uuid; addFileASRTaskRequest.CallBackAddressInfo = "http://192.168.138.65:18801/ASRTaskCallBack"; addFileASRTaskRequest.TaskName = "AudioCmdAnalze_" + uuid; addFileASRTaskRequest.ResultIncludeTime = 0; addFileASRTaskRequest.IncludePunctuation = 0; addFileASRTaskRequest.SourceFile = new SourceFile(); addFileASRTaskRequest.SourceFile.FileType = 1; addFileASRTaskRequest.SourceFile.FileName = "AudioStart.wav"; addFileASRTaskRequest.SourceFile.PathInfo = @"M:\打包公共区"; var str = XMLHelper.XmlSerialize(addFileASRTaskRequest); //AddFileASRTaskResponse response = Voice_Recognition.postVoiceRecognitionXML(addFileASRTaskRequest); //AddFileASRTaskResponse b = null; }
static string buildXML(AddFileASRTaskRequest addFileASRTaskRequest) { System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append("<?xml version=\"1.0\" encoding=\"utf-8\"?>"); sb.Append("<AddFileASRTaskRequest>"); sb.AppendFormat("<UserID>{0}</UserID>", addFileASRTaskRequest.UserID); //sb.Append("</UserID>"); sb.AppendFormat("<TaskID>{0}</TaskID>", addFileASRTaskRequest.TaskID); sb.AppendFormat("<CallBackAddressInfo>{0}</CallBackAddressInfo>", addFileASRTaskRequest.CallBackAddressInfo); sb.AppendFormat("<TaskName>{0}</TaskName>", addFileASRTaskRequest.TaskName); sb.AppendFormat("<Poiority>{0}/Poiority>", addFileASRTaskRequest.Poiority); sb.AppendFormat("<SourceFile>{0}</SourceFile>", addFileASRTaskRequest.SourceFile); sb.AppendFormat("<GenerateSubtitleFile>{0}</GenerateSubtitleFile>", addFileASRTaskRequest.GenerateSubtitleFile); sb.AppendFormat("<ResultIncludeTime>{0}</ResultIncludeTime>", addFileASRTaskRequest.ResultIncludeTime); sb.AppendFormat("<IncludePunctuation>{0}</IncludePunctuation>", addFileASRTaskRequest.IncludePunctuation); sb.AppendFormat("<Language>{0}</Language>", addFileASRTaskRequest.Language); sb.AppendFormat("<ExtendAttribute>{0}</ExtendAttribute>", addFileASRTaskRequest.ExtendAttribute); sb.Append("</AddFileASRTaskRequest>"); return(sb.ToString()); }