ConnectivityTest with ASP.NET Core Web API (WCF Proxy vs HttpClient)

11 views
Skip to first unread message

SHANNU

unread,
Sep 8, 2025, 6:52:27 AMSep 8
to HL7v2 Immunization Testing

Hello NIST IZ Team,


I am integrating with the NIST IZ Tool IISService endpoint and running into a difference between using a WCF client proxy and a raw HttpClient SOAP call.


Environment:


WCF Proxy Code (Startup.cs):

             services.AddSingleton(provider =>

            {

                System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12 | System.Net.SecurityProtocolType.Tls13;


                var binding = new CustomBinding(

                                      new TextMessageEncodingBindingElement(MessageVersion.Soap12WSAddressing10, Encoding.UTF8),

                                      new HttpsTransportBindingElement()

                                      {

                                          MaxReceivedMessageSize = 20000000,

                                          AllowCookies = true

                                      });


                var endpoint = new EndpointAddress("https://hl7v2-iz-r1-5-testing.nist.gov/iztool/ws/iisService");

                return new IISServiceClient(binding, endpoint);

            });



Controller Method (using proxy):
            [HttpPost("ConnectivityTest")]
            public ActionResult<ConnectivityTestResponse> ConnectivityTest()
            {
                try
                {
                    var request = new ConnectivityTestRequest { echoBack = "Hello NIST" };
                    System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12 | System.Net.SecurityProtocolType.Tls13;
                    var response = _iisServiceClient.connectivityTest(request);

                    Console.WriteLine($"Response: {response?.@return}");
                    return Ok(response);
                }
                catch (Exception ex)
                {
                    return BadRequest(ex.InnerException != null ? ex.InnerException.Message : ex.Message);
                }
            }

Error Returned:
            System.ServiceModel.EndpointNotFoundException:  'There was no endpoint listening at https://hl7v2-iz-r1-5-testing.nist.gov/iztool/ws/iisService that could accept the message. 
                  This is often caused by an incorrect address or SOAP action.'

BUT

Raw HttpClient SOAP Call (works fine, returns 200):

            [HttpGet]
            public async Task<ActionResult<string>> Get()
            {
                var soapEnvelope = @"<?xml version=""1.0"" encoding=""utf-8""?>
                    <soap:Envelope xmlns:soap=""http://www.w3.org/2003/05/soap-envelope""
                                   xmlns:urn=""urn:cdc:iisb:2011"">
                      <soap:Body>
                        <urn:connectivityTest>
                          <echoBack>Hello NIST</echoBack>
                        </urn:connectivityTest>
                      </soap:Body>
                    </soap:Envelope>";

                using var client = new HttpClient();
                var content = new StringContent(soapEnvelope, Encoding.UTF8, "application/soap+xml");
                var response = await client.PostAsync(
                    "https://hl7v2-iz-r1-5-testing.nist.gov/iztool/ws/iisService", content);

                return Ok(response.IsSuccessStatusCode 
                    ? " Endpoint is reachable." 
                    : " Endpoint returned an error.");
            }

This returns 200 OK, so the endpoint is reachable with a raw SOAP request.


Proxy Definition:

            [ServiceContract(Namespace = "urn:cdc:iisb:2011")]
            public interface IIISService
            {
                [OperationContract(Action = "urn:cdc:iisb:2011:connectivityTest", ReplyAction = "*")]
                ConnectivityTestResponse connectivityTest(ConnectivityTestRequest request);

                [OperationContract(Action = "urn:cdc:iisb:2011:submitSingleMessage", ReplyAction = "*")]
                SubmitSingleMessageResponse submitSingleMessage(SubmitSingleMessageRequest request);
            }

            public class IISServiceClient : ClientBase<IIISService>, IIISService
            {
                public IISServiceClient(Binding binding, EndpointAddress address) : base(binding, address) { }

                public ConnectivityTestResponse connectivityTest(ConnectivityTestRequest request) =>
                    Channel.connectivityTest(request);

                public SubmitSingleMessageResponse submitSingleMessage(SubmitSingleMessageRequest request) =>
                    Channel.submitSingleMessage(request);
            }

            [MessageContract]
            public class ConnectivityTestRequest
            {
                [MessageBodyMember(Order = 0)]
                public string echoBack { get; set; }
            }

            [MessageContract]
            public class ConnectivityTestResponse
            {
                [MessageBodyMember(Order = 0)]
                public string @return { get; set; }
            }

 Is there any possible change needed to make my current CustomBinding configuration appropriate for communicating with the IISService endpoint?

Thank you,
[Shanmukh]


Crouzier, Nicolas (Fed)

unread,
Sep 8, 2025, 9:36:28 AMSep 8
to SHANNU, HL7v2 Immunization Testing
Hi Shanmukh, 
I’m not too familiar with WCF but from what I could find out it seems you are using WS-Addressing which is not supported by the NIST endpoint.
Try using SOAP without WS-Addressing. Something like that I think.
new TextMessageEncodingBindingElement(MessageVersion.CreateVersion(EnvelopeVersion.Soap12, AddressingVersion.None), Encoding.UTF8),


Let me know if that works.



--
You received this message because you are subscribed to the Google Groups "HL7v2 Immunization Testing" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hl7v2-immunization-...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/hl7v2-immunization-testing/7aad915d-c5dc-433e-9947-dcc0af6cb668n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages