Hi, I haven't played with Isis restful objects much but with the ToDo app when I load
http://localhost:18080/restful/services/ToDoItems/actions/newToDo somewhere in the response there is: { "rel" : "urn:org.restfulobjects:rels/invoke;action=\"newToDo\"", "href" : "http://localhost:18080/restful/services/ToDoItems/actions/newToDo/invoke", "method" : "POST", "type" : "application/json;profile=\"urn:org.restfulobjects:repr-types/object-action\"", "arguments" : { "description" : { "value" : null }, "category" : { "value" : null }, "subcategory" : { "value" : null }, "dueBy" : { "value" : null }, "cost" : { "value" : null } } This describes the format of the expected arguments. What does it return for your action ? I.e. for http://localhost:8080/restful/services/DeliverableService/actions/createNew <http://localhost:8080/restful/services/DeliverableService/actions/createNew/invoke> Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Thu, Feb 5, 2015 at 4:22 PM, Lechner Andreas <[email protected]> wrote: > Hi, > > I need some help please. > > I use a DomainService with following service method and autocomplete: > ------------------------------------- > @Named("DeliverableService") > @DomainService(menuOrder = "3", repositoryFor = Deliverable.class) > public class DeliverableService { > > ... > > > @NotContributed > @MemberOrder(sequence = "2") > @Named("Create New Deliverable") > public Deliverable createNew(final @Named("DeliverableName") > String deliverableName, > final @Named("DeliverableDescription") String > deliverableDescription, > final @Named("DeliGroup") DeliGroup deliGroup > ) { > Deliverable deliverable = > container.newTransientInstance(Deliverable.class); > deliverable.setDeliverableName(deliverableName); > > deliverable.setDeliverableDescription(deliverableDescription); > deliverable.setDeliGroup(deliGroup); > deliGroup.addToDeliverables(deliverable); > > container.persistIfNotAlready(deliverable); > return deliverable; > } > > > public List<DeliGroup> autoComplete2CreateNew(final @MinLength(1) > String search) { > return DBUtils.findAllByNameContains(container, > DeliGroup.class, search); > } > > ... > > ------------------------------------- > > > now I want to call this service over the rest interface. > I think the URL should be > > http://localhost:8080/restful/services/DeliverableService/actions/createNew/invoke > > > I tried to test it over the "RESTClient" Plugin for Firefox with following > JSON String > > JSON String: > { > "deliverableName": {"value": "NAME_ABC"}, > "deliverableDescription": {"value": "DESC_ABC"}, > "deliGroup": { > "historyId": { "value": "1"}, > "deliGroupName": { "value": "Factored" } > } > } > > After removing the "deliGroup" part in DomainService class, and in the > JSON String, it was working. > { > "deliverableName": {"value": "NAME_ABC"}, > "deliverableDescription": {"value": "DESC_ABC"} > } > > How has the JSON String to look? > > > Or when I try to connect over RestEasy, how to pass the parameters? > > > DefaultHttpClient client = new DefaultHttpClient(); > UsernamePasswordCredentials credentials = new > UsernamePasswordCredentials("sven", "pass"); > client.getCredentialsProvider().setCredentials(new > AuthScope(AuthScope.ANY), credentials); > ClientExecutor executor = createAuthenticatingExecutor(client); > ClientRequest request = new ClientRequest(" > http://localhost:8080/restful/services/DeliverableService/actions/createNew/invoke > ",executor); > > How to set the right parameters to post deliverableName, > deliverableDescription and DeliGroup? > > ClientResponse<Deliverable> response = request.post(Deliverable.class); > > > Or are there other, better ways? > > Sorry about the stupid questions, but I think I miss something in my > knowledge. > > br > Andreas > > >
