cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: Basic authentication with Spring configured client
Date Thu, 09 Oct 2008 17:49:27 GMT
On Thursday 09 October 2008 1:46:34 pm Daniel Kulp wrote:
> Add a createdFromAPI="true" attribute to the jaxws:client element.
>
> With that attribute set to "true", the jaxws:client becomes a configuration
> element for a client that you create from the CXF (or jaxws) API's.
>
> Without that attribute, it's an actual spring object that you need to
> lookup from the context.

One more thing....  if you do the createdFromAPI, the "id" needs to change to 
the URL of the endpoint.   Basically, something like:

id="{http://the.name.space.com/blah}HelloPort" 
or similar so the runtime can match the config with the proxy you are 
creating.

Dan



>
> Dan
>
> On Wednesday 08 October 2008 6:04:49 pm Sagi Mann wrote:
> > could you pls post the init code of the client? I'm having the same
> > issue, I'm using CXF 2.1.2 (which should contain the fix) but I'm not
> > sure how to write the client code so it can properly use the cxf.xml.
> >
> > My cxf xml is:
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <beans xmlns="http://www.springframework.org/schema/beans"
> >         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >         xmlns:jaxws="http://cxf.apache.org/jaxws"
> >         xmlns:soap="http://cxf.apache.org/bindings/soap"
> >         xsi:schemaLocation="
> > http://www.springframework.org/schema/beans
> > http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
> > http://cxf.apache.org/bindings/soap
> > http://cxf.apache.org/schemas/configuration/soap.xsd
> > http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
> >
> >         <jaxws:client id="client1"
> >                 serviceClass="cxf.client.Hello"
> >                 address="http://mann2:8080/param-tester-ws/HelloService"
> >                 username="tester1" password="test"/>
> >
> > </beans>
> >
> > Note that I use the PORT class (Hello) as the serviceClass above. I'm not
> > sure if this is correct, but if I try to use the HelloService generated
> > class, I get an exception "HelloService is not an interface".
> >
> > My client code is:
> >
> >         SpringBusFactory bf = new SpringBusFactory();
> >         URL busFile = null;
> >         if ("secure".equals(args[1])) {
> >             busFile =
> > Hello_HelloImplPort_Client.class.getResource("/JaxwsSecureClient.xml");
> >         } else if ("insecure".equals(args[1])) {
> >             busFile =
> > Hello_HelloImplPort_Client.class.getResource("/InsecureClient.xml");
> >         } else {
> >             System.out.println("arg1 needs to be either secure or
> > insecure");
> >             System.exit(1);
> >         }
> >         Bus bus = bf.createBus(busFile.toString());
> >         bf.setDefaultBus(bus);
> >
> >         cxf.client.HelloService ss = new HelloService(wsdlURL,
> > SERVICE_NAME);
> >         cxf.client.Hello port = ss.getHelloPort();
> >         // invokations start here...
> >
> > thanks...



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

Mime
View raw message