I hope this message receives the list, a few did not, and a few did. I hear other people experience a similar problem.
If it does not show up in the list within an hour, I send it again, if it then shows up double, excuse me for that.
> Interesting.
> I found it hard to find good documentation for how to use RESTful in
> Java.
> That is why I did not study it better.
> I will take a look at it.
It may be a surprise for you that I have written only the codes bellow:
[http://openehr.jp/repositories/entry/ref-impl-ruby/ruby/trunk/terminology/config/routes.rb](http://openehr.jp/repositories/entry/ref-impl-ruby/ruby/trunk/terminology/config/routes.rb)
map.terminology 'terminology/:name/:lang/:code',
:controller => 'terminology',
:action => 'show'
[http://openehr.jp/repositories/entry/ref-impl-ruby/ruby/trunk/terminology/app/controllers/terminology_controller.rb](http://openehr.jp/repositories/entry/ref-impl-ruby/ruby/trunk/terminology/app/controllers/terminology_controller.rb)
def show
@terminology = Terminology.find(:first,:conditions => {
:name => params[:name],
:lang => params[:lang],
:code => params[:code]})
if @terminology.nil?
render :text => '404 not found.', :status => 404
else
render :xml => @terminology.to_xml(
:skip_types => true, :only => [:rubric])
end
end
Thanks for sharing. I really appreciate that.
I cannot read this code for 100% sure. I am not familiar with this code-language.
I guess you also have a kind of terminology-server in the background which finds for you the needed values, and is this what you show us the front end that handles a request.
Is that so?
In that case, the number of code-lines I write is about the same, all the soap handling code is generated from a wsdl-file I created. There is software to do so: wsdl2java
In the generated Java-files, I put the calling code in the generated function-bodies (wrappers). The names it creates are not always very good looking (like this: createPartyRelationship6), but, nothing is perfect, and it is not a big deal.
I do not use the terminology as a service, but as a library, for the moment, it will be a service later on. So I cannot show you a similar example of my code.
I can show you however some example code of a connection-function in a demographic-service I write.
It receives XML (representing a locatable, in this case a PartyRelationship), from which it creates (also with non-domain attributes, generates a UID) and checks (against archetype-conditions, and other conditions) and persists the newly created locatable.
Al this is done in a background library (LocatableUtils), which is (in this case) used by the demographic-service.
So the code you see is in fact no more than a connection to that background-library.
In this way it is easy to write more webservices doing the same thing, for example in a different protocol (I consider that later, if needed), and it is also possible to interchange the background library for example with a connection to a already available demographic-service. So completely modulair in all directions.
Then now the function in the service itself, which is generated, only the body (blue lines) is written by me.
public openehr.rosa.demographicservice.CreatePartyRelationshipResponse createPartyRelationship
(
openehr.rosa.demographicservice.CreatePartyRelationship createPartyRelationship6
)throws CreatePartyRelationshipGenericFaultConditionException3
{
try{
```LocatableUtils lu = new LocatableUtils(null,“”); ObjectID oi = lu.save(createPartyRelationship6.getPartyRelationship(),“org.openehr.rm.demographic.PartyRelationship”); CreatePartyRelationshipResponse cdr = new CreatePartyRelationshipResponse(); if(oi==null) cdr.setOut(“”); else cdr.setOut(oi.getValue()); return cdr; }catch(Exception e){ throw new CreatePartyRelationshipGenericFaultConditionException3(“An error occured: #createPartyRelationship:”+e.getMessage()); } }`
The code calls the library, does its thing.and returns a UID-string which is generated back to the caller.
Exceptions not handled in the library are also send to the caller of the webservice
regards
Bert