Stream: dotnet
Topic: RegEx URLs
Stephen Lloyd (Jul 05 2018 at 16:35):
Hi,
Looking at the RESTURI_PATTERN in the following file I'm wondering if it is correct as there seems to be a space after the http (& before the https) and the http:// - / chars are not escaped \/.
As I was trying to use the WebResolver I think it is failing at the URL IsRestResourceIdentity conformance check. I've checked this by playing around with the generated regex value in an online tester and noticed those errors. Does this look correct?
Thanks,
Stephen
Richard Kavanagh (Jul 06 2018 at 07:48):
I use the WebResolver against https://fhir.nhs.uk/ and https://fhir.hl7.org.uk/ and it works OK for me. What is the URL that you are attempting to use?
Stephen Lloyd (Jul 06 2018 at 08:52):
Hi @Richard Kavanagh
I'm trying to use http://purl.org/elab/StructureDefinition/ProjectIdentifer as an extension on our endpoint (local install of Vonk atm), the client connects but the use of a webresolver always returns nothing. Even if I use
resolver.AddSource(new WebResolver(id => new Hl7.Fhir.Rest.FhirClient("http://localhost:4080/administration")));
var temp = resolver.ResolveByUri("http://purl.org/elab/StructureDefinition/ProjectIdentifer");
it returns null (even ResolveByCanonicalUrl) when using either baseUrl or the admin endpoints in Vonk. When checking through the code in github I did notice the regex check and thought I'd manually test it to see if that was what was stopping resolution of the extension.
Stephen Lloyd (Jul 06 2018 at 10:37):
It does look like it works if I use a standard WebResolver and not one with a supplied FhirClient at the moment. Using the NHS profile to test
WebResolver resolver = new WebResolver(/*id => new Hl7.Fhir.Rest.FhirClient("https://fhir.nhs.uk/")*/); var temp = resolver.ResolveByUri("https://fhir.nhs.uk/STU3/StructureDefinition/Extension-CareConnect-GPC-AllergyIntoleranceEnd-1");
it works, but if I specify the FhirClient it does not.
Stephen Lloyd (Jul 09 2018 at 14:56):
If I supply:
FhirClient client = new FhirClient("http://localhost:4080/administration/");
WebResolver webResolver = new WebResolver(id => client);
..and try to search for
var yyy = webResolver.ResolveByUri("http://purl.org/StructureDefinition/Author");
This gets generated in the FhirClient.cs ReadAsync(~~)
<Bundle xmlns=\"http://hl7.org/fhir\">
<type value=\"batch\" />
<entry>
<request>
<method value=\"GET\" />
<url value=\"http://localhost:4080/administration/StructureDefinition/Author\" />
</request>
</entry>
</Bundle>
It looks like it might be changing the domain to match the client (but I need to double-check this) and I get no body in the response. If I try to perform the same request on the public Firely server (manually using Postman) with either URL I get:
"system": "http://hl7.org/fhir/dotnet-api-operation-outcome",
"code": "5005"
}
],
"text": "Interaction GET http://purl.org/StructureDefinition/Author in entry is not implemented."
Although in the Firely server test I have not uploaded the extension first.
Stephen Lloyd (Jul 09 2018 at 15:51):
This however works with the public Vonk server (even though supplying the full URL doesn't)
<Bundle xmlns="http://hl7.org/fhir">
<type value="batch" />
<entry>
<request>
<method value="GET" />
<url value="/StructureDefinition?url=http://purl.org/StructureDefinition/Author" />
</request>
</entry>
</Bundle>
Christiaan Knaap (Jul 11 2018 at 14:37):
In the last request you query by the canonical url of the StructureDefinition (indexed with the search parameter 'url').
You can have the WebResolver do the same with the method ResolveByCanonicalUrl.
Last updated: Apr 12 2022 at 19:14 UTC