Re: SOAPBinding Use.ENCODED ?
Hi Chris and others, thanks for the bunch of replies. I read up the WS-I document on http://www.ws-i.org/Profiles/BasicProfile-1.0-2004-04-16.html a bit, and found R1007-R1007 stating that encoded is not the preferred way (anymore). @Chris As for using MTOM, what were the other parameters (style, parameterStyle) you made it work with? At the moment I I have Document or RPC / LITERAL and wrapped parameter style which helps me when handling complex method parameters / array / collection types on my *WebMethods*. Thanks! Chris Campbell-6 wrote: > > FYI- I ended up using MTOM for this, works great. > -- View this message in context: http://www.nabble.com/Interceptor-Issue-tf4313110.html#a12401464 Sent from the cxf-user mailing list archive at Nabble.com.
Problems with DI and CXF
Dear all, At the moment I havew my first try with CXF. Until now In just work with Xfire. I wrote a simple Serverapplication in a Spring context. There is a Interface-Class and a Implementation of this Interface-class. For the methods in the implementation I need somd injected depencies out of the spring context.I declared the serivice like this: And I add a bean like this: But I get a null exception everytime I try to access the injected hibernateTemplate. Can you give me a hint? Greetings Dominique Atos Origin GmbH, Theodor-Althoff-Str. 47, D-45133 Essen, Postfach 100 123, D-45001 Essen Telefon: +49 201 4305 0, Fax: +49 201 4305 689095, www.atosorigin.de ING Bank AG, Frankfurt/Main: Konto 001 014 0937, BLZ 500 210 00, Swift / BIC INGBDEFF, IBAN DE74 5002 1000 0010 1409 37 Geschäftsführer: Dominique Illien, Handelsregister Essen HRB 19354, Ust.-ID.-Nr.: DE147861238
Re: WSS4JInInterceptor configuration
See yesterday's post to this forum on this subject for an example of multiple actions: http://tinyurl.com/253phq For signing, you need to add the Signature action, along with a specification of the key material you need. See the CXF WS-Security system test for an example, e.g., http://tinyurl.com/2qv3ks On Aug 29, 2007, at 9:09 PM, dmadunic wrote: Hi all, anoyne knows how can i configure multiple actions for WSS4JIn and Out Interceptors? For example signanin and UsernameToken So far i have follwing lines in my applicationContext.xml: implementor="demo.spring.HelloWorldImpl" address="/HelloWorld" > And i would also like to add signing action to WSS4JInInterceptor, any suggestion how to doit? thx -- View this message in context: http://www.nabble.com/ WSS4JInInterceptor-configuration-tf4351388.html#a12398844 Sent from the cxf-user mailing list archive at Nabble.com.
thread safety
The question about thread pools leads me to ask a dumb question: definitionally, are SEI classes required to be reentrant? It seems from this thread that the default behavior includes entry in multiple jetty threads.
How to specify serviceName and portName in jaxws:endpoint
Hi, In the cxf documentation 'Configuring an endpoint' it is stated that the endpoint servicename can be specified using (what appears to be) a QName literal: serviceName The service name this service is implementing. In the format of "{NAMESPACE}SERVICE_NAME". So I tried inserting something like this in my cxfservlet.xmnl http://hi.de.ho/test/cxf/}TestCxfService"; address="/TestCxf"> When the servlet is started by the container I get a SAX parse exception org.xml.sax.SAXParseException: cvc-datatype-valid.1.2.1: '{http://hi.de.ho/test/cxf/}TestCxfService' is not a valid value for 'QName'. at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.xs.XMLSchemaValidator.reportSchemaError(Unknown Source) at org.apache.xerces.impl.xs.XMLSchemaValidator.processOneAttribute(Unknown Source) . . . Clearly, SAX won't eat a QName in the format "{NAMESPACE}SERVICE_NAME".. So, can anyone tell me what format I *do* use to specify the QName literal? regards, Andrew Dinn --- JBoss, a Division of Red Hat Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in UK and Wales under Company Registration No. 3798903 Directors: Michael Cunningham (USA), Charlie Peters (USA) and David Owens (Ireland)
Re: WSS4JInInterceptor configuration
Thx a lot, so far i have managed to successfully configure both Signature and UsernameToken action, both combined with timestamp. Following are my beans: 1) UsernameToken Timestamp combination: 2) Signature timestamp combination: What bothers me now is how to produce combination both to have: ... The problem is because it seems to me that i need to configure to users - one for UsernameToken and another to be used as alias for Signing and also two PasswordCallback classes? Any sugestions how to do it? thx Fred Dushin-3 wrote: > > See yesterday's post to this forum on this subject for an example of > multiple actions: > > http://tinyurl.com/253phq > > For signing, you need to add the Signature action, along with a > specification of the key material you need. See the CXF WS-Security > system test for an example, e.g., > > http://tinyurl.com/2qv3ks > > On Aug 29, 2007, at 9:09 PM, dmadunic wrote: > >> >> Hi all, >> anoyne knows how can i configure multiple actions for WSS4JIn and Out >> Interceptors? >> For example signanin and UsernameToken >> So far i have follwing lines in my applicationContext.xml: >> >> > implementor="demo.spring.HelloWorldImpl" >> address="/HelloWorld" > >> >> > class="org.apache.cxf.binding.soap.saaj.SAAJInInterceptor"/> >> > class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor"> >> >> >> > value="UsernameToken"/> >> > value="PasswordDigest"/> >> > value="demo.interceptors.AuthenticationCallbackHandler"/> >> >> >> >> >> >> >> And i would also like to add signing action to WSS4JInInterceptor, any >> suggestion how to doit? >> >> thx >> -- >> View this message in context: http://www.nabble.com/ >> WSS4JInInterceptor-configuration-tf4351388.html#a12398844 >> Sent from the cxf-user mailing list archive at Nabble.com. >> >> > > > -- View this message in context: http://www.nabble.com/WSS4JInInterceptor-configuration-tf4351388.html#a12406437 Sent from the cxf-user mailing list archive at Nabble.com.
RE: WS-Security and CXF
Hi, Some comments on your comments... > So, first, what do you think would be proper behavioure of CallbackHandler > in case of authentication failure? In the case of authentication failure, I guess you could throw a org.apache.ws.security.WSSecurityException in the handle method of your CallbackHandler implementation. WSSecurityException extends java.rmi.RemoteException, which in turn extends java.io.IOException, which is explicitly thrown by the handle method, and caught accordingly in UsernameTokenProcessor. However, the fact that WSSecurityExceptions aren't explicitly caught and thrown on in UsernameTokenProcessor is a bug which should be raised with WSS4J. Ultimately, the logic for handling a plaintext password derived from an incoming UsernameToken needs to be rewritten to separate the password callback mechanism from the processing of the password, as is done for the digested case. > Furthermore, UsernameTokenProcessor converts both of this Exceptions to > WSSecurityException with "noPassword" message which is actually not > correct information, maybe wrong password was supplied, or CallbackHandler > could not contact LDAP to chek for password so it throwed IOException > which was then converted to also WSSecurityException with noPassword > label? This will be fixed by the change that I proposed above. However, note that "noPassword" is defined in errors.properties as "noPassword=WSSecurityEngine: Callback supplied no password for: {0}", so it's not totally cryptic. > Second, i would like to know is there a way how one can configure > CallbackHandler through Spring application context, and then just pass > reference to it to the WSS4jInInterceptor instead of a class name. This is > especially of handy if CallbackHandler needs to connect to some external > storage such as LDAP or DB to retrive pwd. You can pass a reference to a callback handler in code with something like; Map properties = ... properties.put(WSHandlerConstants.PW_CALLBACK_REF, callbackHandlerObject); WSS4JInInterceptor inHandler = new WSS4JInInterceptor(properties); Doing this through spring could be tricky though... Colm. -Original Message- From: dmadunic [mailto:[EMAIL PROTECTED] Sent: 28 August 2007 16:06 To: cxf-user@incubator.apache.org Subject: RE: WS-Security and CXF Hi Colm, thx for pointing me to the right direction - although i was attempting to avoid looking at the sources at any cost, especially since this seemed to me as quite simple task. Anyway, after looking at sources for wss4j and cxf I now begin to grasp how and what should be done, but still have some questions - which are actually more of a comment. As far as i can see handling of differnt type of security actions is done by various classes in wss4j which all implement following interface: org.apache.ws.security.processor.Processor one of those classes is also UsernameTokenProcessor, which follows the behaviour You described in your posts, ie. it will handle everything only if supplied pwd is hashed otherwise (if for example pwd is Plain text) it expects for CallbackHandler to handle things. Apart from the fact that this is bad design, since no clear division of roles is established, it is not clear what should Callback class do if passwords do not match, or if validation fails for some other reasons??! Java code that handles this check in UsernameTokenProcessor is as follows: WSPasswordCallback pwCb = new WSPasswordCallback(user, password, pwType, WSPasswordCallback.USERNAME_TOKEN_UNKNOWN); callbacks[0] = pwCb; try { cb.handle(callbacks); } catch (IOException e) { throw new WSSecurityException(WSSecurityException.FAILURE, "noPassword", new Object[]{user}); } catch (UnsupportedCallbackException e) { throw new WSSecurityException(WSSecurityException.FAILURE, "noPassword", new Object[]{user}); } So CallbackHandler has only options of throwing IOException or UnsupportedCallbackException, which is neither appropritate exception for case when authentication failes due to the wrong password. Furthermore, UsernameTokenProcessor converts both of this Exceptions to WSSecurityException with "noPassword" message which is actually not correct information, maybe wrong password was supplied, or CallbackHandler could not contact LDAP to chek for password so it throwed IOException which was then converted to also WSSecurityException with noPassword label? So, first, what do you think would be proper behavioure of CallbackHandler in case of authentication failure? Second, i would like to know is there a way how one can configure CallbackHandler through Spring application context, and then just pass reference to it to the WSS4jInInterceptor instead of a class name. This is especially of handy if CallbackHandler needs to connect to some external storage such as LDAP or D
RE: WSS4JInInterceptor configuration
Hi, > The problem is because it seems to me that i need to configure to users - > one for UsernameToken and another to be used as alias for Signing and also > two PasswordCallback classes? You could use a single PasswordCallback class, and retrieve the appropriate password by examining the getUsage() method of the WSPasswordCallback object. This will return WSPasswordCallback.USERNAME_TOKEN for the UsernameToken case, or WSPasswordCallback.SIGNATURE for signature, etc. Colm. -Original Message- From: dmadunic [mailto:[EMAIL PROTECTED] Sent: 30 August 2007 13:41 To: cxf-user@incubator.apache.org Subject: Re: WSS4JInInterceptor configuration Thx a lot, so far i have managed to successfully configure both Signature and UsernameToken action, both combined with timestamp. Following are my beans: 1) UsernameToken Timestamp combination: 2) Signature timestamp combination: What bothers me now is how to produce combination both to have: ... The problem is because it seems to me that i need to configure to users - one for UsernameToken and another to be used as alias for Signing and also two PasswordCallback classes? Any sugestions how to do it? thx Fred Dushin-3 wrote: > > See yesterday's post to this forum on this subject for an example of > multiple actions: > > http://tinyurl.com/253phq > > For signing, you need to add the Signature action, along with a > specification of the key material you need. See the CXF WS-Security > system test for an example, e.g., > > http://tinyurl.com/2qv3ks > > On Aug 29, 2007, at 9:09 PM, dmadunic wrote: > >> >> Hi all, >> anoyne knows how can i configure multiple actions for WSS4JIn and Out >> Interceptors? >> For example signanin and UsernameToken >> So far i have follwing lines in my applicationContext.xml: >> >> > implementor="demo.spring.HelloWorldImpl" >> address="/HelloWorld" > >> >> >> >> >> >> >> >> > value="demo.interceptors.AuthenticationCallbackHandler"/> >> >> >> >> >> >> >> And i would also like to add signing action to WSS4JInInterceptor, any >> suggestion how to doit? >> >> thx >> -- >> View this message in context: http://www.nabble.com/ >> WSS4JInInterceptor-configuration-tf4351388.html#a12398844 >> Sent from the cxf-user mailing list archive at Nabble.com. >> >> > > > -- View this message in context: http://www.nabble.com/WSS4JInInterceptor-configuration-tf4351388.html#a1 2406437 Sent from the cxf-user mailing list archive at Nabble.com. IONA Technologies PLC (registered in Ireland) Registered Number: 171387 Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
RE: WS-Security and CXF
Colm thx for the code snippet: > Map properties = ... > properties.put(WSHandlerConstants.PW_CALLBACK_REF, > callbackHandlerObject); > WSS4JInInterceptor inHandler = new WSS4JInInterceptor(properties); now i managed to configure it through spring with no problem at all, here is an example for all those who might need it in future: passwordCallbackRef As for CallbackHandler discussion, i think that team from wss4j should take a close look at the Spring Acegi code design at the first place. Where no such ambiguities could be found - that one component in case should performe one action and in other case something else. One possible solution to resolve this issue would be to introduce CredentalsValidator interface which would be called after CallbackHandler in order to handle password or any other type of credentials validation. In this way credentials validation logic would be decoupled from Wss4j Interceptors and assigned to specialized component and responsobilitiy of CallbackHandler would be clear and simple: that is to retrieve password and nothing more! In this way method declaradion and corresponding Exception declartions of CallbackHandler are just fine! If no pwd is found throw No password exception if it can not access storage throw IOException. best O hEigeartaigh, Colm wrote: > > Hi, > > Some comments on your comments... > >> So, first, what do you think would be proper behavioure of > CallbackHandler >> in case of authentication failure? > > In the case of authentication failure, I guess you could throw a > org.apache.ws.security.WSSecurityException in the handle method of your > CallbackHandler implementation. WSSecurityException extends > java.rmi.RemoteException, which in turn extends java.io.IOException, > which is explicitly thrown by the handle method, and caught accordingly > in UsernameTokenProcessor. > > However, the fact that WSSecurityExceptions aren't explicitly caught and > thrown on in UsernameTokenProcessor is a bug which should be raised with > WSS4J. Ultimately, the logic for handling a plaintext password derived > from an incoming UsernameToken needs to be rewritten to separate the > password callback mechanism from the processing of the password, as is > done for the digested case. > >> Furthermore, UsernameTokenProcessor converts both of this Exceptions > to >> WSSecurityException with "noPassword" message which is actually not > >> correct information, maybe wrong password was supplied, or > CallbackHandler > could not contact LDAP to chek for password so it > throwed IOException >> which was then converted to also WSSecurityException with noPassword >> label? > > This will be fixed by the change that I proposed above. However, note > that > "noPassword" is defined in errors.properties as > "noPassword=WSSecurityEngine: Callback supplied no password for: {0}", > so it's not totally cryptic. > >> Second, i would like to know is there a way how one can configure >> CallbackHandler through Spring application context, and then just pass >> reference to it to the WSS4jInInterceptor instead of a class name. > This is >> especially of handy if CallbackHandler needs to connect to some > external >> storage such as LDAP or DB to retrive pwd. > > You can pass a reference to a callback handler in code with something > like; > > Map properties = ... > properties.put(WSHandlerConstants.PW_CALLBACK_REF, > callbackHandlerObject); > WSS4JInInterceptor inHandler = new WSS4JInInterceptor(properties); > > Doing this through spring could be tricky though... > > Colm. > > > -Original Message- > From: dmadunic [mailto:[EMAIL PROTECTED] > Sent: 28 August 2007 16:06 > To: cxf-user@incubator.apache.org > Subject: RE: WS-Security and CXF > > > Hi Colm, > thx for pointing me to the right direction - although i was attempting > to > avoid looking at the sources at any cost, especially since this seemed > to me > as quite simple task. Anyway, after looking at sources for wss4j and cxf > I > now begin to grasp how and what should be done, but still have some > questions - which are actually more of a comment. > > As far as i can see handling of differnt type of security actions is > done by > various classes in wss4j which all implement following interface: > > org.apache.ws.security.processor.Processor > > one of those classes is also UsernameTokenProcessor, which follows the > behaviour You described in your posts, ie. it will handle everything > only if > supplied pwd is hashed otherwise (if for example pwd is Pla
Re: Schema-First Development with CXF
Any feedback on this question? On Tue, 2007-08-28 at 10:02 -0400, Eric Miles wrote: > Dan, > > On the heels of the trouble I'm having with the suggestion below, I > decided to give the 2.1 snapshot version a try with the fixed Spring > namespace support. This actually does register my service and I can > view the WSDL. However, the behavior is not as I expected. In XFire > 1.2.6, when I gave my schema locations, the WSDL Generator took my > schemas and added them to the generated WSDL. With CXF 2.1-SNAPSHOT, > this is not happening. Is this the expected behavior? Do I need more > configuration in my Spring context? > > Here is the configuration: > > implementor="#tawsMobileServiceImpl" name="MobileService" > address="/MobileService"> > > > > > > > classpath:com/kronos/taws/services/mobile/MobileService.xsd > > > > Attached are the 2 WSDLs. One generated from XFire 1.2.6 and one from > CXF 2.1-SNAPSHOT. Keep in mind, the only thing I have changed in the > interface and impl classes were the addition of the portType in the > CXF version (to get around the use of the classname from the proxy > class). > > Thanks, > Eric > > On Mon, 2007-08-27 at 18:22 -0400, Dan Diephouse wrote: > > > Hi Daniel (and Eric who is hopefully still listening), > > > > I've just fixed this problem in SVN. The problem was I added capabilities to > > do this from the API, but forgot to actually write a test for the XML config > > - which wasn't fully working :-(. Dan Kulp will be publishing some new > > snapshots tonight I think, at which point you can test out the fixed > > functionality. > > > > I did think of a workaround though. You could do something like this: > > > > > > > > > > > >> > > > > > > > > class="my.proto.HelloWorldImpl"> > > > > > > > > > > > > > > > > > > > > > > > > /META-INF/schemas/helloWorldSchema.xsd > > > > > > > > > > > > Any ideas what might be causing this problem? > > > > > > Thanks, > > > > > > Daniel. > > > > > > On 7/11/07, Daniel Kulp <[EMAIL PROTECTED]> wrote: > > > > > > > > Dan, > > > > > > > > Sorry. I didn't see this till now. > > > > > > > > I'll get a new snapshot deploying now. > > > > > > > > Dan > > > > > > > > (hmm 3 Dan's I'm getting confused. Which one am I? :-) > > > > > > > > On Monday 09 July 2007 09:42, Dan Diephouse wrote: > > > > > Hi Daniel, > > > > > > > > > > Sorry for the delay with these changes. It turns out I need to fix > > > > > something else inside CXF to make this work correctly yet. I added > > > > > some basic support for it to though to today's SVN. Since I'm on a > > > > > cellular connection, I can't publish a snapshot now, but I think > > > > > another CXF dev probably will today. Then you'll be able to do > > > > > something like: > > > > > > > > > > > > > > > > > > > > /foo/bar.xsd > > > > > > > > > > > > > > > > > > > > The curent issue with the code is that CXF will parse the schemas with > > > > > a library called XmlSchema and it doesn't preserve things like > > > > > formatting or documentation. I'll be fixing this later tonight though > > > > > (hopefully I'll be able to get it done tonight). > > > > > > > > > > Thanks for your patience and testing! I'll keep an on eye on the > > > > > snapshots and let you know when one is published. > > > > > > > > > > - Dan > > > > > > > > > > On 7/4/07, Daniel Pike <[EMAIL PROTECTED]> wrote: > > > > > > Hi Dan, > > > > > > > > > > > > Sounds great, I will keep an eye out for it. > > > > > > > > > > > > Thanks, > > > > > > > > > > > > Daniel. > > > > > > > > > > > > On 7/5/07, Dan Diephouse <[EMAIL PROTECTED]> wrote: > > > > > > > Hi Daniel, > > > > > > > I think I might have overlooked configuration of this in the JAXB > > > > > > > databinding. Its just a few lines of code for me to change though. > > > > > > > I > > > > > > > > > > > > think > > > > > > > > > > > > > I > > > > > > > can probably push out a snapshot this week with the change if you > > > > > > > want > > > > > > > > > > > > to > > > > > > > > > > > > > try it. Then it'll get in our 2.0.1 release. Sound good? > > > > > > > - Dan > > > > > > > > > > > > > > On 7/4/07, Daniel Pike <[EMAIL PROTECTED]> wrote: > > > > > > > > Hi, > > > > > > > > > > > > > > > > I am currently looking at migrating our existing XFire web > > > > > > > > service > > > > > > > > > > > > > > across > > > > > > > > > > > > > > > to > > > > > > > > CXF. We have used schema-first development to develop this web > > > > > > > > > > > > service > > > > > > > > > > > > > > and > > > > > > > > are hoping to do the same with CXF > > > > > > > > > > > > > > > > The problem that I am having is that I cannot find a way to > > > > > > > > specify > > > > > > > > > > > > the > > > > > > > > > > > > > > location of the XSD files when configuring the app using spring. > > > > > > > > I noticed > > > > > > > > that the Service
RE: WSS4JInInterceptor configuration
Colm thx, this solves problem of PasswordCallback - but what about users? How do i specify 2 users, one for Signature and another for UsernameToken action? This can happen in scenario where SOAP client is signing all of the requests, but information sent in UsernameToken should belong to the user who logged in in application that is using this SOAP client to send requests to some service on ESB. O hEigeartaigh, Colm wrote: > > > Hi, > >> The problem is because it seems to me that i need to configure to > users - >> one for UsernameToken and another to be used as alias for Signing and > also >> two PasswordCallback classes? > > You could use a single PasswordCallback class, and retrieve the > appropriate password by examining the getUsage() method of the > WSPasswordCallback object. This will return > WSPasswordCallback.USERNAME_TOKEN for the UsernameToken case, or > WSPasswordCallback.SIGNATURE for signature, etc. > > Colm. > > > -Original Message- > From: dmadunic [mailto:[EMAIL PROTECTED] > Sent: 30 August 2007 13:41 > To: cxf-user@incubator.apache.org > Subject: Re: WSS4JInInterceptor configuration > > > Thx a lot, > so far i have managed to successfully configure both Signature and > UsernameToken action, both combined with timestamp. > Following are my beans: > > 1) UsernameToken Timestamp combination: > class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor"> > > > > >value="PasswordDigest"/> >value="demo.interceptors.client.UsernamePasswordCallback"/> > > > > > 2) Signature timestamp combination: >class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor"> > > > >value="client_sign.properties"/> > >value="demo.interceptors.client.SignaturePasswordCallback"/> > > > > > What bothers me now is how to produce combination both to have: > > class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor"> > > > > ... > > > > > The problem is because it seems to me that i need to configure to users > - > one for UsernameToken and another to be used as alias for Signing and > also > two PasswordCallback classes? > Any sugestions how to do it? > > thx > > > Fred Dushin-3 wrote: >> >> See yesterday's post to this forum on this subject for an example of >> multiple actions: >> >> http://tinyurl.com/253phq >> >> For signing, you need to add the Signature action, along with a >> specification of the key material you need. See the CXF WS-Security >> system test for an example, e.g., >> >> http://tinyurl.com/2qv3ks >> >> On Aug 29, 2007, at 9:09 PM, dmadunic wrote: >> >>> >>> Hi all, >>> anoyne knows how can i configure multiple actions for WSS4JIn and Out >>> Interceptors? >>> For example signanin and UsernameToken >>> So far i have follwing lines in my applicationContext.xml: >>> >>> >> implementor="demo.spring.HelloWorldImpl" >>> address="/HelloWorld" > >>> >>> class="org.apache.cxf.binding.soap.saaj.SAAJInInterceptor"/> >>> class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor"> >>> >>> >>> value="UsernameToken"/> >>> value="PasswordDigest"/> >>> key="passwordCallbackClass" >>> value="demo.interceptors.AuthenticationCallbackHandler"/> >>> >>> >>> >>> >>> >>> >>> And i would also like to add signing action to WSS4JInInterceptor, > any >>> suggestion how to doit? >>> >>> thx >>> -- >>> View this message in context: http://www.nabble.com/ >>> WSS4JInInterceptor-configuration-tf4351388.html#a12398844 >>> Sent from the cxf-user mailing list archive at Nabble.com. >>> >>> >> >> >> > > -- > View this message in context: > http://www.nabble.com/WSS4JInInterceptor-configuration-tf4351388.html#a1 > 2406437 > Sent from the cxf-user mailing list archive at Nabble.com. > > > IONA Technologies PLC (registered in Ireland) > Registered Number: 171387 > Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland > > -- View this message in context: http://www.nabble.com/WSS4JInInterceptor-configuration-tf4351388.html#a12407603 Sent from the cxf-user mailing list archive at Nabble.com.
Re: Problems with DI and CXF
Hi, If you use the 's implementor attribute to describe the implementor which just a ref bean, you need to use the # as the prefix of the bean's name. So in your case, the should look like this. or Willem. Dominique.Ronde wrote: > > Dear all, > > At the moment I havew my first try with CXF. Until now In just work with > Xfire. I wrote a simple Serverapplication in a Spring context. There is > a Interface-Class and a Implementation of this Interface-class. For the > methods in the implementation I need somd injected depencies out of the > spring context.I declared the serivice like this: > > > implementor="biz.dominiqueronde.argentum.server.provider.CategoryProvide > r" > address="/CategoryService"> > > > And I add a bean like this: > > > class="biz.dominiqueronde.argentum.server.provider.CategoryProvider"> > > > > > > > But I get a null exception everytime I try to access the injected > hibernateTemplate. > > Can you give me a hint? > > Greetings > Dominique > > Atos Origin GmbH, Theodor-Althoff-Str. 47, D-45133 Essen, Postfach 100 > 123, D-45001 Essen > Telefon: +49 201 4305 0, Fax: +49 201 4305 689095, www.atosorigin.de > ING Bank AG, Frankfurt/Main: Konto 001 014 0937, BLZ 500 210 00, Swift / > BIC INGBDEFF, IBAN DE74 5002 1000 0010 1409 37 > Geschäftsführer: Dominique Illien, Handelsregister Essen HRB 19354, > Ust.-ID.-Nr.: DE147861238 > > > -- View this message in context: http://www.nabble.com/Problems-with-DI-and-CXF-tf4353029.html#a12408313 Sent from the cxf-user mailing list archive at Nabble.com.
RE: How to specify serviceName and portName in jaxws:endpoint
Hi If you want to specify a QName in the spring, you could do it like this. http://localhost:8080/test"; xmlns:e="http://service.jaxws.cxf.apache.org/endpoint"; xmlns:s="http://service.jaxws.cxf.apache.org/service"/> Cheers, Willem. -Original Message- From: Andrew Dinn [mailto:[EMAIL PROTECTED] Sent: Thu 8/30/2007 19:45 To: cxf-user@incubator.apache.org Subject: How to specify serviceName and portName in jaxws:endpoint Hi, In the cxf documentation 'Configuring an endpoint' it is stated that the endpoint servicename can be specified using (what appears to be) a QName literal: serviceName The service name this service is implementing. In the format of "{NAMESPACE}SERVICE_NAME". So I tried inserting something like this in my cxfservlet.xmnl http://hi.de.ho/test/cxf/}TestCxfService"; address="/TestCxf"> When the servlet is started by the container I get a SAX parse exception org.xml.sax.SAXParseException: cvc-datatype-valid.1.2.1: '{http://hi.de.ho/test/cxf/}TestCxfService' is not a valid value for 'QName'. at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.xs.XMLSchemaValidator.reportSchemaError(Unknown Source) at org.apache.xerces.impl.xs.XMLSchemaValidator.processOneAttribute(Unknown Source) . . . Clearly, SAX won't eat a QName in the format "{NAMESPACE}SERVICE_NAME".. So, can anyone tell me what format I *do* use to specify the QName literal? regards, Andrew Dinn --- JBoss, a Division of Red Hat Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in UK and Wales under Company Registration No. 3798903 Directors: Michael Cunningham (USA), Charlie Peters (USA) and David Owens (Ireland)
RE: thread safety
Yes , now the all implementor class need to be reentrant. CXF does not support the thread safe call for implementor method. Willem. -Original Message- From: Benson Margulies [mailto:[EMAIL PROTECTED] Sent: Thu 8/30/2007 19:45 To: cxf-user@incubator.apache.org Subject: thread safety The question about thread pools leads me to ask a dumb question: definitionally, are SEI classes required to be reentrant? It seems from this thread that the default behavior includes entry in multiple jetty threads.
Simple front end and JAB customization
Hi, Is there any way to customize JAXB type mapping when using the simple front end? I would like to have the java.util.Date for the xsd:dateTime. Thanks, Jacob
Re: Schema for namespace 'http://localhost/Service already contains type 'foo
As an update to this after spending some more time trying to unwind it... It appears the problem was actually due to a method in one of my interfaces: Foo foo(...) JAXB would collide the Foo type and the foo method. Setting up an Aegis binding instead seems to have cleared it up. --Joe On Aug 30, 2007, at 2:44 AM, Joe Sunday wrote: I'm trying to migrate an existing framework from Xfire over to CXF (2.0.1 and tonight's 2.1 snapshot), and I can't get it to play nice. There's a core framework that exports a web service interface of a few methods. We have an additional application that builds on top of that with it's own interface: @WebService(...) public interface CoreService { @WebMethod(...) Foo foo(...) } @WebService(...) public interface AppService { @WebMethod ServiceResult methodOne(...) @WebMethod ServiceResult methodTwo(...) } Then we aggregate them together with a new interface that we actually want exported: @WebService(name = "MyService", targetNamespace = "http://localhost/ Service") public interface PublicService extends CoreService, AppService { } Actually implementing methodXXX is handled by a JDK proxy class created by a factory in Spring that implements PublicService and the InvocationHandler maps them back to the right implementation. There is no actual Impl class to speak of. If I setup my endpoint like this: I get this during startup: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'helloWorld': Invocation of init method failed; nested except ion is java.lang.RuntimeException: Schema for namespace 'http:// localhost/Service' already contains type 'foo Caused by: java.lang.RuntimeException: Schema for namespace 'http://localhost/ Service' already contains type 'foo at org.apache.ws.commons.schema.XmlSchema.addType (XmlSchema.java:229) at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.createWrap pedMessageSchema(ReflectionServiceFactoryBean.java:660) at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.createWrap pedSchema(ReflectionServiceFactoryBean.java:511) at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initialize WrappedSchema(ReflectionServiceFactoryBean.java:430) at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServi ceFromClass(ReflectionServiceFactoryBean.java:240) at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initialize ServiceModel(ReflectionServiceFactoryBean.java:264) at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create (ReflectionServiceFactoryBean.java:143) at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create (JaxWsServiceFactoryBean.java:89) at org.apache.cxf.frontend.AbstractEndpointFactory.createEndpoint (AbstractEndpointFactory.java:82) at org.apache.cxf.frontend.ServerFactoryBean.create (ServerFactoryBean.java:107) at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create (JaxWsServerFactoryBean.java:147) at org.apache.cxf.jaxws.EndpointImpl.getServer (EndpointImpl.java:287) at org.apache.cxf.jaxws.EndpointImpl.doPublish (EndpointImpl.java:227) at org.apache.cxf.jaxws.EndpointImpl.publish (EndpointImpl.java:179) at org.apache.cxf.jaxws.EndpointImpl.publish (EndpointImpl.java:340) 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:585) I tried giving it a class to find the annotations on as well (though I didn't need this in XFire, it just read off the Interface correctly): @WebService(endpointInterface = "com.myapp.PublicService") public abstract class PublicServiceFake implements PublicService { } and pointing the endpoint to it in Spring: implementorClass="com.myapp.SnapManagerServiceFake" with the same result. If I remove the "implements PublicService" part, it'll startup, but then the generated wsdl doesn't actually have any methods in it. In XFire, my config looked like this (publicServiceProxy: class="org.codehaus.xfire.annotations.AnnotationServiceFactory"> class="org.codehaus.xfire.annotations.jsr181.Jsr181WebAnnotations" /> class="org.codehaus.xfire.spring.remoting.XFireExporter"> value="com.myapp.PublicService" /> ref="xfire.annotationServiceFactory"/> wsdlBuilder.generateImports true --Joe
Re: How to specify serviceName and portName in jaxws:endpoint
Thanks very much. That worked a treat. regards, Andrew Dinn --- JBoss, a Division of Red Hat Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in UK and Wales under Company Registration No. 3798903 Directors: Michael Cunningham (USA), Charlie Peters (USA) and David Owens (Ireland) Jiang, Ning (Willem) wrote: Hi If you want to specify a QName in the spring, you could do it like this. implementor="org.apache.cxf.jaxws.service.Hello" endpointName="e:HelloEndpointCustomized" serviceName="s:HelloServiceCustomized" address="http://localhost:8080/test"; xmlns:e="http://service.jaxws.cxf.apache.org/endpoint"; xmlns:s="http://service.jaxws.cxf.apache.org/service"/> Cheers, Willem. -Original Message- From: Andrew Dinn [mailto:[EMAIL PROTECTED] Sent: Thu 8/30/2007 19:45 To: cxf-user@incubator.apache.org Subject: How to specify serviceName and portName in jaxws:endpoint Hi, In the cxf documentation 'Configuring an endpoint' it is stated that the endpoint servicename can be specified using (what appears to be) a QName literal: serviceName The service name this service is implementing. In the format of "{NAMESPACE}SERVICE_NAME". So I tried inserting something like this in my cxfservlet.xmnl http://hi.de.ho/test/cxf/}TestCxfService"; address="/TestCxf"> When the servlet is started by the container I get a SAX parse exception org.xml.sax.SAXParseException: cvc-datatype-valid.1.2.1: '{http://hi.de.ho/test/cxf/}TestCxfService' is not a valid value for 'QName'. at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.xs.XMLSchemaValidator.reportSchemaError(Unknown Source) at org.apache.xerces.impl.xs.XMLSchemaValidator.processOneAttribute(Unknown Source) . . . Clearly, SAX won't eat a QName in the format "{NAMESPACE}SERVICE_NAME".. So, can anyone tell me what format I *do* use to specify the QName literal? regards, Andrew Dinn ---
Re: SOAPBinding Use.ENCODED ?
I followed the user guide, my implementation is pretty simple so far, but it does what I need. http://cwiki.apache.org/CXF20DOC/mtom.html Skip down to the java first part. I found that I got errors if I used the JAXB annotations on the payload class, but found they were not necessary. Otherwise, my services are annotated as yours are. I have a payload object that has a DataHandler which will be where the binary data goes. trichter wrote: > Hi Chris and others, > > thanks for the bunch of replies. I read up the WS-I document on > http://www.ws-i.org/Profiles/BasicProfile-1.0-2004-04-16.html a bit, and > found R1007-R1007 stating that encoded is not the preferred way (anymore). > > @Chris > As for using MTOM, what were the other parameters (style, parameterStyle) > you made it work with? > At the moment I I have Document or RPC / LITERAL and wrapped parameter style > which helps me when handling complex method parameters / array / collection > types on my *WebMethods*. > > Thanks! > > > > Chris Campbell-6 wrote: >> FYI- I ended up using MTOM for this, works great. >> >
RE: Method level authentication?
Thanks Dan. I noticed that I was putting in the password twice... but upon changing it.. AuthorizationPolicy is still null (the opName is working using your workaround). Here is a tcpdump: POST /prototype_web/services/ProductSearchWebService HTTP/1.1 Content-Type: text/xml; charset=UTF-8 Authorization: Basic dm5ndXllbjpibGFjaw== SOAPAction: "" Accept: * Cache-Control: no-cache Pragma: no-cache User-Agent: Java/1.5.0_04 Host: ur-vnguyen.wynnesystems.com: Connection: keep-alive Transfer-Encoding: chunked 1ca http://schemas.xmlsoap.org/soap/envelope/";>http://webservices.ur.com";>http://webservices.ur.com";>http://webservices.ur.com";>http://webservices.ur.com";>http://webservices.ur.com";> 0 This is what my cxf.xml looks like for that endpoint: > implementor="com.ur.webservices.impl.ProductSearchImpl" >address="/ProductSearchWebService"> > > > > I am using the standard way of passing in the username/password now: > BindingProvider bp = (BindingProvider)port; > bp.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "vnguyen"); > bp.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "mypassword"); Thanks, Van Nguyen United Rentals, Inc [EMAIL PROTECTED] (949) 225-6553 -Original Message- From: Daniel Kulp [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 29, 2007 8:45 AM To: cxf-user@incubator.apache.org Cc: Van Nguyen Subject: Re: Method level authentication? Van, On Tuesday 28 August 2007, Daniel Kulp wrote: > 2 parts: > 1) Issue of opName being null - I just checked the RPCInInterceptor > and it isn't setting a bunch of stuff that the DocLitInInterceptor is > setting. WSDL_OPERATION is one that it's not setting. :-(I'll > get those fixed tomorrow. Fixed this on trunk. However, there is a workaround: message.getExchange().get(OperationInfo.class) will get the OperationInfo object from which you can get the name. > 2) AuthorizationPolicy is null - not sure on that one. That is > provided but the transport if there is an Authorization header > present. Is there anyway you can TCPdump/wireshare the raw request > and see if there is an Authorization header? The code looks OK, > although I must admit I've never done it that way. I've always used > the standard JAX-WS API for setting the username/password for basic > auth: Figured this out. Your code is wrong: > > policy.setPassword("vnguyen"); > > policy.setPassword("myPassword"); You're setting the password twice. Thus, no username is being set. We don't put any basic auth stuff on the wire unless there is a username. Dan > > BindingProvider bp = (BindingProvider)port; > bp.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "BJ"); > bp.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "pswd"); > > Dan > > On Tuesday 28 August 2007, Van Nguyen wrote: > > Dan, > > > > I'm giving this a shot and am having some difficulties with the > > AuthorizationInterceptor finding the AuthorizationPolicy object. > > > > My Web Services looks something like this: > > > > @WebService(name = "productSearchService") > > @SOAPBinding(style = Style.RPC, use = Use.LITERAL) > > @WebFault(targetNamespace = "http://webservices.ur.com/types";, name > > = "productSearchException", faultBean = > > "com.ur.webservices.webfaults.ProductSearchServiceFault") > > @InInterceptors(interceptors={"com.ur.webservices.security.Authoriza > >ti on Interceptor"}) > > public interface ProductSearch > > { > > public Item getItem(String itemNumber) > > } > > > > Using the wsdl2java command, it created the java classes needed to > > call this web service: > > > > ProductSearchImplService ss = new > > ProductSearchImplService(wsdlURL, SERVICE_NAME); > > ProductSearchService port = ss.getProductSearchImplPort(); > > > > Client client = ClientProxy.getClient(port); > > HTTPConduit httpConduit = (HTTPConduit)client.getConduit(); > > AuthorizationPolicy policy = new AuthorizationPolicy(); > > policy.setPassword("vnguyen"); > > policy.setPassword("myPassword"); > > httpConduit.setAuthorization(policy); > > > > Calling port.getItem("1234"), brings me into the > > AuthorizationInterceptor... but both the AuthorizationPolicy and > > opName are null - I also assumed you meant to write: > > String opName = (String)message.get(Message.WSDL_OPERATION); > > > > Any ideas? > > > > Thanks, > > > > Van Nguyen > > United Rentals, Inc > > [EMAIL PROTECTED] > > (949) 225-6553 > > > > -Original Message- > > From: Daniel Kulp [mailto:[EMAIL PROTECTED] > > Sent: Tuesday, August 28, 2007 10:27 AM > > To: cxf-user@incubator.apache.org > > Cc: Van Nguyen > > Subject: Re: Method level authentication? > > > > > > Van, > > > > The answer is both yes and no. > > > > CXF doesn't have anything "built in" that would provide that > > capability. > > > > However, it would be very easy to write an interceptor that
basic auth with JaxWsProxyFactoryBean
I want to setup basic auth, using an AuthInterceptor on the server side, as discussed in another thread. I am using JaxWsProxyFactoryBean on client side, simple frontend style, but it is unclear to me how to put the AuthorizationPolicy object into the request.
wsdl2java and faults
The objects generated by wsdl2java for faults seem unnecessarily clumsy. I get a POJO + annotations that corresponds to the fault type. Call it 'X'. Then I get XFault. To construct an XFault over a Throwable, I need to provide a message --- (String message, X x, Throwable cause) Could there not be no-message constructor? All the information I want to transmit is inside the x object.
basic auth question
On client I have: java.util.Map context = ((javax.xml.ws.BindingProvider)client).getRequestContext(); context.put("username", "chris"); context.put("password", "foobar"); How do I access that context on the server side in my interceptor? I cannot seem to find where it is in the Message object, or am I horribly misunderstanding something? thanks Chris
Null Pointer in WSDLServiceFactory
I have this code working in my development environment, but when I employ to our test environment I'm getting a null pointer. I'm not sure why this is happening. Can someone give me any pointers? I'm really desperate to find a solution. java.lang.NullPointerException at org.apache.cxf.wsdl11.WSDLServiceFactory.(WSDLServiceFactory.java:81) at org.apache.cxf.jaxws.ServiceImpl.initializePorts(ServiceImpl.java:112) at org.apache.cxf.jaxws.ServiceImpl.(ServiceImpl.java:104) at org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:55) at javax.xml.ws.Service.(Service.java:57) at com.mysite.services.news.NewsService.(NewsService.java:41) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) >From code: @WebServiceClient(name = "NewsService", targetNamespace = "http://services.mysite.com/News";, wsdlLocation = "http://mysite.com/services/NewsService.svc?wsdl";) public class NewsService extends Service { private final static URL WSDL_LOCATION; private final static QName SERVICE = new QName("http://services.mysite.com/News";, "NewsService"); private final static QName BasicHttpBinding = new QName("http://services.mysite.com/News";, "basicHttpBinding"); static { URL url = null; try { url = new URL("http://mysite.com/services/NewsService.svc?wsdl";); } catch (MalformedURLException e) { System.err.println("Can not initialize the default wsdl from http://mysite.com/services/NewsService.svc?wsdl";); // e.printStackTrace(); } WSDL_LOCATION = url; } public NewsService(URL wsdlLocation, QName serviceName) { super(wsdlLocation, serviceName); } public NewsService() { super(WSDL_LOCATION, SERVICE); } /** * * @return * returns BasicHttpBinding */ @WebEndpoint(name = "basicHttpBinding") public NewsServiceContract getBasicHttpBinding() { return (NewsServiceContract)super.getPort(BasicHttpBinding, NewsServiceContract.class); } -- View this message in context: http://www.nabble.com/Null-Pointer-in-WSDLServiceFactory-tf4357565.html#a12418426 Sent from the cxf-user mailing list archive at Nabble.com.
Obtaining source address and operation name
Hi, I'm trying to write an "in" interceptor, using org.apache.cxf.interceptor.LoggingInInterceptor as a starting point. I'm trying to log - the source (IP) address that originate the (SOAP) Message; - the SOAP operation that was invoked. Any hints on how I can obtain either of these? I've tried adding the interceptor at various phases (RECEIVE, PRE_INVOKE, INVOKE) and getting several values from the Messsage: WSDL_OPERATION, WSDL_PORT, WSDL_SERVICE, INVOCATION_CONTEXT, ENDPOINT_ADDRESS. All these end up being null. Thanks!
RE: Obtaining source address and operation name
Hi What code did you use to retrieve WSDL_OPERATION, WSDL_PORT etc? Thanks, Jervis > -Original Message- > From: James Royalty [mailto:[EMAIL PROTECTED] > Sent: 2007?8?31? 8:28 > To: cxf-user@incubator.apache.org > Subject: Obtaining source address and operation name > > > Hi, > > I'm trying to write an "in" interceptor, using > org.apache.cxf.interceptor.LoggingInInterceptor as a starting point. > I'm trying to log > > - the source (IP) address that originate the (SOAP) Message; > - the SOAP operation that was invoked. > > Any hints on how I can obtain either of these? > > I've tried adding the interceptor at various phases (RECEIVE, > PRE_INVOKE, INVOKE) and getting several values from the Messsage: > WSDL_OPERATION, WSDL_PORT, WSDL_SERVICE, INVOCATION_CONTEXT, > ENDPOINT_ADDRESS. All these end up being null. > > Thanks! > IONA Technologies PLC (registered in Ireland) Registered Number: 171387 Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
Re: Obtaining source address and operation name
Hi Jervis, As I test, I was doing: Object operation = message.get( Message.WSDL_OPERATION ); Object port = message.get( Message.WSDL_PORT ); Object service = message.get( Message.WSDL_SERVICE ); Object context = message.get( Message.INVOCATION_CONTEXT ); Object endpointAddress = message.get( Message.ENDPOINT_ADDRESS ); ... as I didn't know what type would be returned. All ended up being null. The services are using a servlet transport, btw. Thanks! -- James Liu, Jervis wrote: Hi What code did you use to retrieve WSDL_OPERATION, WSDL_PORT etc? Thanks, Jervis -Original Message- From: James Royalty [mailto:[EMAIL PROTECTED] Sent: 2007?8?31? 8:28 To: cxf-user@incubator.apache.org Subject: Obtaining source address and operation name Hi, I'm trying to write an "in" interceptor, using org.apache.cxf.interceptor.LoggingInInterceptor as a starting point. I'm trying to log - the source (IP) address that originate the (SOAP) Message; - the SOAP operation that was invoked. Any hints on how I can obtain either of these? I've tried adding the interceptor at various phases (RECEIVE, PRE_INVOKE, INVOKE) and getting several values from the Messsage: WSDL_OPERATION, WSDL_PORT, WSDL_SERVICE, INVOCATION_CONTEXT, ENDPOINT_ADDRESS. All these end up being null. Thanks! IONA Technologies PLC (registered in Ireland) Registered Number: 171387 Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
Re: Null Pointer in WSDLServiceFactory
Hi , It looks like the WSDLServiceFactory can 't get the WSDLManager from the bus when you try to create a service model for the client. public WSDLServiceFactory(Bus b, String url, QName sn) { setBus(b); try { // use wsdl manager to parse wsdl or get cached definition definition = getBus().getExtension(WSDLManager.class).getDefinition(url); // The NPE is thrown form here } catch (WSDLException ex) { throw new ServiceConstructionException(new Message("SERVICE_CREATION_MSG", LOG), ex); } serviceName = sn; } It could be your WSDLManager does not be set to the bus. Can you tell me how did you initialize the bus? Did you use the spring configuration or load the bus by other means? Maybe you can set the log level to INFO for more information. Willem. green804 wrote: I have this code working in my development environment, but when I employ to our test environment I'm getting a null pointer. I'm not sure why this is happening. Can someone give me any pointers? I'm really desperate to find a solution. java.lang.NullPointerException at org.apache.cxf.wsdl11.WSDLServiceFactory.(WSDLServiceFactory.java:81) at org.apache.cxf.jaxws.ServiceImpl.initializePorts(ServiceImpl.java:112) at org.apache.cxf.jaxws.ServiceImpl.(ServiceImpl.java:104) at org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:55) at javax.xml.ws.Service.(Service.java:57) at com.mysite.services.news.NewsService.(NewsService.java:41) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) >From code: @WebServiceClient(name = "NewsService", targetNamespace = "http://services.mysite.com/News";, wsdlLocation = "http://mysite.com/services/NewsService.svc?wsdl";) public class NewsService extends Service { private final static URL WSDL_LOCATION; private final static QName SERVICE = new QName("http://services.mysite.com/News";, "NewsService"); private final static QName BasicHttpBinding = new QName("http://services.mysite.com/News";, "basicHttpBinding"); static { URL url = null; try { url = new URL("http://mysite.com/services/NewsService.svc?wsdl";); } catch (MalformedURLException e) { System.err.println("Can not initialize the default wsdl from http://mysite.com/services/NewsService.svc?wsdl";); // e.printStackTrace(); } WSDL_LOCATION = url; } public NewsService(URL wsdlLocation, QName serviceName) { super(wsdlLocation, serviceName); } public NewsService() { super(WSDL_LOCATION, SERVICE); } /** * * @return * returns BasicHttpBinding */ @WebEndpoint(name = "basicHttpBinding") public NewsServiceContract getBasicHttpBinding() { return (NewsServiceContract)super.getPort(BasicHttpBinding, NewsServiceContract.class); }
followup on threads
This is perhaps really a spring question, but the readers of this list must have hit this before. SEI classes are reentrant. CXF services are frequently deployed in Spring and constructed with Spring-managed beans. Spring doesn't seem to offer much in the multithreading department. To be a bit more concrete, consider an SEI class that is handed a set of supporting beans via IoC. If those objects are reentrant themselves, well, life is good. What if they are not? The SEI can synchronize and single-thread their use. Effective, but not popular when trying to achieve high usage of multiple processors. Or, we could abandon IoC here, and let the SEI make Spring calls to obtain new instances of the beans (declaring them appropriately) and stash them in thread local storage. This would work best if CXF was keeping some sort of pool of SEI's around to go with the threads, and I haven't researched that yet. It seems a shame to have to decorate the SEI class with a bunch of spring interactions. I suppose that a trick could be had: an intermediate bean that served as a factory for the non-thread-safe objects, and which hid the interactions with the IoC container inside of itself.
RE: Obtaining source address and operation name
these properties are stored in Exchange, not in Message. following should work for you: Object operation = message.getExchange().get( Message.WSDL_OPERATION ); Object port = message.getExchange().get( Message.WSDL_PORT ); Object service = message.getExchange().get( Message.WSDL_SERVICE ); Object context = message.getExchange().get( Message.INVOCATION_CONTEXT ); Object endpointAddress = message.getExchange().get( Message.ENDPOINT_ADDRESS ); Their types are defined in JAX-WS spec, section 9.4.1. .description URI .service QName .port QName .interface QName .operation QName Jervis > -Original Message- > From: James Royalty [mailto:[EMAIL PROTECTED] > Sent: 2007?8?31? 10:07 > To: cxf-user@incubator.apache.org > Subject: Re: Obtaining source address and operation name > > > Hi Jervis, > > As I test, I was doing: > > Object operation = message.get( Message.WSDL_OPERATION ); > Object port = message.get( Message.WSDL_PORT ); > Object service = message.get( Message.WSDL_SERVICE ); > Object context = message.get( Message.INVOCATION_CONTEXT ); > Object endpointAddress = message.get( Message.ENDPOINT_ADDRESS ); > > ... as I didn't know what type would be returned. All ended up being > null. The services are using a servlet transport, btw. > > Thanks! > -- > James > > > > Liu, Jervis wrote: > > Hi What code did you use to retrieve WSDL_OPERATION, WSDL_PORT etc? > > > > Thanks, > > Jervis > > > > > >> -Original Message- > >> From: James Royalty [mailto:[EMAIL PROTECTED] > >> Sent: 2007?8?31? 8:28 > >> To: cxf-user@incubator.apache.org > >> Subject: Obtaining source address and operation name > >> > >> > >> Hi, > >> > >> I'm trying to write an "in" interceptor, using > >> org.apache.cxf.interceptor.LoggingInInterceptor as a > starting point. > >> I'm trying to log > >> > >> - the source (IP) address that originate the (SOAP) Message; > >> - the SOAP operation that was invoked. > >> > >> Any hints on how I can obtain either of these? > >> > >> I've tried adding the interceptor at various phases (RECEIVE, > >> PRE_INVOKE, INVOKE) and getting several values from the Messsage: > >> WSDL_OPERATION, WSDL_PORT, WSDL_SERVICE, INVOCATION_CONTEXT, > >> ENDPOINT_ADDRESS. All these end up being null. > >> > >> Thanks! > >> > >> > > > > > > IONA Technologies PLC (registered in Ireland) > > Registered Number: 171387 > > Registered Address: The IONA Building, Shelbourne Road, > Dublin 4, Ireland > > > IONA Technologies PLC (registered in Ireland) Registered Number: 171387 Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
Re: wsdl2java and faults
Hi, The artifacts generated by wsdl2java is JAX-WS 2.0 compliant, so everything generated by the tool is defined in the spec. Not really know the exact request here. Do you mind send your sample wsdl, and tell us what kind of artifacts you're looking for If there's bug to fix or improvements we can make, you are welcomed to file jira on https://issues.apache.org/jira/browse/CXF Regards, James The objects generated by wsdl2java for faults seem unnecessarily clumsy. I get a POJO + annotations that corresponds to the fault type. Call it 'X'. Then I get XFault. To construct an XFault over a Throwable, I need to provide a message --- (String message, X x, Throwable cause) Could there not be no-message constructor? All the information I want to transmit is inside the x object.
RE: wsdl2java and faults
I was hoping for one more constructor on the exception object FaultException(FaultObject, Throwable); If that's not consistent with the standard, then I won't waste everyone's time with a JIRA. It would never be something important. > -Original Message- > From: James Mao [mailto:[EMAIL PROTECTED] > Sent: Thursday, August 30, 2007 10:43 PM > To: cxf-user@incubator.apache.org > Subject: Re: wsdl2java and faults > > Hi, > > The artifacts generated by wsdl2java is JAX-WS 2.0 compliant, so > everything generated by the tool is defined in the spec. > Not really know the exact request here. > Do you mind send your sample wsdl, and tell us what kind of artifacts > you're looking for > > If there's bug to fix or improvements we can make, you are welcomed to > file jira on https://issues.apache.org/jira/browse/CXF > > Regards, > James > > > The objects generated by wsdl2java for faults seem unnecessarily clumsy. > > > > > > > > I get a POJO + annotations that corresponds to the fault type. Call it > > 'X'. > > > > > > > > Then I get XFault. > > > > > > > > To construct an XFault over a Throwable, I need to provide a message --- > > > > > > > > (String message, X x, Throwable cause) > > > > > > > > Could there not be no-message constructor? All the information I want to > > transmit is inside the x object. > > > > > > > > > > > > > > > > > > > > > >
Client question
Sorry if this one is easy, but I can't seem to find it... I've got an interface I generated from a local wsdl, and the wsdl files are both available on my classpath: http://schemas.xmlsoap.org/wsdl/"; xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"; xmlns:interface="urn:service2"> https://localhost/sdk/myService"; /> How do I create a client for this wsdl against a random url? The binding classes seem to only accept the urn and address specified in the wsdl, which doesn't work if the url I actually want to talk to isn't localhost/sdk/myService URL wsdlURL = MyService.class.getClassLoader.getResource ("myService.wsdl"); QName serviceName = new QName("urn:myService", "MyService"); MyService service = new MyService(wsdlURL, serviceName); ServicePort client = service.getServicePort(); I don't see a generated ServiceLocator in the classes wsdl2java generated anywhere. --Joe
Re: wsdl2java and faults
Hi Benson , This class is generated as per Jaxws spec 2.5 . I think the string message in constructor is useful if there is no message in X to tell us what the fault is or where throw this fault . The below is the sample we use the message to indicate where cause this error : throw new XFault("XFault raised by server when ", X); We also can add a constructor (X x , Throwable cause) for your case . Can you log an enhancement in CXF jira? Regards Jim Benson Margulies wrote: The objects generated by wsdl2java for faults seem unnecessarily clumsy. I get a POJO + annotations that corresponds to the fault type. Call it 'X'. Then I get XFault. To construct an XFault over a Throwable, I need to provide a message --- (String message, X x, Throwable cause) Could there not be no-message constructor? All the information I want to transmit is inside the x object.
Re: Obtaining source address and operation name
Hi , I just answer the get source(IP) address question, because Jervis has showed your the code how to get the wsdl operation. You can get the client request object from the message context. Then you can get the client address from the request. Here are the code snaps HttpServletRequest request = (HttpServletRequest)message.get(AbstractHTTPDestination.HTTP_REQUEST); if (null != request) { String clientAddress = request.getRemoteAddr(); } Cheers, Willem. James Royalty wrote: Hi, I'm trying to write an "in" interceptor, using org.apache.cxf.interceptor.LoggingInInterceptor as a starting point. I'm trying to log - the source (IP) address that originate the (SOAP) Message; - the SOAP operation that was invoked. Any hints on how I can obtain either of these? I've tried adding the interceptor at various phases (RECEIVE, PRE_INVOKE, INVOKE) and getting several values from the Messsage: WSDL_OPERATION, WSDL_PORT, WSDL_SERVICE, INVOCATION_CONTEXT, ENDPOINT_ADDRESS. All these end up being null. Thanks!
Re: Client question
Hi Joe, You can create client from JaxWsProxyFactoryBean and set a random url, the code is as follows JaxWsProxyFactoryBean proxyFactory = new JaxWsProxyFactoryBean(); poxyFactory.setServiceClass(ServicePort.class); proxyFactory.setAddress("theUrlyouwant"); ServicePort client = (ServicePort) proxyFactory.create(); Best Regards Freeman Joe Sunday wrote: Sorry if this one is easy, but I can't seem to find it... I've got an interface I generated from a local wsdl, and the wsdl files are both available on my classpath: http://schemas.xmlsoap.org/wsdl/"; xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"; xmlns:interface="urn:service2"> https://localhost/sdk/myService"; /> How do I create a client for this wsdl against a random url? The binding classes seem to only accept the urn and address specified in the wsdl, which doesn't work if the url I actually want to talk to isn't localhost/sdk/myService URL wsdlURL = MyService.class.getClassLoader.getResource("myService.wsdl"); QName serviceName = new QName("urn:myService", "MyService"); MyService service = new MyService(wsdlURL, serviceName); ServicePort client = service.getServicePort(); I don't see a generated ServiceLocator in the classes wsdl2java generated anywhere. --Joe
Re: Simple front end and JAB customization
Yes, through jaxb customization http://cwiki.apache.org/confluence/display/CXF20DOC/Tools James Jacob Marcus wrote: Hi, Is there any way to customize JAXB type mapping when using the simple front end? I would like to have the java.util.Date for the xsd:dateTime. Thanks, Jacob
Re: Client question
Hi, If you use JAXWS API , you can using the add port to add the other port for your client to access. URL wsdlURL = MyService.class.getClassLoader.getResource("service2.wsdl"); QName serviceName = new QName("urn:service2", "MyService"); QName portName = new QName("urn:service2", "ServicePort"); MyService service = new MyService(wsdlURL, serviceName); service.addPort(portName, "http://schemas.xmlsoap.org/soap/";, "https://localhost/sdk/myService";); // pass the SEI class that is generated by wsdl2java ServicePort proxy = service.getPort(portName, SEI.class); If you use CXF API , you could set the endpoint address directly to the ClientProxyFactoryBean. BTW, if you want to access the service by using https protocol, you need to do some configuration on the client side. You can find more information from this url [1] [1]http://www.nabble.com/Generated-client-to-connect-to-a-https-ws-tf4061903.html Willem. Joe Sunday wrote: Sorry if this one is easy, but I can't seem to find it... I've got an interface I generated from a local wsdl, and the wsdl files are both available on my classpath: http://schemas.xmlsoap.org/wsdl/"; xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"; xmlns:interface="urn:service2"> https://localhost/sdk/myService"; /> How do I create a client for this wsdl against a random url? The binding classes seem to only accept the urn and address specified in the wsdl, which doesn't work if the url I actually want to talk to isn't localhost/sdk/myService URL wsdlURL = MyService.class.getClassLoader.getResource("myService.wsdl"); QName serviceName = new QName("urn:myService", "MyService"); MyService service = new MyService(wsdlURL, serviceName); ServicePort client = service.getServicePort(); I don't see a generated ServiceLocator in the classes wsdl2java generated anywhere. --Joe
Re: [U] RE: No Service found
Hi Willem2, I got the similar question, but can not resolve it accordding at the answer above. I saw the info in Tomcat 6.0 console: 2007-8-31 12:10:32 org.apache.cxf.service.factory.ReflectionServiceFactoryBean buildServiceFromClass Info: Creating Service {http://ws.accounts.hiany.com/}HelloWorldImplService from class com.hiany.accounts.ws.HelloWorldImpl But when I open browser at "http://localhost/website2/ws/?serviceList";, I got a "No service was found". I wrote a interface HelloWorld.java and a class HelloWorldImpl.java. And my cxf-servlet.xml = http://www.springframework.org/schema/beans"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:jaxws="http://cxf.apache.org/jaxws"; xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd"; > === my web.xml: === http://java.sun.com/xml/ns/j2ee"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd"; version="2.5"> .. CXFServlet org.apache.cxf.transport.servlet.CXFServlet 1 ... CXFServlet /ws/* ... Thanks! -- View this message in context: http://www.nabble.com/-U--No-Service-found-tf3960093.html#a12420583 Sent from the cxf-user mailing list archive at Nabble.com.
Re: [U] RE: No Service found
Hi Frankie Current CXF does not support to get the service list with the "?serviceList", I think you can get the service list with this url http://localhost/website2/ws/HelloWorld/services Willem. FrankieHuang wrote: Hi Willem2, I got the similar question, but can not resolve it accordding at the answer above. I saw the info in Tomcat 6.0 console: 2007-8-31 12:10:32 org.apache.cxf.service.factory.ReflectionServiceFactoryBean buildServiceFromClass Info: Creating Service {http://ws.accounts.hiany.com/}HelloWorldImplService from class com.hiany.accounts.ws.HelloWorldImpl But when I open browser at "http://localhost/website2/ws/?serviceList";, I got a "No service was found". I wrote a interface HelloWorld.java and a class HelloWorldImpl.java. And my cxf-servlet.xml = http://www.springframework.org/schema/beans"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:jaxws="http://cxf.apache.org/jaxws"; xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd"; implementor="com.hiany.accounts.ws.HelloWorldImpl" address="/HelloWorld" > === my web.xml: === http://java.sun.com/xml/ns/j2ee"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd"; version="2.5"> .. CXFServlet org.apache.cxf.transport.servlet.CXFServlet 1 ... CXFServlet /ws/* ... Thanks!
Re: [U] RE: No Service found
Hi Willem, I got the "No service was found." at url "http://localhost/website2/ws/HelloWorld/services"; and "http://localhost/website2/ws/services";. and I try to access this service via a client code, I got a "Fault": --- org.apache.cxf.interceptor.Fault: Could not send Message. at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:64) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:206) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:253) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:204) at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73) at org.apache.cxf.frontend.ClientProxy.invoke(ClientProxy.java:68) at $Proxy14.sayHi(Unknown Source) at test.ws.ClientTest.testSayHiWithSpringConfig(ClientTest.java:31) 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.junit.internal.runners.TestMethod.invoke(TestMethod.java:59) at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98) at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79) at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87) at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77) at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42) at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88) at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51) at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44) at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27) at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37) at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38) 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) Caused by: java.io.IOException: Not Found at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1781) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1698) at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66) at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62) ... 29 more --- and server side tomcat console a warnning: 2007-8-31 14:02:23 org.apache.cxf.transport.servlet.ServletController invoke WARN: Can't find the the request for http://localhost/website2/ws/HelloWorld's Observer My client test code: package test.ws; import static org.junit.Assert.assertEquals; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import org.springframework.context.support.ClassPathXmlApplicationContext; import com.hiany.accounts.ws.HelloWorld; public final class ClientTest { private static ClassPathXmlApplicationContext context; @BeforeClass public static void beforeClass() { context = new ClassPathXmlApplicationContext( new String[] { "client-beans.xml" }); } @AfterClass public static void afterClass() { context = null; } @Test public void testSayHiWithSpringConfig() throws Exception { HelloWorld client = (HelloWorld) context.getBean("client"); String response = client.sayHi("Joe"); assertEquals("Hello Joe", response); } }