views:

2367

answers:

4

I have a .net web application that has a Flex application embedded within a page. This flex application calls a .net webservice. I can trace the execution proccess through the debugger and all looks great until I get the response:




soap:ReceiverSystem.Web.Services.Protocols.SoapException: Server was unable to process request

. ---> System.Xml.XmlException: Root element is missing.

   at System.Xml.XmlTextReaderImpl.Throw(Exception e)

   at System.Xml.XmlTextReaderImpl.ThrowWithoutLineInfo(String res)

   at System.Xml.XmlTextReaderImpl.ParseDocumentContent()

   at System.Xml.XmlTextReaderImpl.Read()

   at System.Xml.XmlTextReader.Read()

   at System.Web.Services.Protocols.SoapServerProtocol.SoapEnvelopeReader.Read()

   at System.Xml.XmlReader.MoveToContent()

   at System.Web.Services.Protocols.SoapServerProtocol.SoapEnvelopeReader.MoveToContent()

   at System.Web.Services.Protocols.SoapServerProtocolHelper.GetRequestElement()

   at System.Web.Services.Protocols.Soap12ServerProtocolHelper.RouteRequest()

   at System.Web.Services.Protocols.SoapServerProtocol.RouteRequest(SoapServerMessage message)

   at System.Web.Services.Protocols.SoapServerProtocol.Initialize()

   at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest

 request, HttpResponse response, Boolean& abortProcessing)

   --- End of inner exception stack trace ---

The call from flex looks good, the execution through the webservice is good, but this is the response I capture via wireshark, what is going on here?

I have tried several web methods, from "Hello World" to paramatized methods...all comeback with the same response...

I thought it may have something to do with encoding with the "---&gt", but I'm unsure how to control what .net renders as the response.

+1  A: 

It looks like you might be sending a poorly formed XML document to the service. Can you use Fiddler or something like that to get a copy of the actual call that is going to the web service? That would be a huge help in figured out what the issue is.

James Avery
A: 

If the request was malformed, I don't think I would see normal execution through the webservice with the debugger...would I ?

mmattax
A: 

Are you using Flex 3? If so, you can set a breakpoint when the webservice is executed and actually step through the Flex framework as it encodes your request. Look in mx.rpc.soap.SoapEncoder and you'll be able to see exactly what is going to be sent over the wire.

+1  A: 

I recently used a .NET REST interface which I consumed using a Flex app. I got some strange exceptions as well and my issue was that I forgot to include in xmlns (the namespace) in the root element when sending requests. This is a wild guess but I hope it helps.

Brandon