| Sudhir Darbha 2006-03-25, 11:37 am |
| Tom,
I am passing the same file content to web service which I use for
submitting via "SubmitRequest.exe test.xml". I am not sure if there could be
any encoding issues in the webservice.
Here'e the code I am using in webservice:
=====================================
public string SendData(XmlDocument doc)
{
string response = string.Empty;
IBaseMessage responseMsg = null;
// Address of receive locations where to submit message to
const string submitURI = "submit://submitrequest";
// Create BizTalk message submission object
BizTalkMessaging btm = new BizTalkMessaging();
// Open the file stream
MemoryStream fileStream = new MemoryStream();
doc.Save(fileStream);
try
{
// Submit message and wait for response
// The charset information is empty because it will be determined by XML
disassembler from BOM of file
responseMsg =
btm.SubmitSyncMessage(btm.CreateMessageFromStream(submitURI, null,
fileStream));
// Get an XML from response and print it out in console window
if (null != responseMsg)
{
if ((responseMsg.BodyPart != null) && (responseMsg.BodyPart.Data !=
null))
{
StreamReader sr = new StreamReader(responseMsg.BodyPart.Data);
response = sr.ReadToEnd();
Console.WriteLine("Response message:");
Console.WriteLine(sr.ReadToEnd());
}
}
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
finally
{
// Close the message submission object
btm.Close();
// Close Memory stream
fileStream.Close();
}
return response;
}
========================================
===
Most of the code is copied from the SubmitDirect sample project, except here
the web service takes XmlDoument as a parameter, which I saved to a memory
stream to pass it to the SubmitMessage function.
Thanks,
Sudhir.
"Tomas Restrepo (MVP)" wrote:
> Sudhir,
>
>
> Humm, sounds like the data format you're using when submitting the data from
> ASP.NET is different than the data format you're using from your standalone
> executable, which is causing the disassembler to choke on the message.
>
> Where do you get the message you're posting to BizTalk from in your ASP.NET
> code? It might be something as simple as an encoding problem.
>
>
> --
> Tomas Restrepo
> tomasr@mvps.org
> http://www.winterdom.com/
>
>
>
|