I want to send back entire request which come previously as a response.

var id=sv.GetOrCreate(x => x.Request.JSONRequest).requestId;

sv.Contexts.Server.Add(id,sv.Request.ToJson());
sv.Response.SetFromJson(sv.Contexts.Server[id].ToString());
var s=(string)sv.Contexts.Server[id];
sv.MessageLogger.Warn(s.GetType());
// HttpContent httpContent = new StringContent(s);
sv.MessageLogger.Warn("req"+sv.Request.ToJson());
sv.MessageLogger.Warn(sv.Contexts.Server[id].ToString());

}

Any Issue with this code? Getting Error
Internal server error\nC# rule Scripted Rule 1 execution failed on line 294 with error InvalidOperationException: Failed to set value on 'UriPath' on path 'Proxied [response], [path: ]'\n at HP.SV.Runtime.Simulation.DataSimulator.CSharp.DotNetServiceOperationRuleNetRuleExecutor.Execute(IServiceOperationScriptedRule scriptedRule, IScriptObject request, IScriptObject response, IAdditionalPropertiesObject additionalProperties, IScriptServiceCallActivity[] serviceCallActivities, IScriptContext context, IScriptObject environment, IScriptObject serviceInfo, IDictionary`2 requestMetadata) in Y:\SV5.4.0.2710-S-c0608d23\net\Runtime\Simulation\DataSimulatorCSharp\DotNetServiceOperationRuleNetRuleExecutor.cs:line 203

Parents
  • Verified Answer

    FromJSON() should be executed on the same node as was previously executed ToJSON() otherwise structure might not match and you'll get errors. In your case it cannot find "UriPath" on the response node as it is present only in the request.

    If the message structure is the same below certain level, you can try to copy just that part. Or you can try to switch to Binary/HTTP, which is unstructured.

Reply
  • Verified Answer

    FromJSON() should be executed on the same node as was previously executed ToJSON() otherwise structure might not match and you'll get errors. In your case it cannot find "UriPath" on the response node as it is present only in the request.

    If the message structure is the same below certain level, you can try to copy just that part. Or you can try to switch to Binary/HTTP, which is unstructured.

Children