elementechemlyn / NEMS-Postman

A postman environment and collection for experimenting with NEMS in OpenTest
0 stars 0 forks source link

Query regarding the Subscription Request #2

Open j4jig opened 4 years ago

j4jig commented 4 years ago

Hi ,

We are creating a system to receive event messages from NEMS. We have obtained the OpenTest environment and related artifacts and did setup on the machine. I am facing issues on subscription api call. Issue 1 - As per the documentation available on https://developer.nhs.uk/apis/ems-beta/explore_create_subscription.html

Capture in ToASID field NEMS ASID needs to be passed but as per readme file we need to pass ASID we got along with opentest env. I am not sure which one to go with. Please clarify.

Issue 2 - From where do I get the ASID of NEMS for open test environment.

elementechemlyn commented 4 years ago

Hi. The one you've been issued with should be sent as the FromASID.

In OpenTest, the ASID for NEMS is 200000000306 which you should specify as the ToASID.

Officially - you should look up the ASID for NEMS (or any other Spine service) using an ldap search on Spine Directory Services to find the party key and Unique identifier (aka the ASID):

i.e. ldapsearch -x -H ldap://192.168.128.11 -b "ou=services, o=nhs" "(&(nhsIDCode=YES) (nhsAsSvcIA=urn:nhs:names:services:clinicals-sync:SubscriptionsApiPost))" uniqueIdentifier nhsMhsPartyKey

One you've got that - you can look up the endpoint address:

eg. To lookup the Message Handling Service endpoint for Subscription Post: ldapsearch -x -H ldap://192.168.128.11 -b "ou=services, o=nhs" "(&(nhsMhsPartyKey=[PARTY KEY GOES HERE]) (objectClass=nhsMhs) (nhsMhsSvcIA=urn:nhs:names:services:clinicals-sync:SubscriptionsApiPost))" nhsMhsEndPoint

There are some example directory service searches here: https://gist.github.com/elementechemlyn/a06a0c9e31ba1c81333609b7d270eff0

j4jig commented 3 years ago

Hi, Thanks to your previous response , I have been able to create new subscription for the events(such as PDS Birthnotification, Bloodspot test outcome etc.) now.

I have further couple of queries on this:

  1. Which MESH api end point will be used for open test environment? As per this https://meshapi.docs.apiary.io there are below three env:

2 .HMAC-SHA256 token is required for authorization header while calling the MESH API. As per the documentation the shared key for generating this token is required which needs to be manually asked from HSCIC. Could you please provide the email id or some reference to whom I can connect for this.

elementechemlyn commented 3 years ago

Hi, The Endpoint for MESH API in OpenTest is: https://192.168.128.11/messageexchange

If you drop a mail to platforms.supportdesk@nhs.net they'll be able to give you the shared key.

j4jig commented 3 years ago

Hi , Thank you so much for the prompt response.

We have got the mesh APIs working now.

As per the documentationhttps://developer.nhs.uk/apis/ems-beta/subscription_general_api_guidance.html, it is mentioned that we need to verify nhs number prior making subscription api call for any NHSNumber. I am checking this via - https://192.168.128.11/smsp/pds I am not able to find the request format for verifyNHSNumber. In the documentation provided on this link- https://developer.nhs.uk/apis/smsp/smsp_getting_started.html#step-2--message-specification only contains request format for getNHSNumber. It tried calling getNHSNumber to check if things are working and I am getting success response.

For verifyNHSNumber I did changes as per the documentation but in response getting the error code- SMSP-0001 which is input message validation error. Could you please provide the sample request so that I can verify what is wrong with the request I made.

FYI, I am using below request in body:

<?xml version="1.0" encoding="UTF-8"?><!--This example message is provided for illustrative purposes only. It has had no clinical validation. Whilst every effort has been taken to ensure that the examples are consistent with the message specification, where there are conflicts with the written message specification or schema, the specification or schema shall be considered to take precedence-->
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:itk="urn:nhs-itk:ns:201005">
    <soap:Header>
        <wsa:MessageID>B72F7785-534C-11E6-ADCA-29C651A3BE6F</wsa:MessageID>
        <wsa:Action>urn:nhs-itk:services:201005:verifyNHSNumber-v1-0</wsa:Action>
        <wsa:To>https://192.168.128.11/smsp/pds</wsa:To>
        <wsa:From>
            <wsa:Address>192.168.54.7</wsa:Address>
        </wsa:From>
        <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
            <wsu:Timestamp xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="D6CD5232-14CF-11DF-9423-1F9A910D4703">
                <wsu:Created>2016-07-27T11:10:23Z</wsu:Created>
                <wsu:Expires>2020-07-27T11:20:23Z</wsu:Expires>
            </wsu:Timestamp>
            <wsse:UsernameToken>
                <wsse:Username>TKS Server test</wsse:Username>
            </wsse:UsernameToken>
        </wsse:Security>
    </soap:Header>
    <soap:Body>
        <itk:DistributionEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <itk:header service="urn:nhs-itk:services:201005:verifyNHSNumber-v1-0" trackingid="B72F9E96-534C-11E6-ADCA-29C651A3BE6F">
                <itk:auditIdentity>
                    <itk:id type="1.2.826.0.1285.0.2.0.107" uri="868000003114"/>
                </itk:auditIdentity>
                <itk:manifest count="1">
                    <itk:manifestitem id="uuid_808A9678-49B2-498B-AD75-1D7A0F1262D7" mimetype="text/xml" profileid="urn:nhs-en:profile:verifyNHSNumberRequest-v1-0" base64="false" compressed="false" encrypted="false"/>
                </itk:manifest>
                <itk:senderAddress uri="urn:nhs-uk:addressing:ods:rhm:team1:C"/>
            </itk:header>
            <itk:payloads count="1">
                <itk:payload id="uuid_808A9678-49B2-498B-AD75-1D7A0F1262D7">
                    <verifyNHSNumberRequest-v1-0 xmlns="urn:hl7-org:v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" moodCode="EVN" classCode="CACT">
                        <id root="3E25ACE2-23F8-4A37-B446-6A37F31BF77C"/>
                        <code codeSystem="2.16.840.1.113883.2.1.3.2.4.17.284" code="verifyNHSNumberRequest-v1-0"/>
                        <queryEvent>
                            <Person.NHSNumber>
                                <value value="9473480032" />
                                <semanticsText>Person.NHSNumber</semanticsText>
                            </Person.NHSNumber>
                            <Person.DateOfBirth>
                                <value value="19770705" />
                                <semanticsText>Person.DateOfBirth</semanticsText>
                            </Person.DateOfBirth>
                            <Person.Name>
                                <value>
                                    <given>LILITH</given>
                                    <family>LAWALI</family>
                                </value>
                                <semanticsText>Person.Name</semanticsText>
                            </Person.Name>

                        </queryEvent>
                    </verifyNHSNumberRequest-v1-0>
                </itk:payload>
            </itk:payloads>
        </itk:DistributionEnvelope>
    </soap:Body>
</soap:Envelope>

In response Getting this:

<?xml version='1.0' encoding='UTF-8'?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:itk="urn:nhs-itk:ns:201005" xmlns:hl7="urn:hl7-org:v3">
    <soap:Header>
        <wsa:MessageID>B3C79D36-F137-11EA-95D5-6C3BE5A861CD</wsa:MessageID>
        <wsa:Action>urn:nhs-itk:services:201005:verifyNHSNumber-v1-0Response</wsa:Action>
    </soap:Header>
    <soap:Body>
        <itk:DistributionEnvelope>
            <itk:header service="urn:nhs-itk:services:201005:verifyNHSNumber-v1-0Response" trackingid="B3C7A088-F137-11EA-95D5-6C3BE5A861CD">
                <itk:manifest count="1">
                    <itk:manifestitem id="uuid_B3C66060-F137-11EA-95D5-6C3BE5A861CD" mimetype="text/xml" profileid="urn:nhs-en:profile:verifyNHSNumberResponse-v1-0" base64="false" compressed="false" encrypted="false"/>
                </itk:manifest>
            </itk:header>
            <itk:payloads count="1">
                <itk:payload id="uuid_B3C66060-F137-11EA-95D5-6C3BE5A861CD">
                    <verifyNHSNumberResponse-v1-0 xmlns="urn:hl7-org:v3" moodCode="EVN" classCode="OBS">
                        <id root="B3C66060-F137-11EA-95D5-6C3BE5A861CD"/>
                        <code codeSystem="2.16.840.1.113883.2.1.3.2.4.17.284" code="verifyNHSNumberResponse-v1-0"/>
                        <value codeSystem="2.16.840.1.113883.2.1.3.2.4.17.285" code="SMSP-0001"/>
                    </verifyNHSNumberResponse-v1-0>
                </itk:payload>
            </itk:payloads>
        </itk:DistributionEnvelope>
    </soap:Body>
</soap:Envelope>
elementechemlyn commented 3 years ago

Hi. Here is an example verify payload. At first glance it looks like you've not included the NHS Number value correctly.

You can also find examples of all the payloads in the SMS PDS requirements pack which you can request from Here.

<verifyNHSNumberRequest-v1-0 xmlns="urn:hl7-org:v3" moodCode="EVN" classCode="CACT">
    <id root="16C2662F-1C6E-4F38-9B3F-5084F46CE3E1"/>
    <code codeSystem="2.16.840.1.113883.2.1.3.2.4.17.284" code="verifyNHSNumberRequest-v1-0"/>
    <queryEvent>
        <Person.DateOfBirth>
            <value value="19890101"/>
            <semanticsText>Person.DateOfBirth</semanticsText>
        </Person.DateOfBirth>
        <Person.NHSNumber>
            <value root="2.16.840.1.113883.2.1.4.1" extension="9999345201"/>
            <semanticsText>Person.NHSNumber</semanticsText>
        </Person.NHSNumber>
    </queryEvent>
</verifyNHSNumberRequest-v1-0>