cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Monica Ferrero <MFerr...@accelrys.com>
Subject RE: Configuring streaming web services: error on the call to invoke
Date Thu, 25 Jun 2009 13:29:03 GMT
JDK6

I'll try to send you something later on today that you can play with.

Thanks,

Monica

-----Original Message-----
From: Daniel Kulp [mailto:dkulp@apache.org]
Sent: 24 June 2009 22:25
To: users@cxf.apache.org
Cc: Monica Ferrero
Subject: Re: Configuring streaming web services: error on the call to invoke


Wow.  That's a bizzare situation.  Not sure what would cause that.   Hmm...
What JDK version are you using?

My gut feeling is to make sure there isn't ANY versions of the Source classes
in any jar.   Just use the versions that are built into the JDK.   If that's
the case, them I have NO idea.

Anychance of getting a simple project that might show the issue?

Dan




On Tue June 23 2009 2:09:32 pm Monica Ferrero wrote:
> Hi again,
>
> After playing with a smaller prototype and following a number of red
> herrings in the class loading area, the real problem turn out to be a bit
> different.
>
> I hadn't put it in the sample code I sent in my first post to simplify, but
> the web service implementation class is transactional like shown below, so
> it can access the middle tier database.
>
> With the full version of the prototype class (all the comments out), I get
> the error message as before. With the comments in, it works fine...
>
> Being transactional has never been an issue for the other web services we
> have that follow the SEI model. Is this a known limitation for streaming
> web services with CXF? Is there a workaround?
>
> Thanks a lot for your help,
>
> Monica
>
>
> package prototype;
>
> import java.io.Reader;
> import java.io.StringReader;
>
> //import javax.persistence.EntityManager;
> //import javax.persistence.PersistenceContext;
> import javax.xml.transform.Source;
> import javax.xml.transform.stream.StreamSource;
> import javax.xml.ws.Provider;
> import javax.xml.ws.Service;
> import javax.xml.ws.ServiceMode;
> import javax.xml.ws.WebServiceProvider;
>
> //import org.springframework.transaction.annotation.Transactional;
>
>
> //@Transactional
> @WebServiceProvider(portName="PrototypeProviderPort",
>         serviceName="PrototypeProviderService",
>         targetNamespace="http://prototype.streaming.com/")
> @ServiceMode(value=Service.Mode.PAYLOAD)
> public class PrototypeStreamingWS implements Provider<Source>{
>
>    public PrototypeStreamingWS(){
>    }
>
> //    @PersistenceContext
> //    private EntityManager manager;
>
>     @Override
>     public Source invoke( Source request ){
>         System.out.println( "PrototypeStreamingWS: CALL INVOKE" );
> //      DatasourceBean ds = getDataSource( 1 );
>         Reader reader = new StringReader(
>                         "<soapenv:Envelope
> xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" " +
> "xmlns:prot=\"http://prototype.streaming.com/\">" +
> "<soapenv:Header/><soapenv:Body><prot:prototypeStreamingResponse>"
+
> "<prot:presentation>Hi, I'm the streaming ws PrototypeStreamingWS. DS
> Name:" + //ds.getDatasource() +
>                             "</prot:presentation>" +
>
> "</prot:prototypeStreamingResponse></soapenv:Body></soapenv:Envelope>"
);
> StreamSource response = new StreamSource( reader );
>         return response;
>     }
>
> //    private DatasourceBean getDataSource( int dsId ){
> //        return manager.find( DatasourceBean.class, dsId );
> //    }
> }
>
>
> -----Original Message-----
> From: Monica Ferrero [mailto:MFerrero@accelrys.com]
> Sent: 23 June 2009 12:00
> To: users@cxf.apache.org; Daniel Kulp
> Subject: RE: Configuring streaming web services: error on the call to
> invoke
>
> Hi!
>
> I have migrated to 2.2.2 and changed my implementation to implement
> Provider<Source> instead
>
> public class PresentationServiceProviderImpl implements Provider<Source>{
>
>     public Source invoke( Source request ){
>
> but that has just moved the error to the new signature.
>
> I'll have to check *again* for class loading issues :( or try to work with
> a smaller example and see if I can pin it down...
>
> Thanks for the help,
>
>
> Monica
>
>
> org.apache.cxf.interceptor.Fault: object is not an instance of declaring
> class while invoking public javax.xml.transform.Source
> com.accelrys.lmqs.presentationservice.PresentationServiceProviderImpl.invok
>e(javax.xml.transform.Source) with params
> [javax.xml.transform.dom.DOMSource@127c743]. at
> org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.
>java:152) at
> org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.createFault(AbstractJAXWSMe
>thodInvoker.java:83) at
> org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:
>126) at
> org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:55)
> at
> org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:
>68) at
> org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerIn
>terceptor.java:57) [snip]
>         at java.lang.Thread.run(Thread.java:619)
> Caused by: java.lang.IllegalArgumentException: object is not an instance of
> declaring class at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method) at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:3
>9) at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp
>l.java:25) at java.lang.reflect.Method.invoke(Method.java:597)
>         at
> org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractIn
>voker.java:166) at
> org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:
>82) ... 66 more
>
> -----Original Message-----
> From: Monica Ferrero [mailto:MFerrero@accelrys.com]
> Sent: 22 June 2009 21:49
> To: Daniel Kulp; users@cxf.apache.org
> Subject: RE: Configuring streaming web services: error on the call to
> invoke
>
> Thanks for the quick and helpful reply Dan.
>
> I've had a look and there were a couple of extra copies of the StreamSource
> class running around. I have removed those jars now but I'm still seeing
> the same error. :( Pretty sure now that there is no more versions of it
> around as I've checked every jar.
>
> I have downloaded 2.2.2 and I'm in the process of migrating. Hopefully that
> will help,
>
> Monica
>
> -----Original Message-----
> From: Daniel Kulp [mailto:dkulp@apache.org]
> Sent: 22 June 2009 19:48
> To: users@cxf.apache.org
> Cc: Monica Ferrero
> Subject: Re: Configuring streaming web services: error on the call to
> invoke
>
>
> Well, two thoughts:
>
> 1)
>
> > org.apache.cxf.interceptor.Fault: object is not an instance of declaring
> > class while invoking public javax.xml.transform.stream.StreamSource
> > com.aaa.bbb.presentationservice.PresentationServiceProviderImpl.invoke(ja
> >va x.xml.transform.stream.StreamSource) with params
> > [javax.xml.transform.stream.StreamSource@1f4a05d]. at
>
> This SOUNDS like a classloader issuer as it sounds like the "StreamSource"
> class being passed in is different than the StreamSource that is expected.
> I'd look at classpaths and such and make sure their aren't multiple sources
> of StreamSource classes.
>
> 2)  Until you move up to 2.2.1 or 2.2.2, you aren't going to benefit from
> using a StreamSource anyway.  In fact, it will be really problematic as it
> will go stream -> stax -> DOM -> stream for incoming and stream -> DOM ->
> stax -> stream on the outgoing.      For 2.2.2, the incoming stays the
> same, but the outgoing will go directly stream -> stax -> stream.    For
> 2.2.2, I'd suggest changing the sig to just:
> Provider<Source>
> and you will end up with a DOMSource on the way in, and you can return a
> StreamSource.
>
> Dan
>
> On Mon June 22 2009 1:50:40 pm Monica Ferrero wrote:
> > Hello,
> >
> > I'm trying to change one of our web services to a streaming web service
> > as it can generate quite a lot of data back. My prototype implementation
> > looks something like this:
> >
> > import javax.xml.stream.XMLStreamReader;
> > import javax.xml.transform.stream.StreamSource;
> > import javax.xml.ws.Provider;
> > import javax.xml.ws.Service;
> > import javax.xml.ws.ServiceMode;
> > import javax.xml.ws.WebServiceProvider;
> >
> > @WebServiceProvider(portName="PresentationServiceProviderPort",
> >         serviceName="PresentationServiceProviderService",
> >         targetNamespace="http://streamingps.bbb.aaa.com/")
> > @ServiceMode(value=Service.Mode.PAYLOAD)
> > public class PresentationServiceProviderImpl implements
> > Provider<StreamSource>{
> >
> >     public PresentationServiceProviderImpl(){
> >     }
> >
> >     @Override
> >     public StreamSource invoke( StreamSource request ){
> >
> >         Map<String, String> parameters = parseRequest( request );
> >         ResultsReader reader = new ResultsReader();
> >         //Set the reader with the info from request
> >         [snip]
> >         StreamSource response = new StreamSource( reader );
> >         return response;
> >     }
> >
> > WSDL file looks something like this:
> >
> > <?xml version="1.0" encoding="utf-8"?>
> > <?xml-stylesheet href="wsdlformatter-doc-lit.xsl" type="text/xsl"?>
> > <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> >                   xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> >                   xmlns:ps="http://streamingps.bbb.aaa.com/"
> >                   xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> >                   name="PresentationServiceProviderService"
> >                   targetNamespace="http://streamingps.bbb.aaa.com/">
> >
> > <!-- TYPES -->
> >     <wsdl:types>
> >         <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> >                    xmlns:ps="http://streamingps.bbb.aaa.com/"
> >                    attributeFormDefault="unqualified"
> >                    elementFormDefault="qualified"
> >                    targetNamespace="http://streamingps.bbb.aaa.com/">
> >
> >             [SNIP]
> >             <xs:element name="streamingQB" type="ps:streamingQB"/>
> >             <xs:complexType name="streamingQB">
> >                 <xs:sequence>
> >                     <xs:element minOccurs="1" maxOccurs="1"
> > name="queryDefinition" type="xs:string" /> [SNIP]
> >                 </xs:sequence>
> >             </xs:complexType>
> >
> >             <xs:element name="streamingQBResponse"
> > type="ps:streamingQBResponse"/> <xs:complexType
> > name="streamingQBResponse"> <xs:sequence>
> >                     <xs:element minOccurs="0" name="Presentation"
> > type="xs:string"/> </xs:sequence>
> >             </xs:complexType>
> >         </xs:schema>
> >     </wsdl:types>
> >
> > <!-- MESSAGES  -->
> >     <wsdl:message name="streamingQB">
> >         <wsdl:part element="ps:streamingQB" name="parameters"/>
> >     </wsdl:message>
> >     <wsdl:message name="streamingQBResponse">
> >         <wsdl:part element="ps:streamingQBResponse" name="parameters"/>
> >     </wsdl:message>
> >
> > <!-- PORT TYPE OPERATIONS -->
> >     <wsdl:portType name="PresentationServiceProvider">
> >         <wsdl:operation name="streamingQB">
> >             <wsdl:input message="ps:streamingQB" name="streamingQB"/>
> >             <wsdl:output message="ps:streamingQBResponse"
> > name="streamingQBResponse"/> <wsdl:fault
> > message="ps:PresentationServiceException" name="fault"/>
> > </wsdl:operation> </wsdl:portType>
> >
> > <!-- BINDING OPERATIONS -->
> >     <wsdl:binding name="PresentationServiceProviderServiceSoapBinding"
> > type="ps:PresentationServiceProvider"> <soap:binding style="document"
> > transport="http://schemas.xmlsoap.org/soap/http"/> <wsdl:operation
> > name="streamingQB">
> >             <soap:operation soapAction="" style="document"/>
> >             <wsdl:input name="streamingQB"><soap:body
> > use="literal"/></wsdl:input> <wsdl:output
> > name="streamingQBResponse"><soap:body use="literal"/></wsdl:output>
> > <wsdl:fault name="fault"><soap:fault name="fault"
> > use="literal"/></wsdl:fault> </wsdl:operation>
> >      </wsdl:binding>
> >
> > <!-- WEB SERVICE -->
> >     <wsdl:service name="PresentationServiceProviderService">
> >         <wsdl:port
> > binding="ps:PresentationServiceProviderServiceSoapBinding"
> > name="PresentationServiceProviderPort"> <soap:address
> > location="http://localhost:9944/services/ws/PresentationServiceProvider"/
> >> </wsdl:port>
> >     </wsdl:service>
> >
> > </wsdl:definitions>
> >
> >
> > In the beans.xml for the Spring configuration I've tried a number of
> > things, but it looks like this currently:
> >
> >     <jaxws:endpoint id="PresentationServiceProvider"
> >     implementor="#presentationProviderService"
> >     endpointName="e:PresentationServiceProviderPort"
> >     serviceName="s:PresentationServiceProviderService"
> >     address="/PresentationServiceProvider"
> >     xmlns:e="http://service.jaxws.cxf.apache.org/endpoint"
> >     xmlns:s="http://service.jaxws.cxf.apache.org/service"/>
> >
> >
> > This is the error I get:
> >
> > 22-Jun-2009 17:02:49 org.apache.cxf.interceptor.LoggingInInterceptor
> > logging INFO: Inbound Message
> > ----------------------------
> > Encoding: UTF-8
> > Headers: {content-type=[text/xml;charset=UTF-8], Max-Forwards=[10],
> > host=[localhost:9944], Authorization=[Basic xxx], content-length=[908],
> > X-AuthenticatedUser=[mferrero], SOAPAction=[""], user-agent=[Jakarta
> > Commons-HttpClient/3.0.1], X-AuthenticatedSID=[xxx]} Messages:
> > Message:
> >
> > Payload: <soapenv:Envelope
> > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> > xmlns:str="http://streamingps.bbb.aaa.com/">
> >    <soapenv:Header/>
> >    <soapenv:Body>
> >       <str:streamingQB>
> >          <str:queryDefinition><![CDATA[--query--]]></str:queryDefinition>
> >          <str:datasourceId>1</str:datasourceId>
> >       </str:streamingQB>
> >    </soapenv:Body>
> > </soapenv:Envelope>
> > --------------------------------------
> > 22-Jun-2009 17:02:49 org.apache.cxf.phase.PhaseInterceptorChain
> > doIntercept INFO: Application has thrown exception, unwinding now
> > org.apache.cxf.interceptor.Fault: object is not an instance of declaring
> > class while invoking public javax.xml.transform.stream.StreamSource
> > com.aaa.bbb.presentationservice.PresentationServiceProviderImpl.invoke(ja
> >va x.xml.transform.stream.StreamSource) with params
> > [javax.xml.transform.stream.StreamSource@1f4a05d]. at
> > org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoke
> >r. java:112) at
> > org.apache.cxf.jaxws.JAXWSMethodInvoker.createFault(JAXWSMethodInvoker.ja
> >va
> >
> >:86) at
> >
> > org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.jav
> >a: 104) at
> > org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:11
> >0) at
> > org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.jav
> >a: 68) at
> > org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvoker
> >In terceptor.java:56) at
> > org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.
> >ja va:37) at
> > org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(Servic
> >eI nvokerInterceptor.java:92) at
> > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorCh
> >ai n.java:221) at
> > org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiatio
> >nO bserver.java:77) at
> > org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestina
> >ti on.java:92) at
> > org.apache.cxf.transport.servlet.ServletController.invokeDestination(Serv
> >le tController.java:214) at
> > org.apache.cxf.transport.servlet.ServletController.invoke(ServletControll
> >er .java:151) at
> > org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFSer
> >vl et.java:170) at
> > org.apache.cxf.transport.servlet.AbstractCXFServlet.doPost(AbstractCXFSer
> >vl et.java:148) [snip]
> >                 at java.lang.Thread.run(Thread.java:619)
> > Caused by: java.lang.IllegalArgumentException: object is not an instance
> > of declaring class at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> > Method) at
> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java
> >:3 9) at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorI
> >mp l.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at
> > org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(Abstract
> >In voker.java:127) at
> > org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.jav
> >a: 82) ... 63 more
> >
> > It seems to me that something is wrong with the configuration and that
> > somehow CXF is processing the message instead of passing it to the low
> > level provider. Is there anything else I need to do to configure a
> > Provider? I've struggle to find information/examples in Nabble or the
> > website. At the moment we are running CXF 2.0.6.
> >
> > Thanks a lot for your help,
> >
> > Monica
> >
> > ________________________________
> > Accelrys Limited (http://accelrys.com)
> > Registered office: 334 Cambridge Science Park, Cambridge, CB4 0WN, UK
> > Registered in England: 2326316
>
> --
> Daniel Kulp
> dkulp@apache.org
> http://www.dankulp.com/blog
>
> Accelrys Limited (http://accelrys.com)
> Registered office: 334 Cambridge Science Park, Cambridge, CB4 0WN, UK
> Registered in England: 2326316
>
> Accelrys Limited (http://accelrys.com)
> Registered office: 334 Cambridge Science Park, Cambridge, CB4 0WN, UK
> Registered in England: 2326316
>
> Accelrys Limited (http://accelrys.com)
> Registered office: 334 Cambridge Science Park, Cambridge, CB4 0WN, UK
> Registered in England: 2326316

--
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

Accelrys Limited (http://accelrys.com)
Registered office: 334 Cambridge Science Park, Cambridge, CB4 0WN, UK
Registered in England: 2326316

Mime
View raw message