hi
i tried getting the login response through .net and i achieved it as well and now i have to get the response from getxmlmetadata
when i implement the logic i ended up with the 403 forbidden error and i need help in getting the response from getxmlmetadata without losing the login response and i need this in .net
Thanks in advance
Abinav Shankar
Hi
I used the below code(.net) to get the response from both login services and xml.metadata.get i managed to get the login response but I am encountering with 403 forbidden error pl correct me where i went
wrong
protected
{voidPage_Load(objectsender, EventArgse)stringRequestXML = "<Request>"+"<username>admin</username>"+"<password>admin</password></Request>";stringServerURL = "http://localhost:8080/geonetwork/srv/en/xml.user.login";stringResponseXML = postRequest(RequestXML, ServerURL);//= ResponseXML.ToString();Label1.Text = ResponseXML1.ToString();
}
{stringServerURL1 = "http://localhost:8080/geonetwork/srv/en/xml.metadata.get";stringRequestXML1 = "<Request>"+"<uuid>5915639e-777c-4339-93ad-c4037f2eeb77</uuid>"+"</Request>";stringResponseXML1 = postRequest(RequestXML1, ServerURL1);privatestringpostRequest(StringRequestXML, stringServerURL)inttimeout = 90000;intconnectionLimit = 10;stringresponseXML = string.Empty;try{
webRequest.Timeout = timeout;
webRequest.KeepAlive =
webRequest.ServicePoint.ConnectionLimit = connectionLimit;
webRequest.Method =
webRequest.ContentType =
strm.Write(byteArray, 0, byteArray.Length);
strm.Close();HttpWebRequestwebRequest = (HttpWebRequest)WebRequest.Create(ServerURL);true;"POST";"text/xml";byte byteArray = Encoding.UTF8.GetBytes(RequestXML);Streamstrm = webRequest.GetRequestStream();responseXML = reader.ReadToEnd();
reader.Close();
webResponse.Close();
}
{
}
}
Thanks
Abinav Shankar
HttpWebResponsewebResponse =(HttpWebResponse)webRequest.GetResponse();Encodingenc = Encoding.GetEncoding("utf-8");StreamReaderreader = newStreamReader(webResponse.GetResponseStream(), enc);catch(Exceptionex)throw(ex);returnresponseXML;