Quantcast
Channel: SCN : Popular Discussions - RESTful Web Services SDK
Viewing all articles
Browse latest Browse all 1088

404 not found when request report

$
0
0

Hi All,

 

I am trying to retrieve the summary of specified report from CR Server 2013 by following the RESTful api guide

http://help.sap.com/businessobject/product_guides/boexir4/en/xi4sp6_cr_restful_ws_en.pdf

 

unfortunately I got fail error "404 not found". Please help me. thanks.

 

My test code is following .

 

            string userName = "administrator";

            string password = "test_123456";

            string auth = "secEnterprise";

            string baseURL = "http://10.50.130.106:6405/biprws/";

            string LogonURI = baseURL + "logon/long";

            string TestReportURL = baseURL + "/infostore/5783/rpt";

 

            string rwsLogonToken;

 

            WebRequest myWebRequest = WebRequest.Create(LogonURI);

            myWebRequest.ContentType = "application/xml";

            myWebRequest.Method = "GET";

            //Returns the response to the request made

            WebResponse myWebResponse = myWebRequest.GetResponse();

            //Creating an instance of StreamReader to read the data stream from the resource

            StreamReader sr = new StreamReader(myWebResponse.GetResponseStream());

            //Reads all the characters from the current position to the end of the stream and store it as string

            string output = sr.ReadToEnd();

            //Initialize a new instance of the XmlDocument class

            XmlDocument doc = new XmlDocument();

            //Loads the document from the specified URI

            doc.LoadXml(output);

            //Returns an XmlNodeList containing a list of all descendant elements

            //that match the specified name i.e. attr

            XmlNodeList nodelist = doc.GetElementsByTagName("attr");

            //  Add the logon parameters to the attribute nodes of the document

            foreach (XmlNode node in nodelist)

            {

                if (node.Attributes["name"].Value == "userName")

                    node.InnerText = userName;

 

 

                if (node.Attributes["name"].Value == "password")

                    node.InnerText = password;

 

 

                if (node.Attributes["name"].Value == "auth")

                    node.InnerText = auth;

            }

 

 

            //Making POST request to /logon/long to receive a logon token

            WebRequest myWebRequest1 = WebRequest.Create(LogonURI);

            myWebRequest1.ContentType = "application/xml";

            myWebRequest1.Method = "POST";

            byte[] reqBodyBytes = System.Text.Encoding.Default.GetBytes(doc.OuterXml);

            Stream reqStream = myWebRequest1.GetRequestStream();

            reqStream.Write(reqBodyBytes, 0, reqBodyBytes.Length);

            reqStream.Close();

            try

            {

                WebResponse myWebResponse1 = myWebRequest1.GetResponse();

                StreamReader sr1 = new StreamReader(myWebResponse1.GetResponseStream());

                rwsLogonToken = myWebResponse1.Headers["X-SAP-LogonToken"].ToString();

                HttpWebRequest myWebRequest2 = (HttpWebRequest)WebRequest.Create(TestReportURL);

                myWebRequest2.Accept = "application/XML";

                myWebRequest2.ContentType = "application/XML";

                myWebRequest2.Headers.Add("X-SAP-LogonToken", rwsLogonToken);

                myWebRequest2.Method = "GET";

                WebResponse myWebResponse2 = myWebRequest2.GetResponse();

                Stream stream = null;

                using (stream = myWebResponse2.GetResponseStream())

                {

                    using (StreamReader reader = new StreamReader(stream))

                    {

                        string returnedContent = reader.ReadToEnd();

                        reader.Close();

                    }

                }

                stream.Close();

            }

            catch (Exception ex)

            {

                string s = ex.Message;

                MessageBox.Show(s);

            }

 

 

But If I change the url to

http://<baseURI>/infostore/<reportID>/

 

It will work fine with it.

The reponse xml is below

 

-<entry xmlns="http://www.w3.org/2005/Atom">
   <author>
   <name>Administrator</name>

</author>

<id>tag:sap.com,2010:bip-rs/ATaEiVC9sZZNqAQ8Jg0UdmE</id>

<title type="text">Crystal_2008_date_adbc</title>
<updated>2013-11-01T09:46:50.313Z</updated>

<linkhref="http://10.50.130.106:6405/biprws/infostore/5783/children" rel="http://www.sap.com/rws/bip#children" title="Children" />

  <content type="application/xml">
  <attrs xmlns="http://www.sap.com/rws/bip">
  <attr name="id" type="int32">5783</attr>

<attr name="cuid" type="string">ATaEiVC9sZZNqAQ8Jg0UdmE</attr>

<attrname="description" type="string" />
<attr name="name" type="string">Crystal_2008_date_adbc</attr>
<attr name="type" type="string">CrystalReport</attr>

</attrs>

</content>

<linkhref="http://win-d48o3td93i4:6405/BOE/OpenDocument/opendoc/openDocument.jsp?sIDType=CUID&iDocID=ATaEiVC9sZZNqAQ8Jg0UdmE" rel="http://www.sap.com/rws/bip#opendocument" title="OpenDocument" />

</entry>

 

Could someone please tell me why ? or did I miss something ? thanks.


Viewing all articles
Browse latest Browse all 1088

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>