0

The function shown below is a stub of a Service operation implemented in WCF Data Services, it accepts a string parameter and returns a string as well, how do I call this operation and read the returned string value back?, thank you.

[WebGet]
public string vMobile_FinishExport(string RouteCode);

I tried this

consumer.getEntities("vMobile_FinishExport?RouteCode='AA'").execute();

and it works without any problems, but I could'nt get through to read the returned string. The code samples I have gone through only shows reading entities and property values.

Thank you.

2 Answers2

0

Can you try below code , its working without any problem...

//printNameis the service operation method name
//"XYZ" is the passing parameter

OFunctionRequest<OObject> oFunctionRequest = oDataJerseyConsumer.callFunction("printName");
oFunctionRequest = oFunctionRequest.pString("printName", "XYZ");
Enumerable<OObject> s = oFunctionRequest.execute();
System.out.println(s.elementAt(0));
0

Use ODataConsumer#callFunction [1] to make a function call instead of getEntities.

Hope that helps,
- john

[1] http://odata4j.googlecode.com/hg-history/0.5/odata4j-core/doc/javadoc/org/odata4j/consumer/ODataConsumer.html#callFunction(java.lang.String)

John Spurlock
  • 1,723
  • 1
  • 13
  • 12