You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Erik Nijkamp <Er...@de.ibm.com> on 2007/10/23 23:10:43 UTC
how to: cxf + rest + JaxWsProxyFactoryBean + multiple parameters
Hello folks,
currently I'm trying to setup a restful web service using cxf and spring.
The service itself is working smoothly, but the client is only working
for methods with 1 argument.
Here come's the interesting stuff:
@WebService
public interface ITestService {
@Get @HttpResource(location="/two/{first}/{second}")
String two(@WebParam(name = "first") String name,
@WebParam(name = "second") String
name2) throws Exception;
}
<jaxws:endpoint implementor="com.ibm.ors.services.test.TestService"
address="http://localhost:8090/test"
bindingUri="http://apache.org/cxf/binding/http">
<jaxws:serviceFactory>
<bean
class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean" />
</jaxws:serviceFactory>
</jaxws:endpoint>
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.setServiceClass(ITestService.class);
factory.setBindingId(HttpBindingFactory.HTTP_BINDING_ID);
factory.setAddress("http://localhost:8090/test/");
ITestService client = (ITestService) factory.create();
System.out.println(client.two("1", "2"));
org.apache.cxf.binding.xml.XMLFault: Invalid URL/Verb combination. Verb:
GET Path: /two/
at
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:142)
at $Proxy18.two(Unknown Source)
at
com.ibm.ors.test.RestClientTest.runClient(RestClientTest.java:46)
at
com.ibm.ors.test.RestClientTest.main(RestClientTest.java:21)
Throwable thrown: Invalid URL/Verb combination. Verb: GET Path: /two/
Invoking two(...) directly using the url is working just fine.
I guess (hope) somebody is using a method with more than one argument ...
mit freundlichen Grüßen | kind regards
Erik Nijkamp
Erik Nijkamp
Business Computing
Mobile: +49-(0)160 2153796
Kst: 6807 | GBS: 10178-80
IBM Ausbildung Berlin
Karl-Liebknecht-Straße 29
D-10178 Berlin
University Education Berlin / IBM Germany
Human Resources, IBM Sales & Distribution
IBM Deutschland GmbH
Vorsitzender des Aufsichtsrats: Hans Ulrich Maerki
Geschäftsführung: Martin Jetter (Vorsitzender), Rudolf Bauer, Christian
Diedrich,
Christoph Grandpierre, Matthias Hartmann, Andreas Kerstan
Sitz der Gesellschaft: Stuttgart
Registergericht: Amtsgericht Stuttgart, HRB 14562
WEEE-Reg.-Nr. DE 99369940
Re: how to: cxf + rest + JaxWsProxyFactoryBean + multiple
parameters
Posted by Jervis Liu <je...@iona.com>.
Eoghan raised a similar question last week regarding client side support for
RESTful services[1]. The best way to summarize current status is as below:
a). We do not support using JAX-WS client proxy APIs (i.e., the
javax.xml.ws.Service package) to access RESTful services. Some simple stuff
might just happen to work, but I would presume most things wont work (eg,
your case...).
b). You can use JAX-WS Dispatch APIs to access RESTful services, this should
work. An example can be find from restful_dispatch demo.
Actually I wont recommend you ever giving JAX-WS client proxy APIs a try. A
RESTful service that is exposed using CXF HTTP binding happens to have a
WSDL contract, as internally we can always use CXF simple frontend to do a
Java-to-WSDL generation. However most RESTful services simply wont have a
WSDL. A more general JAVA client side API is needed to be defined, but it
simply not there yet. There is a discussion in JSR-311 group on this topic
[2] , the consensus reached there is that a REST client API can be helpful,
but it is a bit early to form such API, more experiments are needed.
[1]
http://www.nabble.com/Using-verbs-other-than-GET-from-a-RESTful-client-application-tf4628659.html
[2] https://jsr311.dev.java.net/servlets/ReadMsg?list=dev&msgNo=716
Cheers,
Jervis
Erik Nijkamp-2 wrote:
>
> By the way wrapped mode does not fix the problem ...
>
> mit freundlichen Grüßen | kind regards
>
> Erik Nijkamp
>
>
>
>
> Erik Nijkamp
> Business Computing
> Mobile: +49-(0)160 2153796
> Kst: 6807 | GBS: 10178-80
>
> IBM Ausbildung Berlin
> Karl-Liebknecht-Straße 29
> D-10178 Berlin
> University Education Berlin / IBM Germany
> Human Resources, IBM Sales & Distribution
>
> IBM Deutschland GmbH
> Vorsitzender des Aufsichtsrats: Hans Ulrich Maerki
> Geschäftsführung: Martin Jetter (Vorsitzender), Rudolf Bauer, Christian
> Diedrich,
> Christoph Grandpierre, Matthias Hartmann, Andreas Kerstan
> Sitz der Gesellschaft: Stuttgart
> Registergericht: Amtsgericht Stuttgart, HRB 14562
> WEEE-Reg.-Nr. DE 99369940
>
>
>
>
>
>
> Erik Nijkamp/Germany/IBM@IBMDE
> 23.10.2007 14:10
> Please respond to
> cxf-user@incubator.apache.org
>
>
> To
> cxf-user@incubator.apache.org
> cc
>
> Subject
> how to: cxf + rest + JaxWsProxyFactoryBean + multiple parameters
>
>
>
>
>
>
>
> Hello folks,
>
> currently I'm trying to setup a restful web service using cxf and spring.
> The service itself is working smoothly, but the client is only working
> for methods with 1 argument.
>
> Here come's the interesting stuff:
>
> @WebService
> public interface ITestService {
> @Get @HttpResource(location="/two/{first}/{second}")
> String two(@WebParam(name = "first") String name,
> @WebParam(name = "second") String
> name2) throws Exception;
>
>
> }
>
>
> <jaxws:endpoint implementor="com.ibm.ors.services.test.TestService"
> address="http://localhost:8090/test"
> bindingUri="http://apache.org/cxf/binding/http">
> <jaxws:serviceFactory>
> <bean
> class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean" />
> </jaxws:serviceFactory>
> </jaxws:endpoint>
>
>
>
> JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
> factory.setServiceClass(ITestService.class);
> factory.setBindingId(HttpBindingFactory.HTTP_BINDING_ID);
> factory.setAddress("http://localhost:8090/test/");
> ITestService client = (ITestService) factory.create();
> System.out.println(client.two("1", "2"));
>
>
> org.apache.cxf.binding.xml.XMLFault: Invalid URL/Verb combination. Verb:
> GET Path: /two/
> at
> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:142)
> at $Proxy18.two(Unknown Source)
> at
> com.ibm.ors.test.RestClientTest.runClient(RestClientTest.java:46)
> at
> com.ibm.ors.test.RestClientTest.main(RestClientTest.java:21)
> Throwable thrown: Invalid URL/Verb combination. Verb: GET Path: /two/
>
> Invoking two(...) directly using the url is working just fine.
> I guess (hope) somebody is using a method with more than one argument ...
>
> mit freundlichen Grüßen | kind regards
>
> Erik Nijkamp
>
>
>
>
> Erik Nijkamp
> Business Computing
> Mobile: +49-(0)160 2153796
> Kst: 6807 | GBS: 10178-80
>
> IBM Ausbildung Berlin
> Karl-Liebknecht-Straße 29
> D-10178 Berlin
> University Education Berlin / IBM Germany
> Human Resources, IBM Sales & Distribution
>
> IBM Deutschland GmbH
> Vorsitzender des Aufsichtsrats: Hans Ulrich Maerki
> Geschäftsführung: Martin Jetter (Vorsitzender), Rudolf Bauer, Christian
> Diedrich,
> Christoph Grandpierre, Matthias Hartmann, Andreas Kerstan
> Sitz der Gesellschaft: Stuttgart
> Registergericht: Amtsgericht Stuttgart, HRB 14562
> WEEE-Reg.-Nr. DE 99369940
>
>
>
>
--
View this message in context: http://www.nabble.com/how-to%3A-cxf-%2B-rest-%2B-JaxWsProxyFactoryBean-%2B-multiple-parameters-tf4680403.html#a13379302
Sent from the cxf-user mailing list archive at Nabble.com.
Re: how to: cxf + rest + JaxWsProxyFactoryBean + multiple parameters
Posted by Erik Nijkamp <Er...@de.ibm.com>.
By the way wrapped mode does not fix the problem ...
mit freundlichen Grüßen | kind regards
Erik Nijkamp
Erik Nijkamp
Business Computing
Mobile: +49-(0)160 2153796
Kst: 6807 | GBS: 10178-80
IBM Ausbildung Berlin
Karl-Liebknecht-Straße 29
D-10178 Berlin
University Education Berlin / IBM Germany
Human Resources, IBM Sales & Distribution
IBM Deutschland GmbH
Vorsitzender des Aufsichtsrats: Hans Ulrich Maerki
Geschäftsführung: Martin Jetter (Vorsitzender), Rudolf Bauer, Christian
Diedrich,
Christoph Grandpierre, Matthias Hartmann, Andreas Kerstan
Sitz der Gesellschaft: Stuttgart
Registergericht: Amtsgericht Stuttgart, HRB 14562
WEEE-Reg.-Nr. DE 99369940
Erik Nijkamp/Germany/IBM@IBMDE
23.10.2007 14:10
Please respond to
cxf-user@incubator.apache.org
To
cxf-user@incubator.apache.org
cc
Subject
how to: cxf + rest + JaxWsProxyFactoryBean + multiple parameters
Hello folks,
currently I'm trying to setup a restful web service using cxf and spring.
The service itself is working smoothly, but the client is only working
for methods with 1 argument.
Here come's the interesting stuff:
@WebService
public interface ITestService {
@Get @HttpResource(location="/two/{first}/{second}")
String two(@WebParam(name = "first") String name,
@WebParam(name = "second") String
name2) throws Exception;
}
<jaxws:endpoint implementor="com.ibm.ors.services.test.TestService"
address="http://localhost:8090/test"
bindingUri="http://apache.org/cxf/binding/http">
<jaxws:serviceFactory>
<bean
class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean" />
</jaxws:serviceFactory>
</jaxws:endpoint>
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.setServiceClass(ITestService.class);
factory.setBindingId(HttpBindingFactory.HTTP_BINDING_ID);
factory.setAddress("http://localhost:8090/test/");
ITestService client = (ITestService) factory.create();
System.out.println(client.two("1", "2"));
org.apache.cxf.binding.xml.XMLFault: Invalid URL/Verb combination. Verb:
GET Path: /two/
at
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:142)
at $Proxy18.two(Unknown Source)
at
com.ibm.ors.test.RestClientTest.runClient(RestClientTest.java:46)
at
com.ibm.ors.test.RestClientTest.main(RestClientTest.java:21)
Throwable thrown: Invalid URL/Verb combination. Verb: GET Path: /two/
Invoking two(...) directly using the url is working just fine.
I guess (hope) somebody is using a method with more than one argument ...
mit freundlichen Grüßen | kind regards
Erik Nijkamp
Erik Nijkamp
Business Computing
Mobile: +49-(0)160 2153796
Kst: 6807 | GBS: 10178-80
IBM Ausbildung Berlin
Karl-Liebknecht-Straße 29
D-10178 Berlin
University Education Berlin / IBM Germany
Human Resources, IBM Sales & Distribution
IBM Deutschland GmbH
Vorsitzender des Aufsichtsrats: Hans Ulrich Maerki
Geschäftsführung: Martin Jetter (Vorsitzender), Rudolf Bauer, Christian
Diedrich,
Christoph Grandpierre, Matthias Hartmann, Andreas Kerstan
Sitz der Gesellschaft: Stuttgart
Registergericht: Amtsgericht Stuttgart, HRB 14562
WEEE-Reg.-Nr. DE 99369940