HL7 Implementasjonsguide

 

Frequently Asked Questions (FAQ)

 

Q: How to generate a clientproxy from wsdl and xsd's (.Net)

Q: I receive the error message: TCP error code 10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 161.4.81.48:8901

Q: I receive the error message: The HTTP service located at http://utvikling-webservice.ihelse.net:8901/DIPSHL7Connector/PatientRegistryService/ is too busy

Q: I receive the error message:  The message with Action 'urn:hl7-org:v3/…' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher.

Q: List over services in the different WSDLs.

Q: How to make a client that sets request and response object.

Q: Will these WSDL schemas be exactly according to the HL7 or will there be changes to this schemas to adapt to your system?

Q:  How to enable tracing and message logging for a WCF service or a WCF client.

Q:  How-to implement WCF Security - Username Tokens via Transport-based Security

 

Q: How to generate a clientproxy from wsdl and xsd's (.Net).

We recommend the following approach to generate the client proxy:
 

  1. Download and unpack the schema collection for the domain.

     
  2. Open Internet Information Services. If this is not installed on your PC, you can install IIS from "Add or remove programs" in your Control Panel..

     
  3. Right-clik on the Standard Web-area and choose New and Virtual directory... (the figure is in norwegian, if problems please contact us).



 

  1. Add an Alias for the virtual directory, for instance PatientRegistry



 

  1. Add the folder for where you want to unzip wsdl and schema files.



 

  1. Add reading rights to the virtual directory, click next and finish.

     
  2. In Internet Information Services, click on the virtual directory you just made. Then you will see a list on all files placed on this directory. Find the WSDL you want to make a client proxy for, right click and choose "Browse...". You should then be opening the WSDL in your internet browser.
     
  3. You may generate the client using svcutil or through Add Service Reference… in Visual Studio (2008 or later).

    Svcutil:
    Run svcutil using the address for the WSDL as parameter.

    Please ignore the single Error message as listed in the figure..

    Rename output.config to app.config and then add both files in your solution( Add existing item…).

    Add service reference:
    Right click on your project in Visual Studio and choose Add Service Reference… Add the address for the WSDL and then Go:

 

The service should now be ready.

 

  1. Prior to testing, you need to add the correct address in the config file. For PatientRegistry.GetDemographics, the config file will be like this:

<client>

  <endpoint

    address="http://utvikling-webservice.ihelse.net:8901/DIPSHL7Connector/PatientRegistryService20/"

    binding="basicHttpBinding"

    bindingConfiguration="PatientRegistryQueryFulfiller_Binding"

    contract="PatientRegistryQueryFulfiller_PortType"

    name="PatientRegistryQueryFulfiller_Binding_PatientRegistryQueryFulfiller_PortType" />

</client>

 Back to the top

Q: I receive the error message: TCP error code 10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 161.4.81.48:8901

The origin of this issue is most likely problems with internal proxysettings in your network. Try setting useDefaultWebProxy to True in the config-file. The proxy settings in Internet Explorer will then be used also by the client. Otherwise, try setting useDefaultWebProxy to False and add the attribute proxyAddress instead.
useDefaultWebProxy="false" proxyAddress="http://10.123.54.10:80">

Back to the top

Q: I receive the error message: The HTTP service located at http://utvikling-webservice.ihelse.net:8901/DIPSHL7Connector/PatientRegistryService/ is too busy

Please check your firewall. It should be open for traffic on the port used by the service.

  Back to the top

Q: I receive the error message: The message with Action 'urn:hl7-org:v3/…' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher.

Please check the service address in the configfile.

 Back to the top

Q: List over services in the different WSDLs

PatientRegistryQueryFulfiller.wsdl

o       PatientRegistry.GetDemographics

o       PatientRegistry.FindCandidates

 

PatientRegistryRequestFulfiller.wsdl

o       PatientRegistry.Add

 

PersonRegistryQueryFulfiller.wsdl

o       PersonRegistry.GetDemographics

o       PersonRegistry.FindCandidates

 

CareRecordQueryFulfiller.wsdl

o       CareRecordManager.GetCareRecordProfile

 

EncounterManagerQueryFulfiller.wsdl

o       EncounterManger.FindEncounters

Back to the top

Q: How to make a client that sets request and response object?  

See code beneath for example.

 //xml document to send (see “NE2008_hv.zip” for example files of requests and corresponding responses)
XmlDocument doc = new XmlDocument();
doc.Load(@"C:\Projects\EPJ_Bergen\GetDemographicsRequest.xml");

//create a request object
PRPA_IN201307NO_OperationRequest
request = new PRPA_IN201307NO_OperationRequest();

//assign a value to the request object
request.PRPA_IN201307NO = (PRPA_IN201307NO)ObjectSerializer.DeserializeObject(doc, typeof(PRPA_IN201307NO), "urn:hl7-org:v3");

//create a proxy object to connect to service
PatientRegistryQueryFulfiller_PortTypeClient PatientRegistryClient = new PatientRegistryQueryFulfiller_PortTypeClient();

//create a response object, and assign it the value of the response of the request operation
PRPA_IN201307NOResponse response;
response = PatientRegistryClient.PRPA_IN201307NO_Operation(request.PRPA_IN201307NO);

//if you want to show the result in a messagebox
MessageBox.Show(ObjectSerializer.SerializeObject(response.Item, "urn:hl7-org:v3").OuterXml);


*NOTE: The ObjectSerializer class is a helper class we have made that serializes and deserializes objects. You need to make your own helper class or just include serialization/deserialisation code directly in the code.

**NOTE: It might be that you have to adjust the values in the <system.serviceModel/bindings/basicHttpBinding/binding/readerQuotas > parameters in  the client config file, as the default value could be too small for the response you get from the service.

Back to the top

 

Q: Will these WSDL schemas be exactly according to the HL7 or will there be changes to this schemas to adapt to your system?

There are not planned any changes on the delivered WSDL files or other schemas.

To enable tracing on a wcf client, you can choose to manually set up the tracing by editing the elements in the web/app.config file, or use ”Microsoft Service Configuration Editor” (SvcConfigEditor.exe) to edit the config file. Then you can read/analyze the trace log by using the ”Microsoft Service Trace Viewer” (SvcTraceViewer.exe).  This post shows you how to do this using the Microsoft Service Configuration Editor.

The tools are located in: \Program Files\Microsoft SDKs\Windows\v6.0A\Bin.

 1.       Open the config.file in the editor.

  

 2.     Enable tracing and configure the trace level.  PS! Remember to save your changes, File -> Save.

 

3.       When you have enabled tracing and saved the changes, you will be able to see the tracelog file, e.x. app_tracelog.svclog in the same folder as your config file.

F.      

To read/analyze the trace log, you may open the trace log in the”Microsoft Service Trace Viewer” (SvcTraceViewer.exe).

 

 

Back to the top

 

 

How-to implement WCF Security - Username Tokens via Transport-based Security

In this article I will show you how you can implement security on the WCF services.

Helse Vest will be configuring and using a security mode called "TransportWithMessageCredential" on all services that will be published in their domain.

This security mode means that we are extending the <basicHttpBinding> element by setting the security mode to "TransportWithMessageCredential" and then specifying the <clientCredentialType> attribute of the message mode to be that of "Username." Translated, this means: "We are sending a username credential type in the message's headers and that we would like to protect it via a transport-level security protocol." Helse Vest will configure IIS and the virtual directory security where this service is hosted to have secure communications (HTTPS/SSL).

The configuration file for both service and client will be looking approx. as shown in the example below.

<system.serviceModel>

       <services>

             <service type="MyFirstSecuredWCFService, WebApp">

             <endpoint address="" contract="IMyFirstSecuredWCFService, WebApp"

               binding="basicHttpBinding" bindingConfiguration="MySecuredBasicHttpBinding" />

             </service>

       </services>

       <bindings>

             <basicHttpBinding>

                    <binding configurationName="MySecuredBasicHttpBinding">

                           <!-- UsernameToken over Transport Security -->

                           <security mode="TransportWithMessageCredential">

                           <message clientCredentialType ="UserName" />

                           </security>

                    </binding>

             </basicHttpBinding>

       </bindings>

</system.serviceModel>

 

On the client side, the following two lines have to be added into the code, adding the username and password credentials to the client-side channel factory.

            ServiceClient client = new ServiceClient();

            client.ChannelFactory.Credentials.UserName.UserName = "<UserName>";

            client.ChannelFactory.Credentials.UserName.Password = "<SomePassword>";

The result will be a username token embedded in the <headers> of the SOAP message as shown below. The SOAP headers will be generated and added automatically if you are using the WCF/.NET framework when using <security mode="TransportWithMessageCredential">.

  

  <s:Envelope xmlns:s="...">

    <s:Header>

      <o:Security s:mustUnderstand="1" xmlns:o="...">

        <u:Timestamp u:Id="uuid-c16f2bd1-...">

          <u:Created>2005-10-26T23:56:27.109Z</u:Created>

          <u:Expires>2005-10-27T00:11:27.109Z</u:Expires>

        </u:Timestamp>

        <o:UsernameToken u:Id="uuid-060c77ce-...">

          <o:Username>UserName</o:Username>

          <o:Password o:Type="...">SomePassword</o:Password>

        </o:UsernameToken>

      </o:Security>

    </s:Header>

    <s:Body>

      <!— message body -->      

    </s:Body>

  </s:Envelope>

 

           We hope this article will clarify some of the aspect of implementing security in your clients.

 

Back to the top

 

Back to main page

 

For other questions about the HL7 Implementation,
please email: (remove space)
Morten Solheim Myhre : morten.solheim.myhre @helse-vest-ikt.no