web method receiving xml message not accepted in a string

Hello Experts
I have a webservice method that is receiving a input, the input is a xml message.  The xml fails because Im reading it as a string variable.  How can I read this in? The code is in C#

XML MESSAGE Coming to my webserver is:
<Mymessage><carready>True</carready></Mymessage>
<Mymessage><boatready>True</boatready></Mymessage>

Thanks in advance

 [WebMethod]
        public String StartDischarging(String XMLMESSAGE)
        {

Open in new window

densontechAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Carl TawnSystems and Integration DeveloperCommented:
What specifically do you mean by "the XML fails"?  Do you mean you are trying to parse it into an XmlDocument or XDocument object?

If that's the case then it will fail because, the XML snippet you posted, isn't valid XML as there is no root element.

We'd need to some more of the code you are using the parse the string to be any more specific.
ste5anSenior DeveloperCommented:
Can you please rephrase your question?

Basically you have two possibilites from the declaration view point of your method:

[WebMethod]
public String StartDischarging(String xmlMessage) { }

[WebMethod]
public String StartDischarging(XmlDocument xmlMessage) { }

Open in new window


The second should accept a XML.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Bob LearnedCommented:
It looks like the XML does not have a root element.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.