1
  [OperationContract]
    [FaultContract(typeof(DcCustomFaultMessage))]
    [WebGet(ResponseFormat = WebMessageFormat.Json,
     BodyStyle = WebMessageBodyStyle.Bare,
     UriTemplate = "/GetHistoryData")]
    List<DcHistoryData> GetHistoryData(DcHistoryCriteria criteria);

or

With multiple parameters

    [OperationContract]
    [FaultContract(typeof(DcCustomFaultMessage))]
    [WebGet(ResponseFormat = WebMessageFormat.Json,
     RequestFormat=WebMessageFormat.Json,
     BodyStyle = WebMessageBodyStyle.Bare,
     UriTemplate = "/GetHistoy?ReportingId={ReportingId}&ErrorCode={ErrorCode}&OriginatorCode={OriginatorCode}&PrimaryAssetClass={PrimaryAssetClass}&MessageType={MessageType}&FeedbackType={FeedbackType}&ReportType={ReportType}&RegionCode={RegionCode}&errorstatus={errorstatus}")]
    Stream GetHistoryData(string ReportingId, string ErrorCode, string OriginatorCode, string PrimaryAssetClass, string MessageType, string FeedbackType, int ReportType, string RegionCode, string errorstatus);

Which is a better way to do it? How to call this from AngularJS?

I am able to call this service if the service is defined without parameter with below call from AngularJS:

 $http.get("http://localhost:55467/WCFServiceHost/DFAService.svc/GetHistorydata")
    .success(function (result) {
        alert('got history data');
        $scope.HistoryRejections = $.parseJSON(JSON.parse(result));    
    }).error(function (data, status, headers, config) {
        $scope.attributesData = null;
        $scope.showmessage("error", "error");
    });

I don't know how to do this in case of multiple parameter or datacontract parameter? please help.

1 Answer 1

2

A HTTP GET request can't contain data to be posted to the server. However you can add a query string to the request.

angular.http provides an option for it params You can use:

$http({
       url: yourURL, 
       method: "GET",
       params: {ReportingId: '', ErrorCode: ''}
});

Or if you want to use $http.get():

$http.get(yourURL, {
   params: {ReportingId: '', ErrorCode: ''}
});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.