Jervis,
Thanks for your reply.
The interface code is as follows:
package com.fm.services;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.jws.WebResult;
import org.codehaus.jra.Get;
import org.codehaus.jra.HttpResource;
import java.util.List;
@WebService
public interface IService
{
@Get
@HttpResource(location="/images/{searchString}")
@WebResult(name = "result")
public List<Image> doService(@WebParam(name="searchString")
String
searchString);
}
The implementation class is as follows:
package com.fm.services;
public class ServiceImpl implements IService
{
public List<Image> doSearch(String searchString)
{
List<Image> results = new ArrayList<Image>();
// Populate the results
return results;
}
}
If I change the List<Image> to a List<String>, I see the same exception from
my client. The rest invocation from a browser returns the correct values
though.
Thanks
Sriram
Liu, Jervis wrote:
>
> Could you please paste out your com.fm.services.ServiceImpl and
> com.fm.services.IService code? I noticed that client.doService("foo")
> returns a List<Image>. Not sure what your code looks like, but this might
> be the place where the problem comes from.
>
> Cheers,
> Jervis
>
>> -----Original Message-----
>> From: Sric [mailto:[EMAIL PROTECTED]
>> Sent: 2007年8月23日 7:43
>> To: [email protected]
>> Subject: Restful Service client exception
>>
>>
>>
>> I have successfully deployed a Restful service using CXF.
>> I couldn’t use the jaxws Spring schema extension tags to
>> define my services
>> owing to the http://cxf.apache.org/schemas/jaxws.xsd schema
>> not found error.
>> I declared the service with standard Spring bean tags using
>> the following
>> snippet:
>>
>> <bean id="JaxWsServerFactoryBean-Service-XML"
>>
>> class="org.apache.cxf.jaxws.JaxWsServerFactoryBean"
>> init-method="create">
>> <property name="bindingId"
>> value="http://apache.org/cxf/binding/http" />
>> <property name="address" value="/xml/myservice/" />
>> <property name="serviceClass"
>> value="com.fm.services.IService" />
>> <property name="serviceBean">
>> <bean class="com.fm.services.ServiceImpl" />
>> </property>
>> </bean>
>>
>> The service deploys fine and I can verify that it works from
>> a browser.
>>
>> I am attempting to develop a client for this service along
>> the lines of the
>> MainClient in the restful_http_binding example with the 2.0.1
>> distribution.
>> My client looks like the following:
>>
>> JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
>> factory.setServiceClass(IService.class);
>>
>> factory.getClientFactoryBean().setBindingId(HttpBindingFactory
>> .HTTP_BINDING_ID);
>>
>> factory.setAddress("http://server:8080/myapp/services/xml/myse
>> rvice/");
>> IServiceclient = (IService)factory.create();
>> List<Image> retVals = client.doService("foo");
>>
>> The client proxy is getting created fine, however at the
>> invocation of the
>> service I see the following exception. The problem seems to
>> arise from the
>> fact that the verb returned from the
>> URIMapper/BindingOperationInfo is null.
>> Ulimately, I wish to be able to inject this client via Spring. I’d
>> appreciate your ideas/information on overcoming this issue.
>>
>> Thanks
>> Sriram
>>
>>
>> Aug 22, 2007 3:48:47 PM
>> org.apache.cxf.service.factory.ReflectionServiceFactoryBean
>> buildServiceFromClass
>> INFO: Creating Service {http://search.services.fm.com/}
>> IServicefrom class
>> com.fm.services.IService
>> Aug 22, 2007 3:48:47 PM
>> org.apache.cxf.binding.http.strategy.JRAStrategy map
>> INFO: Mapping method doService to resource
>> /images/{searchString} and verb
>> GET
>> Aug 22, 2007 3:48:49 PM org.apache.cxf.phase.PhaseInterceptorChain
>> doIntercept
>> INFO: Interceptor has thrown exception, unwinding now
>> java.lang.NullPointerException
>> at
>> org.apache.cxf.binding.http.interceptor.DatabindingOutSetupInt
>> erceptor.handleMessage(DatabindingOutSetupInterceptor.java:77)
>> at
>> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseIn
>> terceptorChain.java:207)
>> at
>> org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:254)
>> at
>> org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:205)
>> at
>> org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
>> at
>> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.
>> java:135)
>> at $Proxy22.doService(Unknown Source)
>> at
>> com.fm.search.service.ClientTest.plainTest(ClientTest.java:49)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccess
>> orImpl.java:39)
>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMeth
>> odAccessorImpl.java:25)
>> at java.lang.reflect.Method.invoke(Method.java:585)
>> at
>> org.junit.internal.runners.TestMethodRunner.executeMethodBody(
>> TestMethodRunner.java:99)
>> at
>> org.junit.internal.runners.TestMethodRunner.runUnprotected(Tes
>> tMethodRunner.java:81)
>> at
>> org.junit.internal.runners.BeforeAndAfterRunner.runProtected(B
>> eforeAndAfterRunner.java:34)
>> at
>> org.junit.internal.runners.TestMethodRunner.runMethod(TestMeth
>> odRunner.java:75)
>> at
>> org.junit.internal.runners.TestMethodRunner.run(TestMethodRunn
>> er.java:45)
>> at
>> org.junit.internal.runners.TestClassMethodsRunner.invokeTestMe
>> thod(TestClassMethodsRunner.java:66)
>> at
>> org.junit.internal.runners.TestClassMethodsRunner.run(TestClas
>> sMethodsRunner.java:35)
>> at
>> org.junit.internal.runners.TestClassRunner$1.runUnprotected(Te
>> stClassRunner.java:42)
>> at
>> org.junit.internal.runners.BeforeAndAfterRunner.runProtected(B
>> eforeAndAfterRunner.java:34)
>> at
>> org.junit.internal.runners.TestClassRunner.run(TestClassRunner
>> .java:52)
>> at
>> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run
>> (JUnit4TestReference.java:38)
>> at
>> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestEx
>> ecution.java:38)
>> at
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTest
>> s(RemoteTestRunner.java:460)
>> at
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTest
>> s(RemoteTestRunner.java:673)
>> at
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(Rem
>> oteTestRunner.java:386)
>> at
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(Re
>> moteTestRunner.java:196)
>> javax.xml.ws.http.HTTPException
>> at
>> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.
>> java:147)
>> at $Proxy22.doSearch(Unknown Source)
>> at
>> com.fm.search.service.ClientTest.plainTest(ClientTest.java:49)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccess
>> orImpl.java:39)
>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMeth
>> odAccessorImpl.java:25)
>> at java.lang.reflect.Method.invoke(Method.java:585)
>> at
>> org.junit.internal.runners.TestMethodRunner.executeMethodBody(
>> TestMethodRunner.java:99)
>> at
>> org.junit.internal.runners.TestMethodRunner.runUnprotected(Tes
>> tMethodRunner.java:81)
>> at
>> org.junit.internal.runners.BeforeAndAfterRunner.runProtected(B
>> eforeAndAfterRunner.java:34)
>> at
>> org.junit.internal.runners.TestMethodRunner.runMethod(TestMeth
>> odRunner.java:75)
>> at
>> org.junit.internal.runners.TestMethodRunner.run(TestMethodRunn
>> er.java:45)
>> at
>> org.junit.internal.runners.TestClassMethodsRunner.invokeTestMe
>> thod(TestClassMethodsRunner.java:66)
>> at
>> org.junit.internal.runners.TestClassMethodsRunner.run(TestClas
>> sMethodsRunner.java:35)
>> at
>> org.junit.internal.runners.TestClassRunner$1.runUnprotected(Te
>> stClassRunner.java:42)
>> at
>> org.junit.internal.runners.BeforeAndAfterRunner.runProtected(B
>> eforeAndAfterRunner.java:34)
>> at
>> org.junit.internal.runners.TestClassRunner.run(TestClassRunner
>> .java:52)
>> at
>> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run
>> (JUnit4TestReference.java:38)
>> at
>> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestEx
>> ecution.java:38)
>> at
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTest
>> s(RemoteTestRunner.java:460)
>> at
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTest
>> s(RemoteTestRunner.java:673)
>> at
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(Rem
>> oteTestRunner.java:386)
>> at
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(Re
>> moteTestRunner.java:196)
>> Caused by: java.lang.NullPointerException
>> at
>> org.apache.cxf.binding.http.interceptor.DatabindingOutSetupInt
>> erceptor.handleMessage(DatabindingOutSetupInterceptor.java:77)
>> at
>> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseIn
>> terceptorChain.java:207)
>> at
>> org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:254)
>> at
>> org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:205)
>> at
>> org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
>> at
>> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.
>> java:135)
>> ... 22 more
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Restful-Service-client-exception-tf43146
> 88.html#a12285030
> Sent from the cxf-user mailing list archive at Nabble.com.
>
> ----------------------------
> IONA Technologies PLC (registered in Ireland)
> Registered Number: 171387
> Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
>
>
--
View this message in context:
http://www.nabble.com/Restful-Service-client-exception-tf4314688.html#a12295667
Sent from the cxf-user mailing list archive at Nabble.com.