views:

12

answers:

1

This is my webservice code which performs constructs xml file and stores to particular destination ,Is this the correct way to store the resultant xml file ,or please let me know if their are any alternate procedure to do so. [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [System.Web.Script.Services.ScriptService] public class JsonWebService : System.Web.Services.WebService {

XmlDocument xmlDoc = new XmlDocument();

public string keyword; public JsonWebService () {

    //Uncomment the following line if using designed components 
    //InitializeComponent(); 
}

[WebMethod] [ScriptMethod(ResponseFormat = ResponseFormat.Json)] public bool GetList(string keyword1, string streetname, string lat, string lng, string radius) {

  XmlDocument xmlDoc=  CreateXML( keyword1,streetname,lat,lng,radius);
    //save file to application folder which will be refferd by client application
  xmlDoc.Save(@"C:\Documents and Settings\Desktop\block\Block3.xml");
  return true;

}

I am not able to refer that xml file constructed at webservice ,from clientside applicaton this will be my code on clientside ,is this the right way to refer saved xml file function searchLocationsNear() { var searchUrl ="http://localhost:2385/blockseek3-9-2010/Block3.xml"; //reference for xml file stored in application folder GDownloadUrl(searchUrl, function(data) { var xml = GXml.parse(data); var markers = xml.documentElement.getElementsByTagName('marker'); map.clearOverlays(); ......... ......... ........

+1  A: 

I would store the XML file at some configurable location on server - it may involve creating a unique name for the file or subfolder (that will store the file). I will probably use GUID for the purpose and then the service would return this unique name back to the client. Client can either use another handler (such as Download.ashx) to get that file to client side or you can have virtual directory mapped to your location and used that path e.g. [site]\Saved Files[Unique name]\block3.xml where "Saved Files" would be a virtual directory mapped to the location where files being saved.

VinayC