JB,

I've tried that, but it doesn't work.
Firstly, you've put the busCfg on the provider, shouldn't it be on the consumer for my situation (users of the web service exposed by the ESB need to provide credentials; the ESB does not need to provide credentials to call the wrapped web service)?
I've tried on both, and it doesn't make any difference.

My xbean.xml looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns:cxfbc="http://servicemix.apache.org/cxfbc/1.0 </exchweb/bin/redir.asp?URL=http://thebarns.gti.co.uk/Exchweb/bin/redir.asp?URL=http://servicemix.apache.org/cxfbc/1.0>" xmlns:tns="http://spudsoft.co.uk/ </exchweb/bin/redir.asp?URL=http://thebarns.gti.co.uk/Exchweb/bin/redir.asp?URL=http://spudsoft.co.uk/>" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/ </exchweb/bin/redir.asp?URL=http://thebarns.gti.co.uk/Exchweb/bin/redir.asp?URL=http://schemas.xmlsoap.org/wsdl/>"
      >
 <cxfbc:consumer
                  wsdl="classpath:/wsdl/MathsServiceConcrete.wsdl"
                  targetEndpoint="Bob"
                  endpoint="MathsService"
                  service="tns:MathsServiceService"
                  targetService="tns:MathsServiceService"
                  targetInterface="tns:MathsService"
locationURI="http://0.0.0.0:9009/Bob/MathsServiceService/MathsService </exchweb/bin/redir.asp?URL=http://thebarns.gti.co.uk/Exchweb/bin/redir.asp?URL=http://0.0.0.0:9009/Bob/MathsServiceService/MathsService>"
                  busCfg="basicAuth.xml"
                  >
 </cxfbc:consumer>
 <cxfbc:provider
                  wsdl="classpath:/wsdl/MathsServiceConcrete.wsdl"
locationURI="http://192.168.1.184:8080/MathsServiceService/MathsService </exchweb/bin/redir.asp?URL=http://thebarns.gti.co.uk/Exchweb/bin/redir.asp?URL=http://192.168.1.184:8080/MathsServiceService/MathsService>"
                  service="tns:MathsServiceService"
                  endpoint="Bob"
                  >
 </cxfbc:provider>
</beans>

and my basicAuth.xml looks like this:
<?xml version="1.0" encoding="utf-8"?>
<beans xmlns="http://www.springframework.org/schema/beans </exchweb/bin/redir.asp?URL=http://thebarns.gti.co.uk/Exchweb/bin/redir.asp?URL=http://www.springframework.org/schema/beans>" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance </exchweb/bin/redir.asp?URL=http://thebarns.gti.co.uk/Exchweb/bin/redir.asp?URL=http://www.w3.org/2001/XMLSchema-instance>" xmlns:sec="http://cxf.apache.org/configuration/security </exchweb/bin/redir.asp?URL=http://thebarns.gti.co.uk/Exchweb/bin/redir.asp?URL=http://cxf.apache.org/configuration/security>" xmlns:http="http://cxf.apache.org/transports/http/configuration </exchweb/bin/redir.asp?URL=http://thebarns.gti.co.uk/Exchweb/bin/redir.asp?URL=http://cxf.apache.org/transports/http/configuration>" xmlns:jaxws="http://java.sun.com/xml/ns/jaxws </exchweb/bin/redir.asp?URL=http://thebarns.gti.co.uk/Exchweb/bin/redir.asp?URL=http://java.sun.com/xml/ns/jaxws>"
      xsi:schemaLocation="
http://cxf.apache.org/configuration/security </exchweb/bin/redir.asp?URL=http://thebarns.gti.co.uk/Exchweb/bin/redir.asp?URL=http://cxf.apache.org/configuration/security> http://cxf.apache.org/schemas/configuration/security.xsd </exchweb/bin/redir.asp?URL=http://thebarns.gti.co.uk/Exchweb/bin/redir.asp?URL=http://cxf.apache.org/schemas/configuration/security.xsd> http://cxf.apache.org/transports/http/configuration </exchweb/bin/redir.asp?URL=http://thebarns.gti.co.uk/Exchweb/bin/redir.asp?URL=http://cxf.apache.org/transports/http/configuration> http://cxf.apache.org/schemas/configuration/http-conf.xsd </exchweb/bin/redir.asp?URL=http://thebarns.gti.co.uk/Exchweb/bin/redir.asp?URL=http://cxf.apache.org/schemas/configuration/http-conf.xsd> http://www.springframework.org/schema/beans </exchweb/bin/redir.asp?URL=http://thebarns.gti.co.uk/Exchweb/bin/redir.asp?URL=http://www.springframework.org/schema/beans> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd </exchweb/bin/redir.asp?URL=http://thebarns.gti.co.uk/Exchweb/bin/redir.asp?URL=http://www.springframework.org/schema/beans/spring-beans-2.0.xsd>
                          ">
<http:conduit name="{http://spudsoft.co.uk/}MathsServicePort.http-conduit"; >
       <http:authorization>
           <sec:UserName>user</sec:UserName>
           <sec:Password>password</sec:Password>
       </http:authorization>
   </http:conduit>
</beans>

There is nothing relating to authentication in the WSDL.

I can access the web service at http://192.168.1.135:9009/Bob/MathsServiceService/MathsService </exchweb/bin/redir.asp?URL=http://thebarns.gti.co.uk/Exchweb/bin/redir.asp?URL=http://192.168.1.135:9009/Bob/MathsServiceService/MathsService> without providing any authentication (which is what I want to change).
The ESB is running on 192.168.1.135.

Jim


------------------------------------------------------------------------
*From:* Jean-Baptiste Onofré [mailto:[email protected]]
*Sent:* Wed 16/09/2009 07:43
*To:* [email protected]
*Subject:* Re: Basic Auth on a CXF-BC consumer

Hi Jim,

no you can add authentication by configuration via the busCfg attribute.

You can use a xbean.xml like this:

<cxfbc:provider wsdl="classpath:my.wsdl"
locationURI="http://0.0.0.0:8192/my </exchweb/bin/redir.asp?URL=http://thebarns.gti.co.uk/Exchweb/bin/redir.asp?URL=http://0.0.0.0:8192/my>"
       service="my"
       endpoint="endpoint"
       busCfg="basic_auth.xml"/>

where basic_auth.xml looks like:
<http:conduit>
       <http:authorization>
               <sec:UserName>user</sec:UserName>
               <sec:Password>password</sec:Password>
       </http:authorization>
</http:conduit>

Regards
JB

Jim Talbut wrote:
> Hi,
> > I need to proxy web services with an almost identical web service that offers additional facilities.
> One of the additional facilities is HTTP basic authentication.
> To try to be clear: the actual implementation of the web service has no authentication, but the web service used by clients must have it. > > I can't find any way to configure the CXF BC to do this. > The book Open Source ESBs in Action describes a code way to do it - is this the only option? > > Thanks > > Jim
>


Reply via email to