You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Glen Mazza <gl...@verizon.net> on 2007/09/18 13:11:16 UTC

Using a spring-configured web service client from Java code

Hello, for a Spring-defined web service client as shown here:

http://cwiki.apache.org/confluence/display/CXF20DOC/Client+HTTP
+Transport#ClientHTTPTransport-Example

Does anyone know of a simple Java Program that calls a bean like this?

As far as I can see, the documentation gives us half the story, i.e.,
how to configure a client using Spring, but not the other half--how to
activate this bean from a Java program.

I'll update the documentation if someone can provide me information on
this.

Thanks,
Glen



Re: Using a spring-configured web service client from Java code

Posted by Daniel Kulp <dk...@apache.org>.
FYI:

The ws_addressing sample we ship does have a client.xml spring config to 
configure the a few things on the client side including the 
http-conduit.

Dan


On Tuesday 18 September 2007, Glen Mazza wrote:
> Thanks...it just occurred to me to Google an example, this one (which
> uses a CXF sample) looks not too bad: 
> http://preview.tinyurl.com/2vkrjr
>
> Glen
>
> Am Dienstag, den 18.09.2007, 07:16 -0400 schrieb Benson Margulies:
> > Something like the following? It's isn't CXF, but it's from the main
> > function of a plain old java command line that uses Spring to set up
> > some things.
> >
> > GenericApplicationContext appContext = new
> > GenericApplicationContext();
> >
> > XmlBeanDefinitionReader reader = new
> > XmlBeanDefinitionReader(appContext);
> >
> > reader.loadBeanDefinitions(new
> > ClassPathResource("META-INF/applicationContext.xml"));
> >
> >
> >
> > BrightPlanetHarvestDocumentSource source =
> > (BrightPlanetHarvestDocumentSource) applicationContext
> >                 .getBean("documentSource");
> >
> > > -----Original Message-----
> > > From: Glen Mazza [mailto:glen.mazza@verizon.net]
> > > Sent: Tuesday, September 18, 2007 7:11 AM
> > > To: cxf-user@incubator.apache.org
> > > Subject: Using a spring-configured web service client from Java
> > > code
> > >
> > > Hello, for a Spring-defined web service client as shown here:
> > >
> > > http://cwiki.apache.org/confluence/display/CXF20DOC/Client+HTTP
> > > +Transport#ClientHTTPTransport-Example
> > >
> > > Does anyone know of a simple Java Program that calls a bean like
> > > this?
> > >
> > > As far as I can see, the documentation gives us half the story,
> > > i.e., how to configure a client using Spring, but not the other
> > > half--how to activate this bean from a Java program.
> > >
> > > I'll update the documentation if someone can provide me
> > > information on this.
> > >
> > > Thanks,
> > > Glen



-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog

RE: Using a spring-configured web service client from Java code

Posted by Glen Mazza <gl...@verizon.net>.
Thanks...it just occurred to me to Google an example, this one (which
uses a CXF sample) looks not too bad:  http://preview.tinyurl.com/2vkrjr

Glen

Am Dienstag, den 18.09.2007, 07:16 -0400 schrieb Benson Margulies:
> Something like the following? It's isn't CXF, but it's from the main
> function of a plain old java command line that uses Spring to set up
> some things.
> 
> GenericApplicationContext appContext = new GenericApplicationContext();
> 
> XmlBeanDefinitionReader reader = new
> XmlBeanDefinitionReader(appContext);
> 
> reader.loadBeanDefinitions(new
> ClassPathResource("META-INF/applicationContext.xml"));
> 
> 
> 
> BrightPlanetHarvestDocumentSource source =
> (BrightPlanetHarvestDocumentSource) applicationContext
>                 .getBean("documentSource");
> 
> 
> 
> > -----Original Message-----
> > From: Glen Mazza [mailto:glen.mazza@verizon.net]
> > Sent: Tuesday, September 18, 2007 7:11 AM
> > To: cxf-user@incubator.apache.org
> > Subject: Using a spring-configured web service client from Java code
> > 
> > Hello, for a Spring-defined web service client as shown here:
> > 
> > http://cwiki.apache.org/confluence/display/CXF20DOC/Client+HTTP
> > +Transport#ClientHTTPTransport-Example
> > 
> > Does anyone know of a simple Java Program that calls a bean like this?
> > 
> > As far as I can see, the documentation gives us half the story, i.e.,
> > how to configure a client using Spring, but not the other half--how to
> > activate this bean from a Java program.
> > 
> > I'll update the documentation if someone can provide me information on
> > this.
> > 
> > Thanks,
> > Glen
> > 
> 


RE: Using a spring-configured web service client from Java code

Posted by Benson Margulies <bi...@basistech.com>.
Something like the following? It's isn't CXF, but it's from the main
function of a plain old java command line that uses Spring to set up
some things.

GenericApplicationContext appContext = new GenericApplicationContext();

XmlBeanDefinitionReader reader = new
XmlBeanDefinitionReader(appContext);

reader.loadBeanDefinitions(new
ClassPathResource("META-INF/applicationContext.xml"));



BrightPlanetHarvestDocumentSource source =
(BrightPlanetHarvestDocumentSource) applicationContext
                .getBean("documentSource");



> -----Original Message-----
> From: Glen Mazza [mailto:glen.mazza@verizon.net]
> Sent: Tuesday, September 18, 2007 7:11 AM
> To: cxf-user@incubator.apache.org
> Subject: Using a spring-configured web service client from Java code
> 
> Hello, for a Spring-defined web service client as shown here:
> 
> http://cwiki.apache.org/confluence/display/CXF20DOC/Client+HTTP
> +Transport#ClientHTTPTransport-Example
> 
> Does anyone know of a simple Java Program that calls a bean like this?
> 
> As far as I can see, the documentation gives us half the story, i.e.,
> how to configure a client using Spring, but not the other half--how to
> activate this bean from a Java program.
> 
> I'll update the documentation if someone can provide me information on
> this.
> 
> Thanks,
> Glen
>