I am implementing webservices API. I am sending request in xml form in which some credentials coming from database and on the response of my request I am getting xml form feedback. I am using SOMee server for testing when i am running my program i am getting an error "URI formats are not supported". Please help me to resolve my query. For referenece i am pasting my code.
if (oDataSet.Tables[0].Rows.Count > 0)
{
XmlWriter oXmlWriter = XmlWriter.Create("http://impertosolutions.somee.com//MobileAPI_XML//MobileBookingRequest.xml");
oXmlWriter.WriteStartDocument();
oXmlWriter.WriteStartElement("ReprintRequest");
oXmlWriter.WriteStartElement("UserTrackID");
oXmlWriter.WriteString(oDataSet.Tables[0].Rows[0]["OrderId"].ToString());
oXmlWriter.WriteEndElement();
oXmlWriter.WriteEndDocument();
oXmlWriter.Close();
XmlDocument oXmlDocument= new XmlDocument();
oXmlDocument.Load("http://impertosolutions.somee.com//MobileAPI_XML//MobileBookingRequest.xml");
StringWriter oStringWriter= new StringWriter();
XmlTextWriter oXmlTextWriter= new XmlTextWriter(oStringWriter);
oXmlDocument.WriteTo(oXmlTextWriter);
Response.ContentType="text/xml";
lstrInput = oXmlDocument.OuterXml;
lobjServ.REPRINT(lobjSec, lstrInput, ref lstrOutput, ref lstrError);
}
Loading

Vithal WadjePosted Apr 2, 2015, 1:43 PM
Sunil RawatPosted Apr 5, 2015, 12:39 PM
Sunil RawatPosted Apr 5, 2015, 12:36 PM
Mukesh NayakPosted Apr 2, 2015, 1:46 PM
I think you are trying to write directly on of the server file "http://impertosolutions.somee.com//MobileAPI_XML//MobileBookingRequest.xml", reading and loading any xml file is fine but you can't go ahead and edit and update any xml file in the server which you are doing in the code
XmlWriter oXmlWriter = XmlWriter.Create("http://impertosolutions.somee.com//MobileAPI_XML//MobileBookingRequest.xml");
oXmlWriter.WriteStartDocument();
oXmlWriter.WriteStartElement("ReprintRequest");
oXmlWriter.WriteStartElement("UserTrackID");
oXmlWriter.WriteString("abc");
oXmlWriter.WriteEndElement();
oXmlWriter.WriteEndDocument();
you can use one of the local file in your machine to write and you can use the same to read.Again if your application resides in any server with necessary permission , any file in that server can be accessed and modified by your application.
But here in your case you are trying to update xml file which is up there in server and your application is not running on the same server where this xml file exist.
You can test your code with xml file existing in your local machine like this
string src = @"E:\\Finalization\\DynamicWCF\\try.xml";
XmlWriter oXmlWriter = XmlWriter.Create(src);
oXmlWriter.WriteStartDocument();
oXmlWriter.WriteStartElement("ReprintRequest");
oXmlWriter.WriteStartElement("UserTrackID");
oXmlWriter.WriteString("abc");
oXmlWriter.WriteEndElement();
oXmlWriter.WriteEndDocument();
oXmlWriter.Close();
XmlDocument oXmlDocument = new XmlDocument();
oXmlDocument.Load(src);
StringWriter oStringWriter = new StringWriter();
XmlTextWriter oXmlTextWriter = new XmlTextWriter(oStringWriter);
oXmlDocument.WriteTo(oXmlTextWriter);
Response.ContentType = "text/xml";
lstrInput = oXmlDocument.OuterXml;
lobjServ.REPRINT(lobjSec, lstrInput, ref lstrOutput, ref lstrError);