Java Restful Client basic problem

Hi,

I am trying to evaluate the possibility to use OpenGamma as a standalone installation and interact with it using Java Rest Client. I installed the simulated sample from the source, and all is working fine. The UI is working, as well as simple rest queries from the browser like "http://localhost:8080/jax/components"and the like.
I am trying then to query the server from the jersey client sample provided:

_server = RemoteServer.create(“http://localhost:8080”);
PortfolioMaster portfolioMaster = _server.getPortfolioMaster();
PortfolioSearchRequest portSearchRequest = new PortfolioSearchRequest();
PortfolioSearchResult portSearchResult = portfolioMaster.search(portSearchRequest);

from there the portfolioMaster is always null and I get the following trace log:
(ToolContextUtils.java:121) - Unable to populate tool context ‘positionMaster’, no appropriate component found on the server
All the other context raise the same error.

Looking with a web proxy, the request is properly sent to the server
GET /jax/components HTTP/1.1
Content-Type: application/vnd.fudgemsg
Accept: application/vnd.fudgemsg
User-Agent: Java/1.7.0_45
Host: localhost:8080
Connection: keep-alive

And the response is properly sent back from the server:
HTTP/1.1 200 OK
Date: Sat, 11 Jul 2015 11:45:51 GMT
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Expires: Mon, 26 Jul 1997 05:00:00 GMT
Content-Type: application/vnd.fudgemsg
Transfer-Encoding: chunked
Server: Jetty(8.1.11.v20130520)

I could paste the JSON response content if that makes any sense.
Unfortunately debugging the Jersey Client and FudgeMsg receiver is very tedious since a lot of reflection is active there.

I am convinced that the Client Api built in OpenGamma is properly working and some straightforward problem is preventing the unmarshalling of the response. Somehow I can not spot it on.

Any help in getting this simple example would be very much appreciated.

Olivier

Hi again,

After a deeper investigation, I am still stuck with a communication problem with the Server.
Basically, I switch to Json message format, and the Json document received look OK to me :
[{“dupNamePsfxKey”:"_"},{“uri”:“components”,“infos”:{"":{“type”:“com.opengamma.master.config.ConfigMaster”,“classifier”:“central”,“uri”:"/jax/components/ConfigMaster/central",“attributes”:{“level”:“1”,“remoteClientJava”:“com.opengamma.master.config.impl.RemoteConfigMaster”,“uniqueIdScheme”:“DbCfg”}},“null_1”:{“type”:“com.opengamma.master.exchange.ExchangeMaster”,“classifier”:“central”,“uri”:"/jax/components/ExchangeMaster/central",“attributes”:{“level”:“1”,“remoteClientJava”:“com.opengamma.master.exchange.impl.RemoteExchangeMaster”,“uniqueIdScheme”:“DbExg”}},

,“null_58”:{“type”:“com.opengamma.financial.depgraph.provider.DependencyGraphTraceProvider”,“classifier”:“main”,“uri”:"/jax/components/DependencyGraphTraceProvider/main",“attributes”:{“level”:“1”,“remoteClientJava”:“com.opengamma.financial.depgraph.provider.RemoteDependencyGraphTraceProvider”}}},“0”:“com.opengamma.component.ComponentServer”,“null_1”:“org.joda.beans.impl.direct.DirectBean”}]

And when going in the debugger it seems that the ComponentServer can not be unmarshalled because there is no “uri” field. Where apparently there is one. And as a consequence the exception thrown is :
org.fudgemsg.FudgeRuntimeContextException: Unable to create class com.opengamma.component.ComponentServer from FudgeMsg[0: => com.opengamma.component.ComponentServer, infos => FudgeMsg[ => FudgeMsg[classifier => central, attributes => FudgeMsg[level => 1, remoteClientJava => com.opengamma.master.config.impl.RemoteConfigMaster, uniqueIdScheme => DbCfg]]]]
at org.fudgemsg.mapping.FudgeDeserializer.fudgeMsgToObject(FudgeDeserializer.java:283) ~[fudge-java-0.3.9.12.jar:0.3.9.12]
Caused by: java.lang.IllegalArgumentException: Argument ‘uri’ must not be null
at org.joda.beans.JodaBeanUtils.notNull(JodaBeanUtils.java:291) ~[joda-beans-0.7.1.jar:0.7.1]
at com.opengamma.component.ComponentServer.validate(ComponentServer.java:181) ~[og-component-2.1.0.jar:2.1.0]

If any body has succeeded in having this use case to work, a simple snippet or sample would really help in having this proof of concept working.

Thanks a lot!
Olivier

I will continue my monologue, this forum doesnt seem quite active but for the sake of closing this topic, I will add a comment that have found the origin of my problem.
I was using mvn exec:java plugin, which was somehow pertubating the class loader that is used to introspect the unmarshallers.
running a java command line with all the dependencies, fixed my problem.

Olivier