When data travel from the device to the web service:
Web Service:
[WebMethod]
public bool SubmitScores(XmlDocument scores)
{
//... do some validation or whatnot
scores.Save(Server.MapPath("Scores"));
return true;
}
Device:
private void SubmitScores()
{
XmlDocument scores = new XmlDocument();
scores.Load(myAppPath + \\scores.xml);
MyWebService svc = new MyWebService();
svc.SubmitScores(scores);
}
When data travel from the web service to the device:
Web Service:
[WebMethod]
public XmlDocument GetHighScores()
{
XmlDocument scores = new XmlDocument();
scores.Load(Server.MapPath("Scores"));
return scores;
}
Device:
private XmlDocument GetHighScores()
{
MyWebService svc = new MyWebService();
return svc.GetHighScores();
}
--
Alex Feinman
---
Visit
http://www.opennetcf.org
Mr. Feinman,
I want make this;
For instance I have a on web service function A(File myFile). I want to
send
the file abc.xml to A function and want to read the content of abc.xml
from
inside of A function with XmlTextReader(File). How can I do this?
Kind Regards,
I have changed some part of code as;
PacSimService.PacSimScoringWebService myService = new
PacSim.PacSimService.PacSimScoringWebService();
XmlTextReader myR = new XmlTextReader(GameForm.gamePath +
"HighScores.xml");
XmlDocument myDoc = new XmlDocument();
myDoc.Load(myR);
//pop up a information page and saved scores
saveScoresInfoString = (myService.SaveAllHighScores(myDoc) + ". These
players have been saved to online high scores list successfully.");
didn't change inside of web service.
I started to get an error like this,
SoapException
System.Web.Services.Protocol
Sercer was unable to read request.
System.InvalidOperationException.
There is an error in XML document (1,246).
The XML declaration is unexpected. Line 1, position 260. at
System.Xml.XmlTextReader
...
How can I solve this? Thanks.
Here you are;
PacSim.exe
XmlException
Application :: Run + 0xf
GameForm :: Main + 0xa
Thanks,
What are the details of the XmlException?
--
Alex Feinman
---
Visit
http://www.opennetcf.org
Thanks Mr. Feinman, but I couldn't achieve the result.
Here is the inside of my Web Service;
[WebMethod]
public string SaveAllHighScores(XmlDocument myXMLScores)
{
//Read highscores from XML
XmlTextReader myReader1 = new XmlTextReader(myXMLScores.Value);
myReader1.WhitespaceHandling = WhitespaceHandling.None;
string savedScorePlayerNames = "";
string curName = "";
string curCountry = "";
int curScore = 0;
int curLevel = 1;
myReader1.ReadStartElement();
while (!myReader1.LocalName.Equals("Players"))
{
myReader1.Read();
while (!myReader1.LocalName.Equals("Player"))
{
string localName = myReader1.LocalName;
myReader1.Read();
string data = myReader1.ReadString();
...
However, I cannot call it from an instance of my web service;
PacSimService.PacSimScoringWebService myService = new
PacSim.PacSimService.PacSimScoringWebService();
XmlDocument myDoc = new XmlDocument();
myDoc.LoadXml(@"\Storage\windows\Start
Menu\PacSim\HighScores.xml");
//pop up a information page and saved scores
saveScoresInfoString = (myService.SaveAllHighScores(myDoc) + ".
These
players have been saved to online high scores list successfully.");
It says XmlException Error.
Kind Regards,
Define a method that accepts XmlDocument and use it to send the
xml
file
up.
XmlDocument can be loaded directly from a file
--
Alex Feinman
---
Visit
http://www.opennetcf.org
Hi,
I want to send an XML file as a parameter to a web service, I
used
FileStream class but couldn't achive a result.
Any help would be appriciated,
Kind Regards,