|
View:
New views
6 Messages
—
Rating Filter:
Alert me
|
|
|
Not yet success with CXF and http basic authentication - would need help from people more knowledgeable on CXF and Mule internalsHi all,
based on the article on http://chrisdail.com/2008/03/31/apache-cxf-with-http-basic-authentication/ I tried to get CXF to authenticate with http basic authentication, but as far as I can tell - stumbled in the part where CXF would need to challenge the requester. Since Mule has CXF version 2.0.4 and SoapHeaderInterceptor is not available untill 2.0.5, I had to take it from 2.0.6 distribution to my own project. So far what I have in code, configuration and in logs is: In the client: //Create Service PermissionApplicationService_Service service = new PermissionApplicationService_Service(); //create proxy PermissionApplicationService port = service.getPermissionApplicationServiceImplPort(); ((BindingProvider)port).getRequestContext().put( BindingProvider.USERNAME_PROPERTY, "ross"); ((BindingProvider)port).getRequestContext().put( BindingProvider.PASSWORD_PROPERTY, "ross"); System.out.println(port.sayHi("jee")); Client is created with wsimport and in above code the username and password is set to the client. The mule configuration: <model name="permissionApplication"> <service name="PermAppUMO"> <inbound> <cxf:inbound-endpoint address="http://localhost:63081/hello" synchronous="true" > <cxf:inInterceptors> <spring:bean class="fi.helsinki.muledemo.services.BasicAuthAuthorizationInterceptor" /> </cxf:inInterceptors> </cxf:inbound-endpoint> </inbound> <component class="fi.helsinki.muledemo.services.PermissionApplicationServiceImpl" /> </service> </model> The interceptor just like in the post, with some debugging code added. In the interceptor's handleMessage method: AuthorizationPolicy policy = message.get(AuthorizationPolicy.class); logger.info("Go through message"); Set<Entry<String,Object>> entryset = message.entrySet(); Iterator i = entryset.iterator(); while(i.hasNext()){ Entry e = (Entry) i.next(); String key = (String) e.getKey(); Object value = e.getValue(); logger.info("message, key + balue " + key + " " + value); } Since there is no policy set, the intention is to loop through message to see what is set there. Thus in the log is following: INFO 2008-05-18 16:00:37,684 [connector.http.0.receiver.3] fi.helsinki.muledemo.services.EchoComponent: Go through message INFO 2008-05-18 16:00:37,684 [connector.http.0.receiver.3] fi.helsinki.muledemo.services.EchoComponent: message, key + balue javax.xml.ws.wsdl.port {http://services.muledemo.helsinki.fi/}PermissionApplicationServiceImplPort INFO 2008-05-18 16:00:37,684 [connector.http.0.receiver.3] fi.helsinki.muledemo.services.EchoComponent: message, key + balue org.apache.cxf.service.model.MessageInfo org.apache.cxf.service.model.MessageInfo@5b25daf5 INFO 2008-05-18 16:00:37,684 [connector.http.0.receiver.3] fi.helsinki.muledemo.services.EchoComponent: message, key + balue org.apache.cxf.transport.local.LocalConduit.directDispatch true INFO 2008-05-18 16:00:37,684 [connector.http.0.receiver.3] fi.helsinki.muledemo.services.EchoComponent: message, key + balue javax.xml.ws.wsdl.service {http://services.muledemo.helsinki.fi/}PermissionApplicationService INFO 2008-05-18 16:00:37,684 [connector.http.0.receiver.3] fi.helsinki.muledemo.services.EchoComponent: message, key + balue org.apache.cxf.message.Message.HTTP_REQUEST_METHOD POST INFO 2008-05-18 16:00:37,684 [connector.http.0.receiver.3] fi.helsinki.muledemo.services.EchoComponent: message, key + balue org.apache.cxf.message.Message.ENCODING utf-8 INFO 2008-05-18 16:00:37,684 [connector.http.0.receiver.3] fi.helsinki.muledemo.services.EchoComponent: message, key + balue javax.xml.ws.wsdl.interface {http://services.muledemo.helsinki.fi/}PermissionApplicationService INFO 2008-05-18 16:00:37,684 [connector.http.0.receiver.3] fi.helsinki.muledemo.services.EchoComponent: message, key + balue mule.destination.response.observer org.mule.transport.cxf.CxfServiceComponent$ResponseListener@124a3993 INFO 2008-05-18 16:00:37,684 [connector.http.0.receiver.3] fi.helsinki.muledemo.services.EchoComponent: message, key + balue javax.xml.ws.wsdl.operation {http://services.muledemo.helsinki.fi/}sayHi INFO 2008-05-18 16:00:37,684 [connector.http.0.receiver.3] fi.helsinki.muledemo.services.EchoComponent: message, key + balue org.apache.cxf.transport.Destination org.mule.transport.cxf.transport.MuleUniversalDestination@4709eb46 INFO 2008-05-18 16:00:37,684 [connector.http.0.receiver.3] fi.helsinki.muledemo.services.EchoComponent: message, key + balue SOAPAction null INFO 2008-05-18 16:00:37,684 [connector.http.0.receiver.3] fi.helsinki.muledemo.services.EchoComponent: message, key + balue javax.xml.ws.wsdl.description http://localhost:63081/hello?wsdl INFO 2008-05-18 16:00:37,684 [connector.http.0.receiver.3] fi.helsinki.muledemo.services.EchoComponent: message, key + balue Content-Type text/xml INFO 2008-05-18 16:00:37,684 [connector.http.0.receiver.3] fi.helsinki.muledemo.services.EchoComponent: message, key + balue org.apache.cxf.headers.Header.list [] INFO 2008-05-18 16:00:37,684 [connector.http.0.receiver.3] fi.helsinki.muledemo.services.EchoComponent: message, key + balue org.apache.cxf.message.Message.PATH_INFO /hello INFO 2008-05-18 16:00:37,684 [connector.http.0.receiver.3] fi.helsinki.muledemo.services.EchoComponent: message, key + balue org.apache.cxf.message.Message.BASE_PATH /hello INFO 2008-05-18 16:00:37,685 [connector.http.0.receiver.3] fi.helsinki.muledemo.services.EchoComponent: In handleMessage, policy is null No information about the authorization, which is reasonable since Mule / CXF has not yet even challenged the requester. Before that can happen, comes an error. Log: ERROR 2008-05-18 16:00:37,695 [connector.http.0.receiver.3] org.mule.service.DefaultServiceExceptionStrategy: ******************************************************************************** Message : Component that caused exception is: _cxfServiceComponent{http://services.muledemo.helsinki.fi/}PermissionApplicationService2094942626. Message payload is of type: ContentLengthInputStream Type : org.mule.api.service.ServiceException Code : MULE_ERROR--2 Payload : org.apache.commons.httpclient.ContentLengthInputStream@7c220ad8 JavaDoc : http://mule.mulesource.org/docs/apidocs/org/mule/api/service/ServiceException.html ******************************************************************************** Exception stack is: 1. null (java.lang.NullPointerException) org.mule.transport.cxf.CxfServiceComponent$ResponseListener:333 (null) 2. Component that caused exception is: _cxfServiceComponent{http://services.muledemo.helsinki.fi/}PermissionApplicationService2094942626. Message payload is of type: ContentLengthInputStream (org.mule.api.service.ServiceException) org.mule.component.DefaultLifecycleAdapter:214 (http://mule.mulesource.org/docs/apidocs/org/mule/api/service/ServiceException.html) ******************************************************************************** Root Exception stack trace: java.lang.NullPointerException at org.mule.transport.cxf.CxfServiceComponent$ResponseListener.getCachedStream(CxfServiceComponent.java:333) at org.mule.transport.cxf.CxfServiceComponent.sendToDestination(CxfServiceComponent.java:258) at org.mule.transport.cxf.CxfServiceComponent.onCall(CxfServiceComponent.java:112) at org.mule.model.resolvers.CallableEntryPointResolver.invoke(CallableEntryPointResolver.java:52) at org.mule.model.resolvers.DefaultEntryPointResolverSet.invoke(DefaultEntryPointResolverSet.java:50) at org.mule.component.DefaultLifecycleAdapter.intercept(DefaultLifecycleAdapter.java:202) at org.mule.component.AbstractJavaComponent.invokeComponentInstance(AbstractJavaComponent.java:82) at org.mule.component.AbstractJavaComponent.doOnCall(AbstractJavaComponent.java:73) at org.mule.component.AbstractComponent.onCall(AbstractComponent.java:87) at org.mule.model.seda.SedaService.doSend(SedaService.java:234) at org.mule.service.AbstractService.sendEvent(AbstractService.java:510) at org.mule.DefaultMuleSession.sendEvent(DefaultMuleSession.java:347) at org.mule.routing.inbound.DefaultInboundRouterCollection.send(DefaultInboundRouterCollection.java:196) at org.mule.routing.inbound.DefaultInboundRouterCollection.route(DefaultInboundRouterCollection.java:164) at org.mule.transport.AbstractMessageReceiver$DefaultInternalMessageListener.onMessage(AbstractMessageReceiver.java:604) at org.mule.transport.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:346) at org.mule.transport.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:287) at org.mule.transport.http.HttpMessageReceiver$HttpWorker.doRequest(HttpMessageReceiver.java:239) at org.mule.transport.http.HttpMessageReceiver$HttpWorker.processRequest(HttpMessageReceiver.java:197) at org.mule.transport.http.HttpMessageReceiver$HttpWorker.run(HttpMessageReceiver.java:163) at org.mule.work.WorkerContext.run(WorkerContext.java:310) at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061) at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575) at java.lang.Thread.run(Thread.java:637) Seems like a dead end to me, since I don't really want to go deep into Mule and CXF internals - but use the infrastructure. Does anyone come up with ideas or instructions on how to get it to work, or should I just use Axis and Acegi for HTTP Basic authenticated webservices with SSL, and CXF when I need ws-security. I actually tested WS-security and WSIT on glassfish and netbeans, and was really impressed with the ease of use and well made documentation. Therefore I'm actually thinking about using Glassfish and Metro to handle the webservices-part and use Mule at the back for orchestration. Ideas on which methods for communication from Glassfish to Mule and back would be most usable are naturally listened with great interest. So far I've been looking at the possibility to use either ejbs or JMS-transports, but haven't tested yet at all. The downside in that kind of arrangements is naturally the increased complexity that I would not like to see. Any thoughts or ideas? -huima --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
|
Re: Not yet success with CXF and http basic authentication - would need help from people more knowledgeable on CXF and Mule internalsHi Heimo,
he Mule CXF connector does not use the CXF HTTP transport (Maybe we need to create an option to allow this though). It uses the Mule HTTP transport. So you must configure basic authentication at the Mule level. I think this would mean that you can just put the credentials in the URL: http://user:password@.../secure Dan
On Sun, May 18, 2008 at 6:36 AM, Heimo Laukkanen <huima@...> wrote: Hi all, -- Dan Diephouse http://mulesource.com | http://netzooid.com/blog |
|
|
Re: Not yet success with CXF and http basic authentication - would need help from people more knowledgeable on CXF and Mule internalsHi Dan,
Can you please help me with similar issue? My use-case is very the same (see config file below). I've got the same exception (401 - authentication failed) under both Mule 2.0.2 and Mule 2.1.1 despite I pass username and pasword info in url (i.e. wsdl-cxf:http://username:password@localhost:8080/services/DictionaryCurrencyService?method=getCurrencyId) My web service is hosting under Tomcat 5.5 or 6.0 (CXF 2.1.3). Thank you in advanced, <service name="test"> <inbound> <quartz:inbound-endpoint name="example" cronExpression="0/5 * * * * ?" jobName="job5"> </quartz:inbound-endpoint> </inbound> <outbound> <chaining-router > <outbound-endpoint address="wsdl-cxf:http://username:password@localhost:8080/services/DictionaryCurrencyService?method=getCurrencyId"> <properties> <spring:entry key="wsdlLocation" value="file:///c:/DictionaryCurrencyService.xml"/> </properties> </outbound-endpoint> 24 жовт 2008 14:59:07 org.apache.cxf.phase.PhaseInterceptorChain doIntercept INFO: Interceptor has thrown exception, unwinding now org.apache.cxf.interceptor.Fault: Response was of unexpected text/html ContentType. Incoming portion of HTML stream: <html><head><title>Apache Tomcat/5.5.26 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 401 - </h1><HR size="1" noshade="noshade"><p>type Status report</p><p>message <u></u></p><p>description <u>This request requires HTTP authentication ().</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/5.5.26</h3></body></html> at org.apache.cxf.interceptor.StaxInInterceptor.handleMessage(StaxInInterceptor.java:73) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220) at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:633) at org.mule.transport.cxf.transport.MuleUniversalConduit.dispatchMuleMessage(MuleUniversalConduit.java:194) at org.mule.transport.cxf.transport.MuleUniversalConduit$1.handleMessage(MuleUniversalConduit.java:142) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:466) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:308) at org.mule.transport.cxf.CxfMessageDispatcher.doSendWithClient(CxfMessageDispatcher.java:194) at org.mule.transport.cxf.CxfMessageDispatcher.doSend(CxfMessageDispatcher.java:128) at org.mule.transport.AbstractMessageDispatcher.send(AbstractMessageDispatcher.java:168) at org.mule.transport.AbstractConnector.send(AbstractConnector.java:1910) at org.mule.endpoint.DefaultOutboundEndpoint.send(DefaultOutboundEndpoint.java:77) at org.mule.DefaultMuleSession.sendEvent(DefaultMuleSession.java:327) at org.mule.DefaultMuleSession.sendEvent(DefaultMuleSession.java:213) at org.mule.routing.outbound.AbstractOutboundRouter$2.doInTransaction(AbstractOutboundRouter.java:149) at org.mule.transaction.TransactionTemplate.execute(TransactionTemplate.java:99) at org.mule.routing.outbound.AbstractOutboundRouter.send(AbstractOutboundRouter.java:156) at org.mule.routing.outbound.ChainingRouter.route(ChainingRouter.java:71) at org.mule.routing.outbound.DefaultOutboundRouterCollection$1.doInTransaction(DefaultOutboundRouterCollection.java:64) at org.mule.transaction.TransactionTemplate.execute(TransactionTemplate.java:45) at org.mule.routing.outbound.DefaultOutboundRouterCollection.route(DefaultOutboundRouterCollection.java:69) at org.mule.service.AbstractService.dispatchToOutboundRouter(AbstractService.java:877) at org.mule.model.seda.SedaService.dispatchToOutboundRouter(SedaService.java:500) at org.mule.model.seda.SedaService$ComponentStageWorker.run(SedaService.java:523) at org.mule.work.WorkerContext.run(WorkerContext.java:310) at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061) at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575) at java.lang.Thread.run(Unknown Source)
|
|
|
Re: Not yet success with CXF and http basic authentication - would need help from people more knowledgeable on CXF and Mule internalsUnfortunatley, the wsdl-cxf connector currently doesn't support authentication for accessing WSDLs. Please file a JIRA - but I believe this needs to be fixed at the CXF level (possibly in addition to the mule level)
On Fri, Oct 24, 2008 at 5:07 AM, FoxyBOA <foxyboa@...> wrote:
-- Dan Diephouse http://mulesource.com | http://netzooid.com/blog |
|
|
Re: Not yet success with CXF and http basic authentication - would need help from people more knowledgeable on CXF and Mule internalsNot sure that create an issue in Jira correctly (didn't find wsdl transport)
http://mule.mulesource.org/jira/browse/CXF-6
|
|
|
Re: Not yet success with CXF and http basic authentication - would need help from people more knowledgeable on CXF and Mule internalsThanks!
On Sun, Oct 26, 2008 at 4:32 PM, FoxyBOA <foxyboa@...> wrote:
-- Dan Diephouse http://mulesource.com | http://netzooid.com/blog |
| Free embeddable forum powered by Nabble | Forum Help |