Hi Jim, all I can say is, that I was not able to unmarshal the anonymous
array containing a anonymous object returned from a POST to traverse/path.
All I got was a ArrayOutOfBounds exception (I used the
maven jersey-json dependency). Maybe just an issue with the combination of
Jersey and JAXB.

Normally this code should work:

GenericType<Collection<Traverse>> genericType = new
GenericType<Collection<Traverse>>() {};

        Collection<Traverse> ja = webResource.path("node/3/traverse/path")
                .accept(MediaType.APPLICATION_JSON)
                .type(MediaType.APPLICATION_JSON)
                .post(genericType, "{\"order\":\"depth first\", \"max
depth\": 1}");

for this JAXB Entity:

@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement
public class Traverse {
    public String start;
    . . .
}

And I did not get any answer from the Jersey users list.
Java.net is currently down once again :-( so I can not post the link to my
question.

Christopher


On Thu, Dec 30, 2010 at 5:15 PM, Jim Webber <j...@neotechnology.com> wrote:

> Hi Christoper, Peter,
>
> I wonder if this is some horrid coupling creeping in since AFAIK we also
> use Jackson for JSON production. Perhaps its own eccentricities are escaping
> our service boundary.
>
> Anyone know if Jackson is/isn't very compliant?
>
> Jim
>
> On 29 Dec 2010, at 23:41, Peter Neubauer wrote:
>
> > Very cool Christopher,
> > Tis looks like a perfect way to test the server. As we are considering
> > using more scale in at least our testing, we really should look into
> > this for easing web testing to start with! I guess Andres and Andreas
> > will be all over this after New Year :)
> >
> > /Peter
> >
> > On Wednesday, December 29, 2010, Christopher Schmidt
> > <fakod...@googlemail.com> wrote:
> >> I am answering my own thread here, just in case someone is interested...
> >>
> >> I solved my unmarshaling issue with Neo4j REST, JAXB and Jersey with
> using
> >> the Jackson JSON processor (http://jackson.codehaus.org/) instead of
> Jersey
> >> JSON.
> >>
> >> This makes it easy to write a POPO representation of Neo4j's REST
> *objects*.
> >> I implemented some of them (in Scala), see here:
> >>
> https://github.com/FaKod/SJersey/tree/master/src/test/scala/org/sjersey/test/json/neo4jstuff
> >>
> >> The usage is rather simple. I tested it with a *specs* test class here:
> >>
> https://github.com/FaKod/SJersey/blob/master/src/test/scala/org/sjersey/test/AccessTest.scala
> >>
> >> Although some idea files are checked in, it should be able to check it
> out
> >> with maven2 (pom.xml).
> >>
> >> I have written a blog post about this POC
> >> here<
> http://blog.fakod.eu/2010/12/10/yet-another-trya-rest-client-with-jersey-and-scala/
> >,
> >> as I said: Just in case someone is interested to use Scala, Jersey and
> the
> >> Neo4j REST server ;)
> >>
> >> Christopher
> >>
> >> On Wed, Dec 8, 2010 at 4:09 PM, Christopher Schmidt <
> fakod...@googlemail.com
> >>> wrote:
> >>
> >>> I have a little spare time ;-) and I try to create a/another "very
> smart"
> >>> REST client DSL in Scala.
> >>>
> >>> For testing and test data I am using the Neo4j Server from here:
> >>>
> http://blog.neo4j.org/2010/04/neo4j-rest-server-part1-get-it-going.html
> >>>
> >>> Client library is Jersey, JSON marshaling and unmarshaling lib is JAXB.
> The
> >>> current client Scala code is:
> >>>
> >>> rest {
> >>>         implicit s =>
> >>>         val traversalPath = "node/3/traverse/path".POST[JSONArray] <=
> >>> PathRequest(order = "depth first", max_depth = 4, uniqueness = "node
> path")
> >>>         println("Array length: " + traversalPath.length) // prints 2
> >>>       }
> >>>
> >>> The above JSONArray works fine, but if I use Java objects
> >>> (as XmlRootElement) I get unmarshaling exceptions. It would be helpful
> If
> >>> there is someone out there who already created some JAXB objects for
> >>> Neo4j...
> >>>
> >>> Christopher
> >>>
> >>>
> >>> On Wed, Dec 8, 2010 at 3:56 PM, Peter Neubauer <
> >>> peter.neuba...@neotechnology.com> wrote:
> >>>
> >>>> Christopher,
> >>>> are you trying to build your own server, or are you using Neo4j
> Server?
> >>>>
> >>>> The REST API is now part of the server component, we are right now
> >>>> defining a mechanism to mount your own server extensions without
> >>>> breaking the REST hypermedia of the existing API.
> >>>>
> >>>> What are you trying to do?
> >>>>
> >>>> Cheers,
> >>>>
> >>>> /peter neubauer
> >>>>
> >>>> GTalk:      neubauer.peter
> >>>> Skype       peter.neubauer
> >>>> Phone       +46 704 106975
> >>>> LinkedIn   http://www.linkedin.com/in/neubauer
> >>>> Twitter      http://twitter.com/peterneubauer
> >>>>
> >>>> http://www.neo4j.org               - Your high performance graph
> >>>> database.
> >>>> http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing
> party.
> >>>>
> >>>>
> >>>>
> >>>> On Wed, Dec 8, 2010 at 3:52 PM, Christopher Schmidt
> >>>> <fakod...@googlemail.com> wrote:
> >>>>> Hi all, is anyone using the REST interface and JAXB?
> >>>>>
> >>>>> I have some problems with the traversal response of POST call to
> >>>>> "/node/3/traverse/path" which returns:
> >>>>>
> >>>>> [ {
> >>>>>  "start" : "http://localhost:9999/node/3";,
> >>>>>  "nodes" : [ "http://localhost:9999/node/3";, "
> >>>> http://localhost:9999/node/1";
> >>>>> ],
> >>>>>  "length" : 1,
> >>>>>  "relationships" : [ "http://localhost:9999/relationship/6"; ],
> >>>>>  "end" : "http://localhost:9999/node/1";
> >>>>> }, {
> >>>>>  "start" : "http://localhost:9999/node/3";,
> >>>>>  "nodes" : [ "http://localhost:9999/node/3";, "
> >>>> http://localhost:9999/node/2";
> >>>>> ],
> >>>>>  "length" : 1,
> >>>>>  "relationships" : [ "http://localhost:9999/relationship/2"; ],
> >>>>>  "end" : "http://localhost:9999/node/2";
> >>> --
> >> Christopher
> >> twitter: @fakod
> >> blog: http://blog.fakod.eu
> >> _______________________________________________
> >> Neo4j mailing list
> >> User@lists.neo4j.org
> >> https://lists.neo4j.org/mailman/listinfo/user
> >>
> > _______________________________________________
> > Neo4j mailing list
> > User@lists.neo4j.org
> > https://lists.neo4j.org/mailman/listinfo/user
>
> _______________________________________________
> Neo4j mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>



-- 
Christopher
twitter: @fakod
blog: http://blog.fakod.eu
_______________________________________________
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to