I am trying to figure something out with using this web service through ASP.NET using C#. The problem I am running into is that some report work fine while others, in the same folder, do not. The only error I get is that I am not authorized to use that report.
If I user SoapUI to run the request on one of the unauthorized reports, it works just fine. I see no difference in Oracle between ones that work and ones that don't, nor do any of the consultants the company has for help with Oracle.
This code may be a bit wonky as I have been trying to figure out what is going on.
EndpointAddress endpointAddress = new EndpointAddress(new Uri(System.Configuration.ConfigurationManager.AppSettings["RESTDomain"] ));
OrcExternalReportWSSService.ExternalReportWSSServiceClient wsclient = new OrcExternalReportWSSService.ExternalReportWSSServiceClient(new UsernameTokenOverSslBinding(), endpointAddress);
wsclient.ClientCredentials.UserName.UserName = System.Configuration.ConfigurationManager.AppSettings\["WSUser"\];
wsclient.ClientCredentials.UserName.Password = System.Configuration.ConfigurationManager.AppSettings\["WSPass"\];
OrcExternalReportWSSService.ReportRequest r = new OrcExternalReportWSSService.ReportRequest();
r.reportAbsolutePath = reportpath;
r.attributeFormat = "csv";
r.sizeOfDataChunkDownload = -1;
if(jsonParams != "")
{
Dictionary\<string, string> json = JsonConvert.DeserializeObject\<Dictionary\<string, string>>(jsonParams);
r.parameterNameValues = new OrcExternalReportWSSService.ParamNameValue\[json.Count()\];
int pCount = 0;
foreach (var jj in json)
{
string key = jj.Key;
string keyVal = jj.Value;
OrcExternalReportWSSService.ParamNameValue p = new OrcExternalReportWSSService.ParamNameValue();
p.name = jj.Key.ToString();
//p.dataType = "int";
p.values = new string\[\] { jj.Value.ToString() };
r.parameterNameValues\[pCount\] = p;
pCount += 1;
}
}
OrcExternalReportWSSService.ReportResponse reportResp = wsclient.runReport(r, null);
if (reportResp.reportBytes.Length==0)
{
resp.errors.Add("Report Length = 0");
}
else
{
resp.reportdata = reportResp.reportBytes;
resp.responseOK = true;
}
the other class
public class UsernameTokenOverSslBinding : CustomBinding
{
public override BindingElementCollection CreateBindingElements()
{
BindingElementCollection bindingElements = new BindingElementCollection();
bindingElements.Add(SecurityBindingElement.CreateUserNameOverTransportBindingElement());
MtomMessageEncodingBindingElement messageEncoding = new MtomMessageEncodingBindingElement();
messageEncoding.MessageVersion = MessageVersion.Soap12;
bindingElements.Add(messageEncoding);
HttpsTransportBindingElement transport = new HttpsTransportBindingElement();
transport.MaxReceivedMessageSize = Int32.MaxValue;
transport.MaxBufferSize = Int32.MaxValue;
bindingElements.Add(transport);
return bindingElements.Clone();
}
}