MVC and Consuming Web Services Reference - SOAP RRS feed

  • Question

  • User1391845369 posted

    I have bee working with .NET MVC and C# for about a year now so I am a little green and need of some guidance on a project. 

    So I currently have a .NET C# MVC project and within that project I have created a a Service Reference  to following service NemsisPmWsPort:


    It created proxy reference to all the methods. 

    At this point I am totally in the dark on how to write C# code in MVC to get a handle on the data.

    There is a technical guide posted at this location and it gives the Request  parameters Response:



    The service also supports segmentation of performance measure data (analogous to the “group by” clause in an SQL query). To request the benchmark results to be segmented by a parameter, use the RetrieveBenchmark request with one <segment> element. The following example demonstrates a request for benchmark data for the Trauma-01 measure segmented (or grouped) by Urbanicity:

    The request:

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.nemsis.org/">   
    <ws:benchmark id="Trauma-01">

    The service will return a message that contains segmented benchmark data providing a result for each member of the Urbanicity parameter:

    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
    xmlns:ns2="http://ws.nemsis.org/"> <SOAP-ENV:Header/>
    <ns2:benchmark id="Trauma-01">
    <ns2:data denominatorType="xs:nonNegativeInteger" numeratorType="xs:nonNegativeInteger" records="3149842" states="45">
    <ns2:result records="2449638" segmentMember="P01001">
    <ns2:result records="222938" segmentMember="P01002">
    <ns2:result records="258992" segmentMember="P01003">
    <ns2:result records="71126" segmentMember="P01004">
    <ns2:result records="147148" segmentMember="P01005">

    A request may include zero or more <filter> elements and zero or one <segment> element.

    Friday, August 16, 2019 7:59 PM

All replies

  • User1520731567 posted

    Hi steven0608,

    It created proxy reference to all the methods. 

    Did you created proxy reference by Add Service Reference?

    If so,I test according to your link. Since I don't have permission, I can't completely reproduce your problem. You could refer to my code:

    ServiceReference1.NemsisPmWsPortClient re = new ServiceReference1.NemsisPmWsPortClient();
                re.RetrieveBenchmark(new ServiceReference1.RetrieveBenchmarkRequest() {
                    benchmark = new ServiceReference1.BenchmarkRequest() {
                        filter = new ServiceReference1.Filter[1] {new ServiceReference1.Filter { parameter = "P01001", Value = "201712" } } } }  );

    Best Regards.

    Yuki Tao

    Monday, August 19, 2019 9:10 AM
  • User1391845369 posted

    Yes, I created the proxy reference to all the methods.  Since I am kind of new to C# I was unsure on what to from this point. 

    Wednesday, August 21, 2019 2:54 PM
  • User1391845369 posted

    I believe all this data is public, it should not require any credentials to pull the national data.  I am going to create a new controller and view and test out your code to see where that gets me. 

    Wednesday, August 21, 2019 3:24 PM
  • User1391845369 posted

    Where you getting error

    Name Value Type
    Channel The function evaluation requires all threads to run. NEMSIS.PerformanceMeasures.NemsisPmWsPort.NemsisPmWsPort
    Wednesday, August 21, 2019 4:09 PM
  • User1391845369 posted

    I am still a little lost on what your code does and how you determined what direction you went?  Can you explain your code please?

    Wednesday, August 21, 2019 4:20 PM
  • User1391845369 posted

    Two other questions that involve this same method because I am trying to figure out how you know what syntax and calls to make:

    So how would I make this request using C# and the reference classes and methods and get the correct response back?

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.nemsis.org/">   
    <soapenv:Header/> <soapenv:Body>

    This response should be:

    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">   
    <ns2:ListBenchmarksResponse xmlns:ns2="http://ws.nemsis.org/">
    <ns2:benchmark id="Trauma-01" numeratorType="xs:nonNegativeInteger" denominatorType="xs:nonNegativeInteger">Pain Assessment of Injured Patients</ns2:benchmark>
    <ns2:benchmark id="Seizure-01" numeratorType="xs:nonNegativeInteger" denominatorType="xs:nonNegativeInteger">Blood Glucose Evaluation</ns2:benchmark>
    <ns2:benchmark id="Stroke-01" numeratorType="xs:nonNegativeInteger" denominatorType="xs:nonNegativeInteger">Suspected Stroke Receiving Prehospital Stroke Assessment</ns2:benchmark>

    I would also like to return these values to a view.  How would I go about doing that as well? 

    Wednesday, August 21, 2019 8:57 PM
  • User1391845369 posted

    So after looking at your code and taking stab after stab I came up with this code to grab the "Truama-01" data in my NEMSISmeasuresWSRController.cs

    Now I have to pull the retrieve the response and display then display the <numerator>69523</numerator>
    <denominator>128505</denominator>  into a view.   Some help we be much appreciated. 

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.Mvc;
    using System.Data;
    using NEMSIS.PerformanceMeasures.Models;
    //using NEMSIS.PerformanceMeasures.NemsisPmWsPort;
    namespace NEMSIS.PerformanceMeasures.Controllers
        public class NEMSISmeasuresWSRController : Controller
            // GET: NEMSISmeasuresWSR
            public ActionResult Index()
                using (var client = new NemsisPmWsPort.NemsisPmWsPortClient())
                    var request = new NemsisPmWsPort.RetrieveBenchmarkRequest();
                    request.benchmark = new NemsisPmWsPort.BenchmarkRequest();
                    request.benchmark.id = "Trauma-01";
                    request.benchmark.filter = new NemsisPmWsPort.Filter[] {
                        new NemsisPmWsPort.Filter { parameter = "Urbanicity", Value = "P01001" },
                        new NemsisPmWsPort.Filter { parameter = "CalendarMonth", Value = "201712" }                    
                    var response = client.RetrieveBenchmark(request);
               //Not returning anything yet. I will need to user the RetriveBenchmarkResponse mehtod to retrieve my data response from the service.
                return View("Home");

    Thursday, August 22, 2019 12:14 AM