subscription rest-hook HTTP 400 Bad Request

909 views
Skip to first unread message

Travis

unread,
Dec 12, 2017, 11:08:17 AM12/12/17
to HAPI FHIR
Hi All,

I'm trying to use subscription mechanism to be notified when an Observation is updated...I have followed documentation then storing the following subscription:
{
      "fullUrl": "http://localhost:9080/fhir/baseDstu3/Subscription/29953",
      "resource": {
        "resourceType": "Subscription",
        "id": "29953",
        "meta": {
          "versionId": "7",
          "lastUpdated": "2017-12-12T13:03:45.560+01:00"
        },
        "status": "active",
        "reason": "Monitor observation",
        "criteria": "Observation?code=20149-1&subject=7",
        "channel": {
          "type": "rest-hook",
          "endpoint": "http://localhost:9080/cdsservice-rest/admin/rest/$hook",
          "payload": "application/json",
          "header": [
            "activation-conf-id: 1",
            "Content-Type: application/json"
          ]
        }
      }
then I created my hook rest service (Jersey based) as well (see below)
@PUT
@Path("/$hook")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response hook(IBaseResource observation){
System.out.println("UpdatedResource.: "+observation);
return Response.status(200).build();
}

Now, when I invoke an update (CRUD operation) of an Observation (linked to subject 7) then the subscription handling mechanism correctly runs but I get an HTTP 400 Bad Request exception (see attached log file for details).
It seems somehow my rest service signature is not able to manage the request coming from the HAPI Client. I made some debugging by exploring what happens by HAPI server side just after updating the observation.
By the way the deliverPayload method (within the SubscriptionDeliveringRestHookSubscriber class) properly works because
it correctly fetched the updated resource (IBaseResource payloadResource = theMsg.getPayload(getContext()); this code correctly runs and retrieves the updated object) and, then, it correctly delegates the client to proceed with the call
case UPDATE:
operation = theClient.update().resource(payloadResource);
break;
The execution flow arrives to this point but then the client returns the exception got from the server where the hook (jersey) rest service is running.
For all this reasons I think the problem could be in the final way the request is built by the HAPI server rest client in the sense that for some reason it is not "compatible" with the exposed hook service but I cannot see "why".

Thanks in advance for your feedback.
log.docx

Travis

unread,
Dec 13, 2017, 12:50:08 PM12/13/17
to HAPI FHIR
Maybe I have identified the problem.
Using eclipse TCP/IP monitor I have catched the request structure generated by HAPI FHIR and I doscovered it appends 2 content-type. Below I reported an excerpt of what found..as you can see the Content-Type is twice present. Now even if I declare, on my jersey2 rest service this annotation @Consumes({"application/fhir+json,application/json"} to impose it to accept both, I continue to have the same error.

To go deep inside this point, I went with POSTMAN by creating exactly the same request and making some tests: if I select to send both the content-type in the header of my request I have (as expected) exactly the same behaviour (I mean the same exception) but if I select only one (e.g. application/json OR application/fhir+json) then everything works fine. In other words it seems that the way jersey2 uses the multiple value within the @Consumes is for accepting one of the multiple declared content type at time...and not multiple content type within the same request! 

Now I'm trying to understand if this behaviour is a wrong interpretation by Jersey2 or if it is correct (i.e. compliant with the RFC 7231 spec.). If it is correct this means that HAPI FHIR should avoid to append multiple content type within the request header I guess. @James what do you think? Some feedback on this point?    


User-Agent: HAPI-FHIR/3.1.0-SNAPSHOT (FHIR Client; FHIR 3.0.1/DSTU3; apache)
Accept-Charset: utf-8
Accept-Encoding: gzip
Accept: application/fhir+json;q=1.0, application/json+fhir;q=0.9
Content-Type: application/fhir+json; charset=UTF-8
activation-conf-id: 1
Content-Type: application/json
Content-Length: 242
Host: localhost:9080
Connection: Keep-Alive 

James Agnew

unread,
Dec 13, 2017, 1:20:27 PM12/13/17
to Travis, HAPI FHIR
Hmm... I have a hard time imagining how a second content type header is getting added... especially given that AFAIK there is no way to get HAPI to add a plain "application/json" content type. There is also that "activation-conf-id" header which certainly doesn't come from HAPI.

I'm wondering if Eclipse's TCP monitor is adding something in the mix.. Could you try it with Postman's proxy: https://www.getpostman.com/docs/postman/sending_api_requests/proxy

Cheers,
James

--
You received this message because you are subscribed to the Google Groups "HAPI FHIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hapi-fhir+unsubscribe@googlegroups.com.
To post to this group, send email to hapi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hapi-fhir/a1faca69-f63f-4376-9e5a-d03ba872b2d7%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

S S

unread,
Dec 20, 2017, 4:35:40 AM12/20/17
to HAPI FHIR
Hi, I created below Subscription resource on HAPI FHIR server with specified criteria after that I created the resource with subscription criteria details but not received any notification is there any configuration required do on FHIR server for notification part.
{
  "resourceType": "Subscription",
  "id": "subscription-1",
  "meta": {
    "versionId": "2",
    "lastUpdated": "2017-12-20T13:28:02.123+05:30"
  },
  "status": "active",
  "end": "2018-12-20T13:27:56.202+05:30",
  "reason": "New Referral Request",
  "criteria": "ReferralRequest?type=http://snomed.info/sct|103699006",
  "channel": {
    "type": "email",
    "endpoint": "mailto:a...@gmail.com"
  }
}

James Agnew

unread,
Dec 20, 2017, 6:46:08 AM12/20/17
to S S, HAPI FHIR
Hi there,

You need to register the SubscriptionEmailInterceptor interceptor against the server and configure it with a mail sender in order to enable email subscriptions.

This process isn't well documented yet (help wanted) but you could look at the unit test to see how it all works.

Cheers,
James

--
You received this message because you are subscribed to the Google Groups "HAPI FHIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hapi-fhir+unsubscribe@googlegroups.com.
To post to this group, send email to hapi...@googlegroups.com.

SS

unread,
Dec 20, 2017, 6:50:51 AM12/20/17
to James Agnew, HAPI FHIR
Thanks for your reply really appreciated..

I just trying for email ....

But we are looking for rest-hook or websocket option can you give me some help on how I can do for rest hook option.
My rest-hook channel endpoint is of my .net class.

Thanks & Regards,
Shivnath S.
8097181091

James Agnew

unread,
Dec 20, 2017, 8:47:33 AM12/20/17
to SS, HAPI FHIR
Essentially it's the same kind of setup, you need to register the SubscriptionRestHookInterceptor against the server.

Cheers,
James

S S

unread,
Dec 20, 2017, 9:50:06 AM12/20/17
to HAPI FHIR
Thanks James your help really appreciated..

How I can register the SubscriptionRestHookInterceptor against the server.

also I am working on .net code so whats the way to create rest-hook endpoint for my .net application

thanks


On Tuesday, 12 December 2017 21:38:17 UTC+5:30, Travis wrote:

James Agnew

unread,
Dec 20, 2017, 10:12:53 AM12/20/17
to S S, HAPI FHIR
In terms of creating a .NET endpoint, the REST Hook endpoint is just a normal FHIR REST endpoint, so you'd build it just like any other FHIR server. It's definitely beyond the scope of HAPI's capabilities, but the Vonk FHIR Facade could probably help.

Cheers,
James

--
You received this message because you are subscribed to the Google Groups "HAPI FHIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hapi-fhir+unsubscribe@googlegroups.com.
To post to this group, send email to hapi...@googlegroups.com.

S S

unread,
Dec 21, 2017, 1:47:48 AM12/21/17
to HAPI FHIR
Hi James,
Thanks for your valuable reply..

I want to know that REST Hook endpoint must be any FHIR server endpoint or I can assign any endpoint ex. my application url like that..



On Tuesday, 12 December 2017 21:38:17 UTC+5:30, Travis wrote:

S S

unread,
Dec 21, 2017, 4:57:03 AM12/21/17
to HAPI FHIR
Hi All,
I created below subscription resource on Vonk server...

<Subscription xmlns="http://hl7.org/fhir">
<id value="subscription-1"/>
<meta>
<versionId value="aa8a0ca7-3f83-4683-9cb3-a8f6d10f0aa7"/>
<lastUpdated value="2017-12-21T07:59:25.537+00:00"/>
</meta>
<status value="active"/>
<end value="2018-12-21T13:29:23.547+05:30"/>
<reason value="New Request"/>
<criteria value="Observation?code=http://loinc.org|1975-2"/>
<channel>
<type value="rest-hook"/>
<payload value="application/json"/>
</channel>
</Subscription>

also created below Observation resource...

<Observation xmlns="http://hl7.org/fhir">
<id value="Observation-1"/>
<meta>
<versionId value="9decddec-61e4-481d-a8b0-bcf1a79ae63f"/>
<lastUpdated value="2017-12-21T07:59:28.735+00:00"/>
</meta>
<status value="registered"/>
<code>
<coding>
<system value="http://loinc.org"/>
<code value="1975-2"/>
</coding>
<text value="test"/>
</code>
</Observation> 

but not able to receive any notification..

please help about this  as endpoint value="http://38190eab.ngrok.io/PatintAddByReferralRequest/Index" is my application url..

what should I require to do so this will work for me
 
Also 


On Tuesday, 12 December 2017 21:38:17 UTC+5:30, Travis wrote:

Travis

unread,
Dec 21, 2017, 5:24:35 AM12/21/17
to HAPI FHIR
Thanks a lot James....after your answer I understood the problem was due to the fact I added a dedicated content-type "application/json" within the headers of the subscription other than the payload entry set to "application/fhir+json". By deleting the content-type entry from the headers everythning properly works now.

Many thanks,

Il giorno mercoledì 13 dicembre 2017 19:20:27 UTC+1, James Agnew ha scritto:
Hmm... I have a hard time imagining how a second content type header is getting added... especially given that AFAIK there is no way to get HAPI to add a plain "application/json" content type. There is also that "activation-conf-id" header which certainly doesn't come from HAPI.

I'm wondering if Eclipse's TCP monitor is adding something in the mix.. Could you try it with Postman's proxy: https://www.getpostman.com/docs/postman/sending_api_requests/proxy

Cheers,
James
On Wed, Dec 13, 2017 at 12:50 PM, Travis <paolo.za...@gmail.com> wrote:
Maybe I have identified the problem.
Using eclipse TCP/IP monitor I have catched the request structure generated by HAPI FHIR and I doscovered it appends 2 content-type. Below I reported an excerpt of what found..as you can see the Content-Type is twice present. Now even if I declare, on my jersey2 rest service this annotation @Consumes({"application/fhir+json,application/json"} to impose it to accept both, I continue to have the same error.

To go deep inside this point, I went with POSTMAN by creating exactly the same request and making some tests: if I select to send both the content-type in the header of my request I have (as expected) exactly the same behaviour (I mean the same exception) but if I select only one (e.g. application/json OR application/fhir+json) then everything works fine. In other words it seems that the way jersey2 uses the multiple value within the @Consumes is for accepting one of the multiple declared content type at time...and not multiple content type within the same request! 

Now I'm trying to understand if this behaviour is a wrong interpretation by Jersey2 or if it is correct (i.e. compliant with the RFC 7231 spec.). If it is correct this means that HAPI FHIR should avoid to append multiple content type within the request header I guess. @James what do you think? Some feedback on this point?    


User-Agent: HAPI-FHIR/3.1.0-SNAPSHOT (FHIR Client; FHIR 3.0.1/DSTU3; apache)
Accept-Charset: utf-8
Accept-Encoding: gzip
Accept: application/fhir+json;q=1.0, application/json+fhir;q=0.9
Content-Type: application/fhir+json; charset=UTF-8
activation-conf-id: 1
Content-Type: application/json
Content-Length: 242
Host: localhost:9080
Connection: Keep-Alive 

--
You received this message because you are subscribed to the Google Groups "HAPI FHIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hapi-fhir+...@googlegroups.com.

To post to this group, send email to hapi...@googlegroups.com.

S S

unread,
Dec 21, 2017, 5:48:10 AM12/21/17
to HAPI FHIR
Hi Travis,
Can you help me on below I am also looking for same...

I have HAPI fhir server as a endpoint I created subscription resource there but unable to get notification ..
How I can register rest-hook on HAPI fhir server...

please help on this

Travis

unread,
Dec 21, 2017, 6:09:20 AM12/21/17
to HAPI FHIR
Hi SS,

well the way to register the hook is, as for documentation, by using the "channel entry" within the subscription. If you give a look to my first post you find how I have specified it and it was sufficient for me. The endpoint I specified there is the endpoint of a REST service I have created by my own....it is part of my application which is completely auonomous from the FHIR server.

I hope this can be helpful...

S S

unread,
Dec 21, 2017, 7:29:10 AM12/21/17
to HAPI FHIR
Hi Travis,
Please find my below code,
In my case for matching criteria channel endpoint request is not invoked

I created below resource on FHIR server...version(hapi-fhir-3.1.0)
Subscription Resource :-

{
  "resourceType": "Subscription",
  "id": "subscription-1",
  "meta": {
    "versionId": "16",
    "lastUpdated": "2017-12-21T17:38:50.261+05:30"
  },
  "status": "active",
  "end": "2018-12-21T17:38:37.321+05:30",
  "reason": "New Request",
  "criteria": "Observation?code=http://loinc.org|1975-2",
  "channel": {
    "type": "rest-hook",
    "endpoint": "http://38190eab.ngrok.io/PatintAddByReferralRequest/Index",
    "payload": "application/json",
    "header": [
      "activation - conf - id:1"
    ]
  }
}
 getting below error:--

17:54:05 INFO  ca.uhn.fhir.jpa.dao.SearchBuilder - Initial query result returned
 in 0ms for query 57a26c97-9154-49c5-a344-aac7f4d1196e
17:54:05 INFO  ca.uhn.fhir.jpa.dao.SearchBuilder - Query found 2 matches in 1ms
for query 57a26c97-9154-49c5-a344-aac7f4d1196e
17:54:08 ERROR c.u.f.j.s.BaseSubscriptionDeliverySubscriber - Failure handling s
ubscription payload
ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException: HTTP 404 Not Found

        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)

        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Sou
rce)
        at java.lang.reflect.Constructor.newInstance(Unknown Source)
        at ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException.newIns
tance(BaseServerResponseException.java:301)
        at ca.uhn.fhir.rest.client.impl.BaseClient.invokeClient(BaseClient.java:
323)
        at ca.uhn.fhir.rest.client.impl.GenericClient$BaseClientExecutable.invok
e(GenericClient.java:448)
        at ca.uhn.fhir.rest.client.impl.GenericClient$UpdateInternal.execute(Gen
ericClient.java:2096)
        at ca.uhn.fhir.rest.client.impl.GenericClient$UpdateInternal.execute(Gen
ericClient.java:2042)
        at ca.uhn.fhir.jpa.subscription.resthook.SubscriptionDeliveringRestHookS
ubscriber.deliverPayload(SubscriptionDeliveringRestHookSubscriber.java:74)
        at ca.uhn.fhir.jpa.subscription.resthook.SubscriptionDeliveringRestHookS
ubscriber.handleMessage(SubscriptionDeliveringRestHookSubscriber.java:109)
        at ca.uhn.fhir.jpa.subscription.BaseSubscriptionDeliverySubscriber.handl
eMessage(BaseSubscriptionDeliverySubscriber.java:54)
        at org.springframework.messaging.support.ExecutorSubscribableChannel$Sen
dTask.run(ExecutorSubscribableChannel.java:138)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
17:54:08Exception in thread "subscription-delivery-5" org.springframework.messag
ing.MessagingException: Failure handling subscription payload; nested exception
is ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException: HTTP 404 Not Fo
und, failedMessage=ca.uhn.fhir.jpa.subscription.ResourceDeliveryJsonMessage@19e5
df64
 INFO  c.u.f.j.s.r.SubscriptionDeliveringRestHookSubscriber - Delivering UPDATE
rest-hook payload Observation/Observation-1/_history/3 for Subscription/4953
        at ca.uhn.fhir.jpa.subscription.BaseSubscriptionDeliverySubscriber.handl
eMessage(BaseSubscriptionDeliverySubscriber.java:57)
        at org.springframework.messaging.support.ExecutorSubscribableChannel$Sen
dTask.run(ExecutorSubscribableChannel.java:138)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
Caused by: ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException: HTTP 40
4 Not Found
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)

        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Sou
rce)
        at java.lang.reflect.Constructor.newInstance(Unknown Source)
        at ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException.newIns
tance(BaseServerResponseException.java:301)
        at ca.uhn.fhir.rest.client.impl.BaseClient.invokeClient(BaseClient.java:
323)
        at ca.uhn.fhir.rest.client.impl.GenericClient$BaseClientExecutable.invok
e(GenericClient.java:448)
        at ca.uhn.fhir.rest.client.impl.GenericClient$UpdateInternal.execute(Gen
ericClient.java:2096)
        at ca.uhn.fhir.rest.client.impl.GenericClient$UpdateInternal.execute(Gen
ericClient.java:2042)
        at ca.uhn.fhir.jpa.subscription.resthook.SubscriptionDeliveringRestHookS
ubscriber.deliverPayload(SubscriptionDeliveringRestHookSubscriber.java:74)
        at ca.uhn.fhir.jpa.subscription.resthook.SubscriptionDeliveringRestHookS
ubscriber.handleMessage(SubscriptionDeliveringRestHookSubscriber.java:109)
        at ca.uhn.fhir.jpa.subscription.BaseSubscriptionDeliverySubscriber.handl
eMessage(BaseSubscriptionDeliverySubscriber.java:54)
        ... 4 more
17:54:09 ERROR c.u.f.j.s.BaseSubscriptionDeliverySubscriber - Failure handling s
ubscription payload
ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException: HTTP 404 Not Found

        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)

        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Sou
rce)
        at java.lang.reflect.Constructor.newInstance(Unknown Source)
        at ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException.newIns
tance(BaseServerResponseException.java:301)
        at ca.uhn.fhir.rest.client.impl.BaseClient.invokeClient(BaseClient.java:
323)
        at ca.uhn.fhir.rest.client.impl.GenericClient$BaseClientExecutable.invok
e(GenericClient.java:448)
        at ca.uhn.fhir.rest.client.impl.GenericClient$UpdateInternal.execute(Gen
ericClient.java:2096)
        at ca.uhn.fhir.rest.client.impl.GenericClient$UpdateInternal.execute(Gen
ericClient.java:2042)
        at ca.uhn.fhir.jpa.subscription.resthook.SubscriptionDeliveringRestHookS
ubscriber.deliverPayload(SubscriptionDeliveringRestHookSubscriber.java:74)
        at ca.uhn.fhir.jpa.subscription.resthook.SubscriptionDeliveringRestHookS
ubscriber.handleMessage(SubscriptionDeliveringRestHookSubscriber.java:109)
        at ca.uhn.fhir.jpa.subscription.BaseSubscriptionDeliverySubscriber.handl
eMessage(BaseSubscriptionDeliverySubscriber.java:54)
        at org.springframework.messaging.support.ExecutorSubscribableChannel$Sen
dTask.run(ExecutorSubscribableChannel.java:138)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
Exception in thread "subscription-delivery-6" org.springframework.messaging.Mess
agingException: Failure handling subscription payload; nested exception is ca.uh
n.fhir.rest.server.exceptions.ResourceNotFoundException: HTTP 404 Not Found, fai
ledMessage=ca.uhn.fhir.jpa.subscription.ResourceDeliveryJsonMessage@23953b41
        at ca.uhn.fhir.jpa.subscription.BaseSubscriptionDeliverySubscriber.handl
eMessage(BaseSubscriptionDeliverySubscriber.java:57)
        at org.springframework.messaging.support.ExecutorSubscribableChannel$Sen
dTask.run(ExecutorSubscribableChannel.java:138)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
Caused by: ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException: HTTP 40
4 Not Found
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)

        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Sou
rce)
        at java.lang.reflect.Constructor.newInstance(Unknown Source)
        at ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException.newIns
tance(BaseServerResponseException.java:301)
        at ca.uhn.fhir.rest.client.impl.BaseClient.invokeClient(BaseClient.java:
323)
        at ca.uhn.fhir.rest.client.impl.GenericClient$BaseClientExecutable.invok
e(GenericClient.java:448)
        at ca.uhn.fhir.rest.client.impl.GenericClient$UpdateInternal.execute(Gen
ericClient.java:2096)
        at ca.uhn.fhir.rest.client.impl.GenericClient$UpdateInternal.execute(Gen
ericClient.java:2042)
        at ca.uhn.fhir.jpa.subscription.resthook.SubscriptionDeliveringRestHookS
ubscriber.deliverPayload(SubscriptionDeliveringRestHookSubscriber.java:74)
        at ca.uhn.fhir.jpa.subscription.resthook.SubscriptionDeliveringRestHookS
ubscriber.handleMessage(SubscriptionDeliveringRestHookSubscriber.java:109)
        at ca.uhn.fhir.jpa.subscription.BaseSubscriptionDeliverySubscriber.handl
eMessage(BaseSubscriptionDeliverySubscriber.java:54)
        ... 4 more

On Tuesday, 12 December 2017 21:38:17 UTC+5:30, Travis wrote:

James Agnew

unread,
Dec 21, 2017, 11:19:11 AM12/21/17
to S S, HAPI FHIR
There is a 404 Not Found error in the stack trace, which means that your receiving endpoint is probably not handling the request correctly.

Cheers,
James

--
You received this message because you are subscribed to the Google Groups "HAPI FHIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hapi-fhir+unsubscribe@googlegroups.com.

To post to this group, send email to hapi...@googlegroups.com.

S S

unread,
Dec 22, 2017, 1:37:22 AM12/22/17
to HAPI FHIR
Hi James/Travis,

In my all rest-hook scenario I tried I am getting 404 not found error...

I created below sample Api in C# & in my subscription resource I mentioned endpoint as "http://localhost:53237/api/Test" I able to call this Api through postman but not invoked by HAPI server..

Please look into this or either there is any way for creating rest-hook in .net also what required to define me for rest-hook in my code.

 public class TestController : ApiController
    {
        // GET: api/Test
        public IEnumerable<string> Get()
        {
            return new string[] { "value1", "value2" };
        }

        // GET: api/Test/5
        public string Get(int id)
        {
            return "value";
        }
        public void Post([FromBody]string value)
        {
        }
}

On Tuesday, 12 December 2017 21:38:17 UTC+5:30, Travis wrote:

S S

unread,
Dec 22, 2017, 8:45:27 AM12/22/17
to HAPI FHIR
Thanks James/Travis,

Finally working my code


On Tuesday, 12 December 2017 21:38:17 UTC+5:30, Travis wrote:

James Agnew

unread,
Dec 22, 2017, 9:26:42 AM12/22/17
to S S, HAPI FHIR
Hi there,

Glad to hear it.

Can you please post the solution so that others might find it?

Cheers,
James

--
You received this message because you are subscribed to the Google Groups "HAPI FHIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hapi-fhir+unsubscribe@googlegroups.com.
To post to this group, send email to hapi...@googlegroups.com.

SS

unread,
Dec 22, 2017, 10:58:20 AM12/22/17
to James Agnew, HAPI FHIR
Hi,
At the end of my endpoint I putted ? So by this my endpoint request is able to call by server.

Remaining part I am considering as quary string in my query string I am getting criteria matched resource id.

By this resource id we will query to fhir server.


Thanks & Regards,
Shivnath S.
8097181091

S S

unread,
Jan 8, 2018, 7:37:02 AM1/8/18
to HAPI FHIR
Hi,

Actually we are FHIR DocumentResource in subscription & from there I can get data in blob I am not aware about this. 

How I can set criteria for DocumentResource also how I get the data at my channel end how I can manage that once request received by erst-hook.

Please help on this...

help really appreciated..

On Tuesday, 12 December 2017 21:38:17 UTC+5:30, Travis wrote:

Anusha

unread,
May 3, 2018, 8:51:04 AM5/3/18
to HAPI FHIR
Hi Shiv S,
 
Iam too facing the same issue what you have faced,I have added "?" as you suggested now iam not getting any 404 error,
but iam not knowing in which format notification will receive  on the subscriber side.



Thank you.
 

Anusha

unread,
May 4, 2018, 6:49:49 AM5/4/18
to HAPI FHIR
Hello All,

Can anyone please help me out from the  above issue.



Thank you.

James Agnew

unread,
May 4, 2018, 7:02:30 AM5/4/18
to Anusha, HAPI FHIR
Hi Anusha,

Can you please document a concise summary of the issue you are having.

- What is your Subscription criteria?
- What is your subscription endpoint?
- What specific URLs have you tested using postman?
- What do you see in the server logs (removing anything that isn't relevant)

Again, please post a complete description of your issue, including only relevant information.

Cheers,
James

--
You received this message because you are subscribed to the Google Groups "HAPI FHIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hapi-fhir+unsubscribe@googlegroups.com.
To post to this group, send email to hapi...@googlegroups.com.
Message has been deleted

Anusha

unread,
May 4, 2018, 8:11:21 AM5/4/18
to HAPI FHIR
Hi James,
 
I have given
- Subscription criteria as "Observation?category=social-history"
- Subscription endpoint as  "http://IP-Address:8080/hapi-fhir-jpaserver-example" (ip-address of other machine which is tested for below urls)

Urls tested using Postman:
  
Logs :
    when i update the Observation,
  if Subscrption endpoint is  http://IP-Address:8080/hapi-fhir-jpaserver-example 
   
Subscription check found 1 results for query
Found match: queueing rest-hook notification for resource: Observation/652/_history/1
Delivering UPDATE rest-hook payload Observation/652/_history/1 for Subscription/654
Failure handling subscription payload ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException: HTTP 404 
Subscriber side:
  No mapping found for HTTP request with URI [/hapi-fhir-jpaserver-example/Observation/652] in DispatcherServlet with name 'spring'
---------------------------------------------------------------------------------------------------------------------------------  
  
Now i changed Subscrption endpoint as   http://IP-Address:8080/hapi-fhir-jpaserver-example/?

  Subscription check found 1 results for query
  Found match: queueing rest-hook notification for resource: Observation/652/_history/1
  Delivering UPDATE rest-hook payload Observation/652/_history/1 for Subscription/654
  Now didnt get any 404 error
  
  Subscriber side:
  [VerboseLoggingInterceptor.java:60] Incoming request: GET http://IP-Address:8080/hapi-fhir-jpaserver-example/baseDstu3/metadata
 * user-agent: HAPI-FHIR/3.2.0-SNAPSHOT (FHIR Client; FHIR 3.0.1/DSTU3; apache)
 * accept-charset: utf-8
 * accept-encoding: gzip
 * accept: application/fhir+xml;q=1.0, application/fhir+json;q=1.0, application/xml+fhir;q=0.9, application/json+fhir;q=0.9
 * host: ip-address:8080
 * connection: Keep-Alive
----------------------------------------------------------------------------------------------------------------------------------
 and my doubt is do we need to handle to receive the notification at subscriber side?
 notification means where we able to see?
 
 Plese help me out with the above issues/doubts.
 
 
 Thank You.

James Agnew

unread,
May 4, 2018, 8:37:38 AM5/4/18
to Anusha, HAPI FHIR
Perfect, thank you.

Your subscription endpoint should be "http://IP-Address:8080/hapi-fhir-jpaserver-example/baseDstu3" based on those postman URLs.

Cheers,
James

 * connection: Keep-Alive
----------------------------------------------------------------------------------------------------------------------------------
 and my doubt is do we need to handle to receive the notification at subscriber side?
 notification means where we able to see?
 
 Plese help me out with the above issues/doubts.
 
 
 Thank You.

--
You received this message because you are subscribed to the Google Groups "HAPI FHIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hapi-fhir+unsubscribe@googlegroups.com.
To post to this group, send email to hapi...@googlegroups.com.

Anusha

unread,
May 4, 2018, 9:30:55 AM5/4/18
to HAPI FHIR
Thank you James,
As you suggested i have changed the subscription endpoint and now the stake trace is  
 At Subscriber end
 incomingRequestPreHandled()..............................UPDATE
incomingRequestPreHandled()..............................ca.uhn.fhir.rest.server.interceptor.IServerInterceptor$ActionRequestDetails@240559c9
2018-05-04 18:20:27.183 [http-nio-8080-exec-1] INFO  c.c.f.s.i.RequestInterceptor [RequestInterceptor.java:210] incomingRequestPreHandled code:update
2018-05-04 18:20:27.184 [http-nio-8080-exec-1] INFO  c.c.f.s.i.RequestInterceptor [RequestInterceptor.java:211] incomingRequestPreHandled resource type:Observation
2018-05-04 18:20:27.191 [http-nio-8080-exec-1] WARN  c.u.f.r.s.i.ExceptionHandlingInterceptor [ExceptionHandlingInterceptor.java:141] Failure during REST processing: ca.uhn.fhir.rest.server.exceptions.InvalidRequestException: Can not create resource with ID[702], no resource with this ID exists and clients may only assign IDs which contain at least one non-numeric character
2018-05-04 18:39:14.188 [scheduledExecutorService-5] INFO  c.u.f.j.d.d.SearchParamRegistryDstu3 [SearchParamRegistryDstu3.java:167] Refreshed search parameter cache in 7ms

Can i give my endpoint other than hapifhir url. Is we need to handle explicitly then

Anusha

unread,
May 7, 2018, 7:08:49 AM5/7/18
to HAPI FHIR
Hello everyone,

Can anyone please help me out with the above issue which Iam getting with subscription payload.



Thanks.

James Agnew

unread,
May 7, 2018, 10:21:17 AM5/7/18
to Anusha, HAPI FHIR
Perhaps you could describe your actual use case a bit. It's not possible to have a purely numeric client-assigned ID stored on a HAPI FHIR JPA server target, which is why that's failing.

--
You received this message because you are subscribed to the Google Groups "HAPI FHIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hapi-fhir+unsubscribe@googlegroups.com.
To post to this group, send email to hapi...@googlegroups.com.

Anusha

unread,
May 9, 2018, 8:45:48 AM5/9/18
to HAPI FHIR
Hi James,


-  For rest hook channel type how we will receive notification at the subscriber side(ie end point given side).Do we need to handle explicitly.
-  In which format notification will be,is it just the String or json?
-  what are the things  need to consider to handle rest hook subscription on the subscriber side.


please suggest me something for the above doubts.

Thank You. 




James Agnew

unread,
May 9, 2018, 9:39:54 AM5/9/18
to Anusha, HAPI FHIR
Can you describe what the actual problem you are trying to solve is? There are lots of architectures you can use to set subscriptions up from one system to another. Describing your business problem would be helpful.

Cheers,
James

--
You received this message because you are subscribed to the Google Groups "HAPI FHIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hapi-fhir+unsubscribe@googlegroups.com.
To post to this group, send email to hapi...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages