Dev2.Runtime.ServiceModel.Data.WebService.ApplyPath C# (CSharp) 메소드

ApplyPath() 공개 메소드

public ApplyPath ( ) : void
리턴 void
        public void ApplyPath()
        {
            if(String.IsNullOrEmpty(RequestResponse) || String.IsNullOrEmpty(JsonPath))
            {
                return;
            }

            JsonPath = JsonPath.Trim();

            try
            {
                var json = JObject.Parse(RequestResponse);
                var context = new JsonPathContext { ValueSystem = new JsonNetValueSystem() };
                var values = context.SelectNodes(json, JsonPath).Select(node => node.Value);
                var newResponseValue = JsonConvert.SerializeObject(values);

                JsonPathResult = newResponseValue;
            }
            catch(JsonException je)
            {
                Dev2Logger.Log.Error(je);
            }
        }

Usage Example

예제 #1
0
 public static void ExecuteRequest(WebService service, bool throwError, out ErrorResultTO errors, WebExecuteString webExecute)
 {
     var requestHeaders = SetParameters(service.Method.Parameters, service.RequestHeaders);
     var headers = string.IsNullOrEmpty(requestHeaders)
                       ? new string[0]
                       : requestHeaders.Split(new[] { '\n', '\r', ';' }, StringSplitOptions.RemoveEmptyEntries);
     var requestUrl = SetParameters(service.Method.Parameters, service.RequestUrl);
     var requestBody = SetParameters(service.Method.Parameters, service.RequestBody);
     service.RequestResponse = webExecute(service.Source as WebSource, service.RequestMethod, requestUrl, requestBody, throwError, out errors, headers);
     if(!String.IsNullOrEmpty(service.JsonPath))
     {
         service.ApplyPath();
     }
 }
All Usage Examples Of Dev2.Runtime.ServiceModel.Data.WebService::ApplyPath