Hi ,
I need to make a SCA call with Json message and ContentType as text/plain. I tried to change it in show row details. But While calling it is automatically coming as Content-Type: application/json; charset=utf-8. How to overcome this?
Cybersecurity
DevOps Cloud
IT Operations Cloud
If an answer to your question is correct, click on "Verify Answer" under the "More" button. The answer will now appear with a checkmark. Please be sure to always mark answers that resolve your issue as verified. Your fellow Community members will appreciate it! Learn more.
Hi ,
I need to make a SCA call with Json message and ContentType as text/plain. I tried to change it in show row details. But While calling it is automatically coming as Content-Type: application/json; charset=utf-8. How to overcome this?
WebRequest request = WebRequest.Create("##url/"+sv.GetOrCreate(x => x.Request.JSONRequest).id);
// Set the Method property of the request to POST.
request.Method = "POST";
var token= sv.GetOrCreate(x => x.Request.JSONRequest).token;
request.Headers.Add("Authorization", "Bearer " + token);
//request.RequestUri=sv.GetOrCreate(x => x.Request.JSONRequest).id;
string postData = "##JSON##;
byte[] byteArray = Encoding.UTF8.GetBytes(postData);
request.ContentType = "text/plain";
// Set the ContentLength property of the WebRequest.
// Get the request stream.
Stream dataStream = request.GetRequestStream();
// Write the data to the request stream.
dataStream.Write(byteArray, 0, byteArray.Length);
// Close the Stream object.
dataStream.Close();
// Get the response.
WebResponse response = request.GetResponse();
// Display the status.
Console.WriteLine(((HttpWebResponse)response).StatusDescription);
// Get the stream containing content returned by the server.
// The using block ensures the stream is automatically closed.
using (dataStream = response.GetResponseStream())
{
// Open the stream using a StreamReader for easy access.
StreamReader reader = new StreamReader(dataStream);
// Read the content.
string responseFromServer = reader.ReadToEnd();
// Display the content.
Console.WriteLine(responseFromServer);
I tried some code. But getting 401. Could you please provide some sample code? I need to add Authorization header and uri path.
I can't see any issue with the script, but I can't investigate just from the pasted portion of it and the screenshot. I guess the content type may be overridden in a rule with a higher priority, but I would have to see your project to provide any meaningful hints.
Hi Clea,
this is a public SV community where anyone can ask for SV help and anyone can answer. SV R&D is trying to help here publicly on regular basis if time permits for benefit of OP and also benefit of others who hit the same issue. We however cannot provide phone support when asked here. If you are a paying customer, please reach to Micro Focus support and they'll reach to us if needed and then we can jump on the call.
Thanks for understanding.
Hi, I can see you are able to use the Simulation Report. Could you please navigate to Content-Type field there and click the link next to it? You will see which rule generated the value of the field. Please could you verify it's really the one you expected? I hope it's some other rule. Could you please paste a screenshot of that?
I have added screes shorts in below link
You need to switch off sandbox security which is switched off by default in SV Designer, but may be turned on on the Server:
https://admhelp.microfocus.com/sv/en/5.4/Help/Content/UG/t_scripted_rule_Csharp.htm
See at the very end of this page how to configure