cxf servlet beside app servlet
hi all, i want to develop some webservice in my web application. i have 2 servlet configured in my web.xml file (Strurts Actoin Servlet, and a Ajax Servlet) in servlet mappings, i have : servlet-mapping servlet-nameajax-controller/servlet-name url-pattern*.jsh/url-pattern /servlet-mapping servlet-mapping servlet-namestruts-controller/servlet-name url-pattern*.sh/url-pattern /servlet-mapping i want to add CXF Servlet in this set, but i don't no how to specify url-pattern that don't conflict with other servlet mappings and how chose my endpoing service address any idea ? or any resource about this thanks all -- sincerely yours M. H. Shamsi
Re: cxf servlet beside app servlet
Am Sonntag, den 04.11.2007, 14:57 +0330 schrieb Mohammad Shamsi: hi all, i want to develop some webservice in my web application. i have 2 servlet configured in my web.xml file (Strurts Actoin Servlet, and a Ajax Servlet) in servlet mappings, i have : servlet-mapping servlet-nameajax-controller/servlet-name url-pattern*.jsh/url-pattern /servlet-mapping servlet-mapping servlet-namestruts-controller/servlet-name url-pattern*.sh/url-pattern /servlet-mapping i want to add CXF Servlet in this set, but i don't no how to specify url-pattern that don't conflict with other servlet mappings and how chose my endpoing service address any idea ? or any resource about this Yup. You'll just need a third servlet mapping. web.xml: http://www.jroller.com/gmazza/date/20071019#step7 cxf-servlet.xml: http://www.jroller.com/gmazza/date/20071019#step8 (You'll need both) How the two files above work to create your endpoint address: http://www.jroller.com/gmazza/date/20071019#notes (point 4) HTH, Glen thanks all
Re: cxf servlet beside app servlet
Hi Glen Thanks, its work. On 11/4/07, Glen Mazza [EMAIL PROTECTED] wrote: Am Sonntag, den 04.11.2007, 14:57 +0330 schrieb Mohammad Shamsi: hi all, i want to develop some webservice in my web application. i have 2 servlet configured in my web.xml file (Strurts Actoin Servlet, and a Ajax Servlet) in servlet mappings, i have : servlet-mapping servlet-nameajax-controller/servlet-name url-pattern*.jsh/url-pattern /servlet-mapping servlet-mapping servlet-namestruts-controller/servlet-name url-pattern*.sh/url-pattern /servlet-mapping i want to add CXF Servlet in this set, but i don't no how to specify url-pattern that don't conflict with other servlet mappings and how chose my endpoing service address any idea ? or any resource about this Yup. You'll just need a third servlet mapping. web.xml: http://www.jroller.com/gmazza/date/20071019#step7 cxf-servlet.xml: http://www.jroller.com/gmazza/date/20071019#step8 (You'll need both) How the two files above work to create your endpoint address: http://www.jroller.com/gmazza/date/20071019#notes (point 4) HTH, Glen thanks all -- sincerely yours M. H. Shamsi
other spring cxf resources ?
Hi All, I have a spring based Java EE application, this application destirbuted on 9 servers, i want to add a Web Service to this application, i want now how to call these 9 servers web service with a client ? i read spring cxf sample, client part of this sample in beans.xml are somthing like this : bean id=client class=demo.spring.HelloWorldImpl factory-bean=clientFactory factory-method=create/ bean id=clientFactory class= org.apache.cxf.jaxws.JaxWsProxyFactoryBean property name=serviceClass value=demo.spring.HelloWorld/ property name=address value= http://localhost:8080/cxf/wscxf/HelloWorld/ /bean with this guide, i have to define 9 bean like this client bean and 9 clientFactory bean. is there any simpler way to do this? -- sincerely yours M. H. Shamsi
Re: other spring cxf resources ?
Do you have a WSDL? Just follow the links I gave. That fact that you have 9 servers or 900 shouldn't matter--the URL in the WSDL would be the same for all the servers your app is distributed on (just as it is the same for your web application as a whole, correct?) Glen Am Sonntag, den 04.11.2007, 21:42 +0330 schrieb Mohammad Shamsi: Hi All, I have a spring based Java EE application, this application destirbuted on 9 servers, i want to add a Web Service to this application, i want now how to call these 9 servers web service with a client ? i read spring cxf sample, client part of this sample in beans.xml are somthing like this : bean id=client class=demo.spring.HelloWorldImpl factory-bean=clientFactory factory-method=create/ bean id=clientFactory class= org.apache.cxf.jaxws.JaxWsProxyFactoryBean property name=serviceClass value=demo.spring.HelloWorld/ property name=address value= http://localhost:8080/cxf/wscxf/HelloWorld/ /bean with this guide, i have to define 9 bean like this client bean and 9 clientFactory bean. is there any simpler way to do this?
Re: other spring cxf resources ?
Hi Glen, Sorry, my application is not really a distributed app. i just run it on 9 servers, all 9 server connect to one database, but they are work standalone. and they don't know about each other. for some reason i wan't to collect some info from each app server and show them together in one client. Service in all 9 Server is same, but at least in URL, they are deferent. http://server1:port/MyService http://server2:port2/MyService http://server3:port3/MyService . . . On 11/4/07, Glen Mazza [EMAIL PROTECTED] wrote: Do you have a WSDL? Just follow the links I gave. That fact that you have 9 servers or 900 shouldn't matter--the URL in the WSDL would be the same for all the servers your app is distributed on (just as it is the same for your web application as a whole, correct?) Glen Am Sonntag, den 04.11.2007, 21:42 +0330 schrieb Mohammad Shamsi: Hi All, I have a spring based Java EE application, this application destirbuted on 9 servers, i want to add a Web Service to this application, i want now how to call these 9 servers web service with a client ? i read spring cxf sample, client part of this sample in beans.xmlare somthing like this : bean id=client class=demo.spring.HelloWorldImpl factory-bean=clientFactory factory-method=create/ bean id=clientFactory class= org.apache.cxf.jaxws.JaxWsProxyFactoryBean property name=serviceClass value=demo.spring.HelloWorld/ property name=address value= http://localhost:8080/cxf/wscxf/HelloWorld/ /bean with this guide, i have to define 9 bean like this client bean and 9 clientFactory bean. is there any simpler way to do this? -- sincerely yours M. H. Shamsi
Mulitple protocols on one IMPL?
Hi, Is it possible to have multiple protocols on a single running instance of an IMPL in CXF? Or do I need to start two seperate instances? For example, ServiceA running soap/http and ServiceA running JMS. This questions applies to standalone server and spring deployments. _ Help yourself to FREE treats served up daily at the Messenger Café. Stop by today. http://www.cafemessenger.com/info/info_sweetstuff2.html?ocid=TXT_TAGLM_OctWLtagline
ClientFactoryBean AbstractMethodError
I have been trying to get a REST service up and running. I believe the server is up. However, creating the client is problematic. Using the following code borrowed from the bundled rest sample: JaxWsProxyFactoryBean sf = new JaxWsProxyFactoryBean(); sf.setServiceClass(MyServiceInterface.class); // Turn off wrapped mode to make our xml prettier sf.getServiceFactory().setWrapped(false); // Use the HTTP Binding which understands the Java Rest Annotations sf.getClientFactoryBean().setBindingId(HttpBindingFactory.HTTP_BINDING_ID); sf.setAddress(http://localhost:8080/rest/;); this.service = (MyServiceInterface) sf.create(); I receive the following exception: java.lang.AbstractMethodError: org.apache.xerces.dom.DocumentImpl.getInputEncoding()Ljava/lang/String; 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:597) at org.apache.ws.commons.schema.utils.DOMUtil.getInputEncoding(DOMUtil.java:594) at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:348) at org.apache.cxf.databinding.source.AbstractDataBinding.addSchemaDocument(AbstractDataBinding.java:73) at org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:224) at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBean.java:293) at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:333) at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:151) at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:93) at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:74) at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:51) at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:89) at com.foo.bar.RestTest.injectDependencies(RestTest.java:30) at org.springframework.test.AbstractDependencyInjectionSpringContextTests.prepareTestInstance(AbstractDependencyInjectionSpringContextTests.java:158) at org.springframework.test.AbstractSingleSpringContextTests.setUp(AbstractSingleSpringContextTests.java:88) at junit.framework.TestCase.runBare(TestCase.java:125) at org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:69) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) I read a post regarding a similar error due to the XmlSchema version. However, after checking, I do have the 1.3.2 version specified in that post (http://www.nabble.com/wsdl2java-problem-tf4651922.html#a13290874). Anyone have any other ideas? Thanks.
RE: Gzip encoding
Hi Shaw, you can configure your client side interceptors using feature. An example can be found from dispatch system test: \trunk\systests\src\test\java\org\apache\cxf\systest\dispatch\TestDispatchFeature.java and client-config.xml. Cheers, Jervis -Original Message- From: Daniel Kulp [mailto:[EMAIL PROTECTED] Sent: 2007?11?3? 1:43 To: cxf-user@incubator.apache.org Cc: Shaw, Richard A Subject: Re: Gzip encoding Hmm... not really sure how to add it to the dispatch style suff via spring. Interesting. That said, bus level might make sense if the interceptor was updated to handle the case where it's not gzip as well. Basically, Accept-Encoding is a hint and the server may not respond in gzip form. Thus, the interceptor should check the request header and if the headers don't say it's gzipped, skip it. The interceptor may also need to reset the Message.CONTENT_TYPE and Message.ENCODING properties. Not really sure though. Dan On Friday 02 November 2007, Shaw, Richard A wrote: In reply to my previous message I can see that there is an example interceptor to GZIP. I've copied this but now I don't know how to add it to my dispatch call. The example adds it to the bus, but I have other services on the bus which are not using GZIP. I've found an example that adds it to a jaxws:client but it needs a serviceClass and I don't have one because I'm using the dispatch interface. Can anybody help. Ideally I'd like to add it to my spring config. But if I have to add it to my code I can live with that to get it working. Thanks Richard Shaw ¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø¤º°`°º¤ ø,¸¸,ø¤ Richard Shaw Technical Design Authority - Information Solutions Consultancy Intelligent Transport Systems Atkins Highways and Transportation Woodcote Grove, Ashley Road, Epsom, Surrey, KT18 5BW Tel: +44 (0) 1372 756407 Fax: +44 (0) 1372 740055 Mob: 07740 817586 E-mail: [EMAIL PROTECTED] www.atkinsglobal.com/its -Original Message- From: Shaw, Richard A [mailto:[EMAIL PROTECTED] Sent: 02 November 2007 11:23 To: cxf-user@incubator.apache.org Subject: Gzip encoding I'm using the dispatch interface to request data from a web service which returns the data in gzip format. Can CXF handle this ? I've set the Accept-Encoding to gzip and can see the compressed data being received (using Ethereal) but I get the following error - org.apache.cxf.interceptor.Fault: Unable to create envelope from given source: at org.apache.cxf.jaxws.interceptors.DispatchInInterceptor.handleMessage( DispatchInInterceptor.java:114) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseIntercepto rChain.java:147) at org.apache.cxf.jaxws.DispatchImpl.onMessage(DispatchImpl.java:259) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleRe sponse(HTTPConduit.java:1825) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.doClose( HTTPConduit.java:1690) at org.apache.cxf.io.AbstractCachedOutputStream.close(AbstractCachedOutpu tStream.java:114) at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66 ) at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndin gInterceptor.handleMessage(MessageSenderInterceptor.java:62) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseIntercepto rChain.java:147) at org.apache.cxf.jaxws.DispatchImpl.invoke(DispatchImpl.java:146) at org.apache.cxf.jaxws.DispatchImpl.invoke(DispatchImpl.java:104) at com.atkinsglobal.mosaic.datafetch.DataFetchUtils.test(DataFetchUtils.j ava:120) at com.atkinsglobal.mosaic.datafetch.PollDataFetchServer.main(PollDataFet chServer.java:24) Caused by: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Unable to create envelope from given source: at com.sun.xml.messaging.saaj.soap.EnvelopeFactory.createEnvelope(Envelop eFactory.java:114) at com.sun.xml.messaging.saaj.soap.ver1_1.SOAPPart1_1Impl.createEnvelopeF romSource(SOAPPart1_1Impl.java:71) at com.sun.xml.messaging.saaj.soap.SOAPPartImpl.getEnvelope(SOAPPartImpl. java:125) at com.sun.xml.messaging.saaj.soap.MessageImpl.getSOAPBody(MessageImpl.ja va:1237) at org.apache.cxf.jaxws.interceptors.DispatchInInterceptor.handleMessage( DispatchInInterceptor.java:89) ... 12 more Caused by: javax.xml.transform.TransformerException: org.xml.sax.SAXParseException: Content is not allowed in prolog. at org.apache.xalan.transformer.TransformerIdentityImpl.transform(Transfo rmerIdentityImpl.java:501) at com.sun.xml.messaging.saaj.util.transform.EfficientStreamingTransforme r.transform(EfficientStreamingTransformer.java:390) at com.sun.xml.messaging.saaj.soap.EnvelopeFactory.createEnvelope(Envelop eFactory.java:102) ... 16 more Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog. at
RE: ClientFactoryBean AbstractMethodError
I probabaly should remove JAX-WS style client codes from restful_http_binding demo, as it constantly causes confusions. In theory, JAX-WS style client APIs should work with RESTful services that published using CXF HTTP binding, as this is symmetric to what the server side has to do to marshal/unmarshal request/response. But in reality, this does not work because a). This JAX-WS style client APIs support is not completed yet. b). I don't think there will be much value added by supporting JAX-WS style client APIs. This JAX-WS style client APIs wont work without a WSDL, most RESTful services wont have a WSDL. More comments about client side REST API support can be found in [1]. [1]. http://www.nabble.com/Using-verbs-other-than-GET-from-a-RESTful-client-application-tf4628659.html Cheers, Jervis -Original Message- From: Todd Orr [mailto:[EMAIL PROTECTED] Sent: 2007?11?5? 10:41 To: cxf-user@incubator.apache.org Subject: ClientFactoryBean AbstractMethodError I have been trying to get a REST service up and running. I believe the server is up. However, creating the client is problematic. Using the following code borrowed from the bundled rest sample: JaxWsProxyFactoryBean sf = new JaxWsProxyFactoryBean(); sf.setServiceClass(MyServiceInterface.class); // Turn off wrapped mode to make our xml prettier sf.getServiceFactory().setWrapped(false); // Use the HTTP Binding which understands the Java Rest Annotations sf.getClientFactoryBean().setBindingId(HttpBindingFactory.HTTP _BINDING_ID); sf.setAddress(http://localhost:8080/rest/;); this.service = (MyServiceInterface) sf.create(); I receive the following exception: java.lang.AbstractMethodError: org.apache.xerces.dom.DocumentImpl.getInputEncoding()Ljava/lan g/String; 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:597) at org.apache.ws.commons.schema.utils.DOMUtil.getInputEncoding(DO MUtil.java:594) at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchem aCollection.java:348) at org.apache.cxf.databinding.source.AbstractDataBinding.addSchem aDocument(AbstractDataBinding.java:73) at org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding .java:224) at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.bu ildServiceFromClass(ReflectionServiceFactoryBean.java:293) at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.in itializeServiceModel(ReflectionServiceFactoryBean.java:333) at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.cr eate(ReflectionServiceFactoryBean.java:151) at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(Ja xWsServiceFactoryBean.java:93) at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.creat eEndpoint(AbstractWSDLBasedEndpointFactory.java:74) at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactory Bean.java:51) at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientPr oxyFactoryBean.java:89) at com.foo.bar.RestTest.injectDependencies(RestTest.java:30) at org.springframework.test.AbstractDependencyInjectionSpringCont extTests.prepareTestInstance(AbstractDependencyInjectionSpring ContextTests.java:158) at org.springframework.test.AbstractSingleSpringContextTests.setU p(AbstractSingleSpringContextTests.java:88) at junit.framework.TestCase.runBare(TestCase.java:125) at org.springframework.test.ConditionalTestCase.runBare(Condition alTestCase.java:69) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReferen ce.run(JUnit3TestReference.java:130) 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) I read a post regarding a similar error due to the XmlSchema version. However, after checking, I do have the 1.3.2 version specified in that post
Re: other spring cxf resources ?
Hi Mohammad, I had a similar problem when I wanted to provide fail safe operation and load balancing to servers that do not run in a cluster. My solution is simply running the services with soap/jms. The JMS Server (e.g. ActiveMQ) has to run on two servers to provide fail safe operation. It does not need a cluster. Each of your services should then simply use the same jms queue. This way they will be automatically load balanced and if a server goes down the others will take over. If you need to access all servers at once you can instead use a topic and the servers could answer on a topic. I already am thinking about using this behaviour for system management. Best regards, Christian Mohammad Shamsi schrieb: Hi Glen, Sorry, my application is not really a distributed app. i just run it on 9 servers, all 9 server connect to one database, but they are work standalone. and they don't know about each other. for some reason i wan't to collect some info from each app server and show them together in one client. Service in all 9 Server is same, but at least in URL, they are deferent. http://server1:port/MyService http://server2:port2/MyService http://server3:port3/MyService . . . On 11/4/07, Glen Mazza [EMAIL PROTECTED] wrote: Do you have a WSDL? Just follow the links I gave. That fact that you have 9 servers or 900 shouldn't matter--the URL in the WSDL would be the same for all the servers your app is distributed on (just as it is the same for your web application as a whole, correct?) Glen Am Sonntag, den 04.11.2007, 21:42 +0330 schrieb Mohammad Shamsi: Hi All, I have a spring based Java EE application, this application destirbuted on 9 servers, i want to add a Web Service to this application, i want now how to call these 9 servers web service with a client ? i read spring cxf sample, client part of this sample in beans.xmlare somthing like this : bean id=client class=demo.spring.HelloWorldImpl factory-bean=clientFactory factory-method=create/ bean id=clientFactory class= org.apache.cxf.jaxws.JaxWsProxyFactoryBean property name=serviceClass value=demo.spring.HelloWorld/ property name=address value= http://localhost:8080/cxf/wscxf/HelloWorld/ /bean with this guide, i have to define 9 bean like this client bean and 9 clientFactory bean. is there any simpler way to do this? -- Christian Schneider --- http://www.liquid-reality.de