Вот стоит такая задача — необходимо написать препроцессор.
Сделать то я это сделал, но BizTalk выдает такую ошибку
Details:
------------------------------
[0x1439] No parser component recognizes the data. This might be caused by an interchange specification that is missing or not valid, or it might be caused by data that is not valid. Verify that both the interchange specification (if one is specified) and the data match.
[0x1730] Suspended Queue ID: "{64381FCA-C4B7-4272-A0CB-7F9B2A8FC8FB}"
[0x0147] The business document that was passed in is not in a recognized format and could not be parsed or decrypted.
Начинаю разбираться — оказывается от не может понять что ему дают.
Делаю следующее
1.Помещаю в очередь простое текстовое сообщение
2.В препроцессоре пишу всего одну строку
VariantCopy(vDataOut, &vDataIn);
BizTalk все разбирает и преобразует. Вывожу тип данных — VT_BSTR
Теперь в препроцессоре делаю считывание из файла. Создаю и инциализирую переменную VARIANT с типом VT_BSTR и помещаю в него считанные данные. Копирую данные в vDataOut. Делаю выгрузку из переменной в файл — там то что надо.
Отдаю BizTalk'у. Выдает ошибку описанную выше. Смотрю в отложенной очереди текст сообщения — от абсолютно нормальный. Скидываю его в файл и провожу проверку валидности — все ОК. В связи с этим вопрос — ЧТО ЕМУ НАДО???
PS. Считываю из файла в массив char, затем делаю StringToWideChar
... << RSDN@Home 1.1.3 stable >>
Здравствуйте, SEDEGOFF, Вы писали:
скип
Привет.Такая ошибка обычно, когда в в документе не хватает какого-либо узла документа. Т.е. несоответствие схеме. Сегодня как раз такую ошибку получил. BizTalk 2002?
Я писал на C#, код такой и работает:
void IBTSCustomProcess.Execute(object DataIn, // Contains the input data read by the receive function. For data read from a message queue, the data can be either an array or a string. If the data is read from a File receive function, this parameter contains the file path.
int CodePageIn, // Contains the code page of the input data. The code page indicates the character set and keyboard layout used on a computer
bool isFilePath, // Contains a value that indicates whether or not the DataIn parameter contains a file path
ref object CodePageOut, // Contains the code page of the output data. The code page indicates the character set and keyboard layout used on a computer
ref object DataOut // Contains the output data. For File receive functions, this will be a string. The data in this parameter is sent to BizTalk Server for processing
)
{
//XmlDocument xmlDoc = new XmlDocument();
CodePageOut = CodePageIn;
FileStream fs;
try
{
if(isFilePath)
{
LogWriter log_ = new LogWriter();
//bool bLoaded;
string strFile = "",line;
log_.WriteLog("File name is : " + Convert.ToString(DataIn));
// -->
if(File.Exists(Convert.ToString(DataIn)))
log_.WriteLog("prepro : file exists " + Convert.ToString(DataIn));
// <--
fs = new FileStream((string)DataIn, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
log_.WriteLog("FileStream created for file " + Convert.ToString(DataIn));
StreamReader sr = new StreamReader(fs);//File.OpenText(Convert.ToString(DataIn));//new StreamReader(Convert.ToString(DataIn));
log_.WriteLog("StreamReader is created for file " + Convert.ToString(DataIn));
while((line = sr.ReadLine()) != null)
{
if(strFile == "")
strFile = line;
// 2004.04.05 TTVK Uzd:blogai formuojamas failas is PrePro -->
else if(line == "")
strFile = strFile;
// 2004.04.05 TTVK Uzd:blogai formuojamas failas is PrePro <--
else
strFile = strFile + "~" + line;
}
log_.WriteLog("StreamReader is done ");
sr.Close();
log_.WriteLog("StreamReader is closed ");
DataOut = TXT_to_XML(strFile);
string tmpstr = Convert.ToString(DataOut);
log_.WriteLog(tmpstr.Substring(0,50));
//string str_mr = TXT_to_XML(strFile);
//DataOut = System.Runtime.InteropServices.Marshal.StringToBSTR(str_mr);//TXT_to_XML(strFile);
fs.Close();
//LogWriter log = new LogWriter();
//log.WriteLog("Custom PreProcessor.Net");
}
}
catch(Exception ex)
{
//Console.WriteLine(ex.Message);
LogWriter logger = new LogWriter();
logger.WriteLog("MGB2BPreProcessor_net " + ex.Message);
}
finally
{
}
}
Ох как это давно было. Спасибо за ответ, но я совсем уже разобрался. Конкретно в моем случае была ошибка в том, что я в неправильной кодировке отдавал данные.
... << RSDN@Home 1.1.3 stable >>