Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Parse Error, no assembly associated with Xml key.

1,384 views
Skip to first unread message

yoyo yoyo

unread,
Sep 29, 2009, 12:47:31 PM9/29/09
to
In our scenario, MQ Broker calls C#.Net Webservice void method which
takes xml string. And inside the webservice method we are trying to
deserialize SOAP message into XML using soapformatter and we are
getting Parse Error, no assembly associated with Xml key.

On the MQ Broker SOAP payload as response configured as
SOAPAction:http://mydomain/abc/webservicemethod Content-Type:text/xml.


Any ideas, help appreciated.

Peter Duniho

unread,
Sep 29, 2009, 1:12:04 PM9/29/09
to

Either your XML is getting corrupted or you have failed to include the
assembly that defines the type(s) being serialized in the project trying
to deserialize the data.

If I had to guess (and lacking a concise-but-complete code example from
you, I do), I'd guess it's the latter.

If you want a better answer, you need to post a concise-but-complete code
example that reliably demonstrates the problem.

Pete

yoyo yoyo

unread,
Sep 29, 2009, 3:37:20 PM9/29/09
to
Thanks Peter the for the reply.


Here is an example of a SOAP message as an actual XML document:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<soap:Header>
<h:from xmlns:h="http://www.ets-software.com/
Header">test...@mydomain.com</h:from>
</soap:Header>
<soap:Body>
<w:GetMainIdentity xmlns:w="http://www.ets-software.com/Authors/">
<w:nickname>XSLT-Author</w:nickname>
</w:GetMainIdentity>
</soap:Body>
</soap:Envelope>


I stored the above soap message into file named DataFile.soap, used
the following C# scriptlet


XmlDocument doc = new XmlDocument();
FileStream fs = new FileStream(@"c:\DataFile.soap",
FileMode.Open);
try
{
SoapFormatter formatter = new SoapFormatter();
doc = (XmlDocument)formatter.Deserialize(fs);
}


Here I am experiencing Parse Error, no assembly associated with Xml
key w GetMainIdentity. How can I achieve assembly that define(s) the
type being serialized?

Peter Duniho

unread,
Sep 29, 2009, 7:29:36 PM9/29/09
to
On Tue, 29 Sep 2009 12:37:20 -0700, yoyo yoyo <yoy...@gmail.com> wrote:

> [...]


> try
> {
> SoapFormatter formatter = new SoapFormatter();
> doc = (XmlDocument)formatter.Deserialize(fs);
> }
>
>
> Here I am experiencing Parse Error, no assembly associated with Xml
> key w GetMainIdentity. How can I achieve assembly that define(s) the
> type being serialized?

Have your project reference an assembly that does provide the association
with "GetMainIdentity".

If the SOAP message isn't being generated by such an assembly in the first
place, you may find it difficult or impossible to accomplish that. In
that case, the answer is that you simply cannot use the
SoapFormatter.Deserializer() method with this data.

Pete

yoyo yoyo

unread,
Sep 30, 2009, 9:43:07 AM9/30/09
to
FileStream fs = new FileStream(@"c:\DataFile.soap",
FileMode.Open);
try
{
XmlSerializer ser = new XmlSerializer(typeof
(XmlDocument));
idoc = (XmlDocument)ser.Deserialize(fs);
}


Basically MQ Broker sending XML stream in SOAP, I tried using
XmlSerializer as mentioned above, it is displaying the content as it
is, not stripping the Namespaces. Thats why I tried SOAPFormatter
class, its not useful either, do you know what to use in my scenario?

Thanks in advance.

Peter Duniho

unread,
Sep 30, 2009, 1:26:56 PM9/30/09
to

No. I'm not familiar with "MQ Broker", nor have you provided a

concise-but-complete code example that reliably demonstrates the problem.

You could hope for someone else to figure out exactly what your scenario
is, but given the lack of alternate answers provided so far, I suspect
we're all in the same boat: we don't really fully comprehend the source of
the data or why you'd expect the XmlSerializer.Deserializer() method to
successfully deserialize the data.

The lack of knowing the specific technologies is often not a major
impediment, but only when the person asking the question is able to
provide enough information to fill in those details. Usually that entails
the questioner providing a concise-but-complete code example that reliably
demonstrates the problem, so that there are no ambiguities at all about
the question.

Pete

Family Tree Mike

unread,
Sep 30, 2009, 5:30:11 PM9/30/09
to

The Soap document can be treated as an xml document. Load that into an
XmlDocument object, then find the element <soap:Body>. That element
contains the text for the document you are trying to get, I believe. I
don't think you deserialize anything to get an XmlDocument. They are
just passing the xml as a string.

static void Main(string[] args)
{


XmlDocument doc = new XmlDocument();

doc.Load("XMLFile1.xml");
XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);
nsmgr.AddNamespace("soap",
"http://schemas.xmlsoap.org/soap/envelope/");
XmlElement e = (XmlElement)
doc.DocumentElement.SelectSingleNode("soap:Body", nsmgr);
Console.WriteLine(e.InnerXml);
XmlDocument docInner = new XmlDocument();
docInner.LoadXml(e.InnerXml);
Console.WriteLine("Done...");
Console.ReadLine();
}


--
Mike

0 new messages