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

Server was unable to process request. --> The root element is missing

2,128 views
Skip to first unread message

Echo

unread,
Mar 11, 2004, 6:56:06 PM3/11/04
to
Hi All:

I have a webpage which is using JavaScript calling webservice from client side for getting UnitPrice from database when product configuration is changed by the user. Sometimes i was getting the error say 'Server was unable to process request. --> The root element is missing.'

Does somebody can help me out? Your help is greate appreciate.

I could not found any solution for this error by searching through the internet.

My page got this error is : http://www.builddirect.com/ProductDisplay_680_6950_0.aspx


Regards


Ping

Derek Harmon

unread,
Mar 11, 2004, 11:50:29 PM3/11/04
to
"Echo" <anon...@discussions.microsoft.com> wrote in message news:0B8E42B1-E481-47F5...@microsoft.com...

> I have a webpage which is using JavaScript calling webservice from client side for getting
> UnitPrice from database when product configuration is changed by the user. Sometimes i
> was getting the error say 'Server was unable to process request. --> The root element is
> missing.'

Usually this error message appears because the stream on which the HTTP
request carrying the SOAP envelope has been read more than once.

For instance, take a hypothetical SOAP envelope carried in an HTTP
POST body,

<Envelope>
<Head/>
<Body/>
</Envelope>

Before any processing is done on this SOAP envelope, the NetworkStream
is positioned immediately before the <Envelope> root element.

*-><Envelope>
<Head/>
<Body/>
</Envelope>

Let's say some custom logic reads the SOAP envelope from the NetworkStream,
this moves the stream position to the end of the stream.

<Envelope>
<Head/>
<Body/>
</Envelope>
<-*

Now, the Framework attempts to read the SOAP envelope from the NetworkStream.
It reports "Missing Root Element" because it sees absolutely nothing at the end of
the stream. A NetworkStream is forward-only, read-once, and it is not seekable so
there is no way to rewind its Position once it has been exhausted.

If you need to read the SOAP envelope more than once, then the first read
must be to copy the NetworkStream into a MemoryStream.

One concrete example, is you will receive this error if you override the protected
GetWebRequest (or GetWebResponse) of the SoapHttpClientProtocol proxy
and try to read the NetworkStream associated with it (that's a no-no).

Without a look at the applicable code, I can't say exactly what is wrong, but the
behavior to look for is reading the SOAP from the network stream more than
once.


Derek Harmon


0 new messages