I'm trying to invoke a RESTful web service that simply returns some
XML. It does not require an input message. (i.e., just a simple HTTP
GET request from a URL).
I tried invoking the Dispatch with a null message, but JAX-WS
complains. What is the right way to do this? Code below:
svc.addPort(portQName,
new URI(HTTPBinding.HTTP_BINDING),
"
http://localhost:8080/samples/getNewOrders");
Dispatch<Source> dis =
svc.createDispatch(portQName, Source.class,
Service.Mode.PAYLOAD);
Source result = dis.invoke(null);
The run time error that I get is:
javax.xml.ws.WebServiceException: No Message to Send to web service
at
com.sun.xml.ws.client.dispatch.DispatchBase.setupMessageStruct(DispatchBase.java:416)
at
com.sun.xml.ws.client.dispatch.DispatchBase.invoke(DispatchBase.java:127)
at samples.GetNewOrders.main(GetNewOrders.java:31)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.java:208)
at
org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:150)
at org.apache.tools.ant.taskdefs.Java.run(Java.java:443)
at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:163)
at org.apache.tools.ant.taskdefs.Java.execute(Java.java:108)
at org.apache.tools.ant.Task.perform(Task.java:341)
at org.apache.commons.jelly.tags.ant.AntTag.doTag(AntTag.java:185)
at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)
at
org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)
at
org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:233)
at com.werken.werkz.jelly.GoalTag$1.performAction(GoalTag.java:128)
at com.werken.werkz.jelly.GoalTag$1.performAction(GoalTag.java:122)
at com.werken.werkz.Goal.fire(Goal.java:639)
at com.werken.werkz.Goal.attain(Goal.java:575)
at
org.apache.maven.plugin.PluginManager.attainGoals(PluginManager.java:671)
at org.apache.maven.MavenSession.attainGoals(MavenSession.java:263)
at org.apache.maven.cli.App.doMain(App.java:488)
at org.apache.maven.cli.App.main(App.java:1239)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.werken.forehead.Forehead.run(Forehead.java:551)
at com.werken.forehead.Forehead.main(Forehead.java:581)