message context is null
Hi, I inject the context into my service impl like this: @Resource private WebServiceContext context; The context is available during invocation, but when I do: MessageContext messageContext = context.getMessageContext(); The messageContext comes up null in Solaris. In Windows it comes fine. What am I doing wrong? Mayank This e-mail and attachments contain confidential information from HUAWEI, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient's) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it!
From byte[] to SOAPElement
Hi all, i have this problem... convert a byte array into a SOAPElement... i try passing by Document, but i fail :) Any idea? -- View this message in context: http://www.nabble.com/From-byte---to-SOAPElement-tp15429291p15429291.html Sent from the cxf-user mailing list archive at Nabble.com.
Schema DOM memory problem
G'day all, I have been given the task of generating WSDL from my companies large collection of application models, as well as handling the invoking of corresponding services which are already deployed. The number of possible services numbers in the hundreds, with a handful of large (2MB) shared shemas. When trying to run a small Jetty server with more than one of these generated WSDLs I quickly ran out of memory (the default setting - 64M I think). While it wouldn't be hard to bump up the memory allocation, I feared the final scenario of hundreds of WSDLs would be problematic even for large amounts of memory. To cut a long story short this is what I found: 1. For each WSDL, every imported schema is loaded into memory, regardless of whether it is shared among other WSDLs. 2. Every Schema DOM tree is stored in memory after parsing. Given that the Schema is parsed to the more useful XmlSchema object tree, I'm not sure what benefits are gained from keeping it in DOM. I fixed the memory bloat by some minor changes in SchemaUtil, which I will explain briefly here. Note that reflection was unfortunately required in dealing with the XmlSchema library. 1. Used a static map to update the XmlSchemaCollection parameter with any cached Schemas before calling schemaCol.read(schemaElem, systemId); in extractSchema 2. Nulled out cached DOM elements in the following: - extractSchema() - xmlSchema.setElement() (well actually I stopped it being set) - addSchema() - schema.setElement() after targetNamespace is retrieved - At the end of getSchemas() iterate any new schemas, get its NodeNamespaceContext, call getDeclaredPrefixes() before settings its node field to null. 3. Ignored schemaList from the constructor and instead just relied on an internal set to avoid recursion. (I think this map is only needed on the WSDL2Java?) 4. Fixed WSDLQueryHandler to output full WSDL due to missing schema node (I loaded it from the file system instead of serialising the Definition object) I guess my biggest qualm in all this is that it was extremely difficult to subclass and spring SchemaUtil to make the required changes. In particular I had to reproduce the following invocation class chain to fix the problem. JaxWsServiceFactoryBean - buildServiceFromWSDL() - WSDLServiceFactory - create() - WSDLServiceBuilder - getSchemas() - SchemaUtil Because SchemaUtil isn't a sprung object, nor any of the other classes, and because most of the methods/fields are private I ended up literally copy+pasting each class. Forgive me if this all sounds like criticism, because I am very impressed and happy with CXF. This is just as much a documenting of my findings as anything else. Anyway. I'm not too worried about what happens now but I am curious what you guys think of all this. Cheers, Charles O'Farrell
SOAPMessage after Exception
Hi all, i have this question: there is a way to generate a SOAPMessage from en exception or a fault? What i have to do when a creation of a fault message fails? In Axis i do it in this way, that don't raise any exception: return new org.apache.axis.Message(new AxisFault(ErroreProcessamento)); How can i generate a SOAPMessage with a fault and be sure that it don't fail? thx, Lorenzo -- View this message in context: http://www.nabble.com/SOAPMessage-after-Exception-tp15430055p15430055.html Sent from the cxf-user mailing list archive at Nabble.com.
Re: CXF 2.0.3/2.0.4 Build problems with Maven and wsdl2java
Daniel, I'm using JDK 5, build 1.5.0_13. If I specify jaxws-api 2.0, I get lots of class not found errors like: java.lang.NoClassDefFoundError: javax/xml/ws/WebServiceContext I checked in the v2.0 jar file in my maven repo, and it doesn't contain this class. I checked the manifest for the jar file, and it says it's specification-version is 2.0. I was actually surprised to have to add any dependency at all, as I didn't see people doing this in the examples, and I thought the CXF poms would have handled it for me (transitive dependencies). Perhaps I have a bad version in my repo? Can you do an md5sum of your 2.0 jar and send it to me (or just send me your 2.0 pom and jar?) Thanks for the help. Richard On Tuesday 12 February 2008 14:29:45 Daniel Kulp wrote: What version of the JDK are you using? If you are using JDK 6, update 4, that's going to be an issue. (possibly any version of JDK 6) Also, I see: dependency groupIdjavax.xml.ws/groupId artifactIdjaxws-api/artifactId version2.1/version /dependency That's probably going to be a huge issue and may be the cause of the issue. CXF 2.0.x implements the JAX-WS 2.0 API, not the 2.1 API. (CXF 2.1/trunk is working towards the 2.1 API) Dan On Tuesday 12 February 2008, rsheldon wrote: This is driving me nuts, so hopefully somebody wiser than me can enlighten me. Here are the problems I've been having trying to use maven/cxf to generate code from a wsdl, then wire up a simple client via spring. Different versions of CXF have different behaviours/features/bugs: 2.0.2 - Generates code from WSDL with no error. When starting the client I get the following error: 2008-02-11 10:04:21,316 FATAL com.localmatters.ds.controller.search.WWWSearchController - No conduit initiator was found for the namespace http://schemas.xmlsoap.org/soap/http. javax.xml.ws.soap.SOAPFaultException: No conduit initiator was found for the namespace http://schemas.xmlsoap.org/soap/http. at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:175 ) If I add cxf-rt-transports-http-jetty.jar to my build (maven) then it works OK. However, I don't want to do this as I'm using tomcat, and don't want this dependency. So, I thought I would upgrade to 2.0.3 and see what happens. 2.0.3 gives me the following error when generating the code from wsdl, but stills runs and says it's successful (from maven): INFO: Refreshing [EMAIL PROTECTED]: display name [EMAIL PROTECTED]; startup date [Mon Feb 11 23:57:02 GMT-07:00 2008]; root of context hierarchy Feb 11, 2008 11:57:03 PM org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver initHandlerMappings WARNING: Ignoring namespace handler [org.apache.cxf.jaxws.spring.NamespaceHandler]: problem with handler class file or dependent class java.lang.IncompatibleClassChangeError: class org.apache.cxf.jaxws.EndpointImpl has interface javax.xml.ws.Endpoint as super class at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:620) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124 ) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$100(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at org.apache.cxf.jaxws.spring.EndpointDefinitionParser.init(EndpointDe finitionParser.java:50) at org.apache.cxf.jaxws.spring.NamespaceHandler.init(NamespaceHandler.jav a:29) As maven completed successfullly (it said so at least, despite the errors), I tried it in my application and it seems to work. 2.0.4 - I decided to try 2.0.4 out to see if it gave me the same errors generating code as 2.0.3. It DID, but this time the maven build fails with this cryptic message: [INFO] -- -- [ERROR] BUILD ERROR [INFO] -- -- [INFO] javax/xml/ws/RequestWrapper So I'm at a loss really. Am I missing some dependency, or have a wrong version of a library? I'd like to be using 2.0.4 if possible, but I can't even get the client generated code to compile! I've attached the relevant parts of the pom below, in case somebody can see any stupid mistakes. Thanks a lot, hope somebody can help this CXF newbie. I've been surfing the web for most of the day trying to work around these different issues. Richard dependencies
Re: Lazy instantiation of Web Service Client
Can you just use the lazy-init=true stuff built into spring? bean id=accountService lazy-init=true class=my.web.service.AccountService factory-bean=accountProxyFactory factory-method=create/ Dan On Tuesday 12 February 2008, rsheldon wrote: I've just started using CXF with Spring. I'm only using it to create SOAP WS clients (code generated from WSDL using CXF maven tools). I'd like to be able to have the services not connect on startup, but wait until they are first used - ie. lazy instantiation. Can this be done in CXF? Here's my very simple client configuration: bean id=accountProxyFactory class=org.apache.cxf.jaxws.JaxWsProxyFactoryBean property name=serviceClass value=my.web.service.AccountService/ property name=address value=${account.service}/ /bean bean id=accountService class=my.web.service.AccountService factory-bean=accountProxyFactory factory-method=create/ I can't see any attribute I can set on JaxWsProxyFactoryBean or it's parent ClientProxyFactoryBean that looks like it would work. There is a properties property, but I can't find a reference to the valid properties/values I can put into this map. Can anyone help?? Is there an attribute or property I can set to prevent immediate creation of the service? Many thanks, Richard Thanks Richard -- J. Daniel Kulp Principal Engineer, IONA [EMAIL PROTECTED] http://www.dankulp.com/blog
Re: CXF 2.0.3/2.0.4 Build problems with Maven and wsdl2java
What version of the JDK are you using? If you are using JDK 6, update 4, that's going to be an issue. (possibly any version of JDK 6) Also, I see: dependency groupIdjavax.xml.ws/groupId artifactIdjaxws-api/artifactId version2.1/version /dependency That's probably going to be a huge issue and may be the cause of the issue. CXF 2.0.x implements the JAX-WS 2.0 API, not the 2.1 API. (CXF 2.1/trunk is working towards the 2.1 API) Dan On Tuesday 12 February 2008, rsheldon wrote: This is driving me nuts, so hopefully somebody wiser than me can enlighten me. Here are the problems I've been having trying to use maven/cxf to generate code from a wsdl, then wire up a simple client via spring. Different versions of CXF have different behaviours/features/bugs: 2.0.2 - Generates code from WSDL with no error. When starting the client I get the following error: 2008-02-11 10:04:21,316 FATAL com.localmatters.ds.controller.search.WWWSearchController - No conduit initiator was found for the namespace http://schemas.xmlsoap.org/soap/http. javax.xml.ws.soap.SOAPFaultException: No conduit initiator was found for the namespace http://schemas.xmlsoap.org/soap/http. at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:175 ) If I add cxf-rt-transports-http-jetty.jar to my build (maven) then it works OK. However, I don't want to do this as I'm using tomcat, and don't want this dependency. So, I thought I would upgrade to 2.0.3 and see what happens. 2.0.3 gives me the following error when generating the code from wsdl, but stills runs and says it's successful (from maven): INFO: Refreshing [EMAIL PROTECTED]: display name [EMAIL PROTECTED]; startup date [Mon Feb 11 23:57:02 GMT-07:00 2008]; root of context hierarchy Feb 11, 2008 11:57:03 PM org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver initHandlerMappings WARNING: Ignoring namespace handler [org.apache.cxf.jaxws.spring.NamespaceHandler]: problem with handler class file or dependent class java.lang.IncompatibleClassChangeError: class org.apache.cxf.jaxws.EndpointImpl has interface javax.xml.ws.Endpoint as super class at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:620) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124 ) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$100(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at org.apache.cxf.jaxws.spring.EndpointDefinitionParser.init(EndpointDe finitionParser.java:50) at org.apache.cxf.jaxws.spring.NamespaceHandler.init(NamespaceHandler.jav a:29) As maven completed successfullly (it said so at least, despite the errors), I tried it in my application and it seems to work. 2.0.4 - I decided to try 2.0.4 out to see if it gave me the same errors generating code as 2.0.3. It DID, but this time the maven build fails with this cryptic message: [INFO] -- -- [ERROR] BUILD ERROR [INFO] -- -- [INFO] javax/xml/ws/RequestWrapper So I'm at a loss really. Am I missing some dependency, or have a wrong version of a library? I'd like to be using 2.0.4 if possible, but I can't even get the client generated code to compile! I've attached the relevant parts of the pom below, in case somebody can see any stupid mistakes. Thanks a lot, hope somebody can help this CXF newbie. I've been surfing the web for most of the day trying to work around these different issues. Richard dependencies dependency groupIdorg.apache.cxf/groupId artifactIdcxf-rt-frontend-jaxws/artifactId version2.0.4-incubator/version /dependency dependency groupIdorg.apache.cxf/groupId artifactIdcxf-rt-transports-http/artifactId version2.0.4-incubator/version /dependency !-- dependency groupIdorg.apache.cxf/groupId artifactIdcxf-rt-transports-http-jetty/artifactId version2.0.4-incubator/version /dependency -- dependency groupIdjavax.xml.ws/groupId artifactIdjaxws-api/artifactId version2.1/version /dependency /dependencies plugins plugin groupIdorg.apache.cxf/groupId
Returning ListFoo via SOAP
I'm using CXF 2.0.3. I have an interface with a method like: ListReviewData getAllReviews(@WebParam(name=token) String token); The WSDL created for this method is: xs:element name=getAllReviews type=tns:getAllReviews/ xs:complexType name=getAllReviews xs:sequence xs:element minOccurs=0 name=token type=xs:string/ /xs:sequence /xs:complexType xs:element name=getAllReviewsResponse type=tns:getAllReviewsResponse/ xs:complexType name=getAllReviewsResponse xs:sequence xs:element maxOccurs=unbounded minOccurs=0 name=return type=xs:anyType/ /xs:sequence /xs:complexType and so the generated SOAP client returns ListObject Is there any way to get a return type of ListReviewData (the ReviewData class generated by wsdl2java that is, not the original ReviewData in the remote interface) Thanks, Tom -- ATLASSIAN - http://www.atlassian.com Our products help over 8,500 customers in more than 95 countries to collaborate
Re: Lazy instantiation of Web Service Client
Thanks to everyone for their help on this. It turns out that despite some logging that made me think it was connecting to the web service, CXF actually doesn't talk to the remote server until it's first used. I double checked this with wireshark/ethereal. Thanks again, Richard -- View this message in context: http://www.nabble.com/Lazy-instantiation-of-Web-Service-Client-tp15427056p15446405.html Sent from the cxf-user mailing list archive at Nabble.com.
Re: Lazy instantiation of Web Service Client
Ian Roberts wrote: http://johnheintz.blogspot.com/2007/11/using-lazy-proxy-to-avoid-spring.html The LazyProxyFactoryBean shown in this post basically allows you to wrap up another Spring bean with a proxy that shows the same interface, but delays asking for the real bean until the first method call. Using this in combination with the lazy-init=true trick above should do what you're after. In fact, it turns out Spring has built-in support for exactly this using the AOP ProxyFactoryBean: bean id=accountProxyFactory class=org.apache.cxf.jaxws.JaxWsProxyFactoryBean lazy-init=true property name=serviceClass value=my.web.service.AccountService/ property name=address value=${account.service}/ /bean bean id=realAccountService class=my.web.service.AccountService factory-bean=accountProxyFactory factory-method=create lazy-init=true/ bean id=accountService class=org.springframework.aop.framework.ProxyFactoryBean property name=targetSource bean class=org.springframework.aop.target.LazyInitTargetSource property name=targetBeanName idref local=realAccountService/ /property /bean /property property name=proxyInterfaces value=my.web.service.AccountService / /bean Ian -- Ian Roberts | Department of Computer Science [EMAIL PROTECTED] | University of Sheffield, UK
Re: Webservice client sending null parameters to host
G'day all, I faced the same problem using JAXB binding, I debuged it, The code in method getPara() of DocLiteralInInterceptor class parameters.put(part, null); puts null parameters in the MessageContentsLists instance. replacing it with, parameters.put(part, dr.read(part, xmlReader)); results in right behavior. I may be wrong, but sharing my own experience with you all. With Regards, Mayank Daniel Kulp wrote: Any chance you can send a sample project that shows the problem? Kind of hard to diagnos this without more details. What version of CXF? Code first/wsdl first? Can I see the wsdl? Can you capture the soap message? JAXB/Aegis? etc Dan On Friday 08 February 2008, mrsv wrote: I have a cxf webservice and a client generated using wsdl2java. When the client tries to contact the service the parameters are being null. I am unable to figure out the reason.Tried including all the jars from cxf. Any answers are appreciated. Thanks
Unable to locate Spring NamespaceHandler.
Hi , I am getting the following exception while deploying the apllication. i dint understand the root cause for this one. please see the exception below. [2008-02-13 01:09:48,573] ERROR org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/mboxservice] Exception sending context initialized event to listener instance of class com.vms.mboxservice.listener.ContextListener org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://cxf.apache.org/jaxws] Offending resource: class path resource [app-context.xml] at org.springframework.beans.factory.parsing.FailFastProblemReporter.error( FailFastProblemReporter.java:68) I thought that , it was coming due to the inappropriate cxf-rt-frontend-jaxws jar file, and i tried with the 2.0.2 -2.0.3 versions, but there is no use.please give me ur ideas on this. i configured my spring file like following manner. beans xmlns=http://www.springframework.org/schema/beans; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xmlns:jaxws=http://cxf.apache.org/jaxws; xmlns:http-conf=http://cxf.apache.org/transports/http/configuration; 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; import resource=classpath:META-INF/cxf/cxf.xml / import resource=classpath:META-INF/cxf/cxf-extension-soap.xml / import resource=classpath:META-INF/cxf/cxf-servlet.xml / Thanks,
Re: CXF 2.0.3/2.0.4 Build problems with Maven and wsdl2java
I blew away the 2.0 stuff on our internal shared repo, and in my personal repo. I was able to build 2.0.3 and 2.0.4 without errors, and without the additional jaxws-api dependency. I don't really know where the shared versions on our repo came from. They'd been upload by hand a long time ago, as we only recently added the repositories that have these jars in them. Thanks very much for your help. Good job I didn't waste many hours on this :-( Richard On Tuesday 12 February 2008 15:04:40 Daniel Kulp wrote: My md5 is: 3bb1b336bec8f94af824b524b2bd515f jaxws-api-2.0.jar And there definitely is a WebServiceContext in there. I just checked: http://repo1.maven.org/maven2/javax/xml/ws/jaxws-api/2.0/ And is the same as what I have. Thus, I'm not sure where you got yours. :-) Seriously, I would try doing: rm -rf ~/.m2/repository/javax/xml/ws/jaxws-api and rebuilding and seeing what it finds and where it finds it. You're right. CXF should definitely be pulling in the correct version for you, but if there already is a 2.0 version there that is corrupt, it won't know that it's corrupt and thus won't re-try grabbing it. :-( Dan On Tuesday 12 February 2008, Richard Sheldon wrote: Daniel, I'm using JDK 5, build 1.5.0_13. If I specify jaxws-api 2.0, I get lots of class not found errors like: java.lang.NoClassDefFoundError: javax/xml/ws/WebServiceContext I checked in the v2.0 jar file in my maven repo, and it doesn't contain this class. I checked the manifest for the jar file, and it says it's specification-version is 2.0. I was actually surprised to have to add any dependency at all, as I didn't see people doing this in the examples, and I thought the CXF poms would have handled it for me (transitive dependencies). Perhaps I have a bad version in my repo? Can you do an md5sum of your 2.0 jar and send it to me (or just send me your 2.0 pom and jar?) Thanks for the help. Richard On Tuesday 12 February 2008 14:29:45 Daniel Kulp wrote: What version of the JDK are you using? If you are using JDK 6, update 4, that's going to be an issue. (possibly any version of JDK 6) Also, I see: dependency groupIdjavax.xml.ws/groupId artifactIdjaxws-api/artifactId version2.1/version /dependency That's probably going to be a huge issue and may be the cause of the issue. CXF 2.0.x implements the JAX-WS 2.0 API, not the 2.1 API. (CXF 2.1/trunk is working towards the 2.1 API) Dan On Tuesday 12 February 2008, rsheldon wrote: This is driving me nuts, so hopefully somebody wiser than me can enlighten me. Here are the problems I've been having trying to use maven/cxf to generate code from a wsdl, then wire up a simple client via spring. Different versions of CXF have different behaviours/features/bugs: 2.0.2 - Generates code from WSDL with no error. When starting the client I get the following error: 2008-02-11 10:04:21,316 FATAL com.localmatters.ds.controller.search.WWWSearchController - No conduit initiator was found for the namespace http://schemas.xmlsoap.org/soap/http. javax.xml.ws.soap.SOAPFaultException: No conduit initiator was found for the namespace http://schemas.xmlsoap.org/soap/http. at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java :175 ) If I add cxf-rt-transports-http-jetty.jar to my build (maven) then it works OK. However, I don't want to do this as I'm using tomcat, and don't want this dependency. So, I thought I would upgrade to 2.0.3 and see what happens. 2.0.3 gives me the following error when generating the code from wsdl, but stills runs and says it's successful (from maven): INFO: Refreshing [EMAIL PROTECTED]: display name [EMAIL PROTECTED]; startup date [Mon Feb 11 23:57:02 GMT-07:00 2008]; root of context hierarchy Feb 11, 2008 11:57:03 PM org.springframework.beans.factory.xml.DefaultNamespaceHandlerResol ver initHandlerMappings WARNING: Ignoring namespace handler [org.apache.cxf.jaxws.spring.NamespaceHandler]: problem with handler class file or dependent class java.lang.IncompatibleClassChangeError: class org.apache.cxf.jaxws.EndpointImpl has interface javax.xml.ws.Endpoint as super class at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:620) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java :124 ) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$100(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at
Re: SOAPMessage after Exception
Can I get some more information about what you are trying to do? Example: where in the processing pipeline are you trying to accomplish this? JAX-WS or other? Etc For the most part, the easiest thing to do is just do: import org.apache.cxf.binding.soap.SoapFault; . throw new SoapFault(ErroreProcessamento, SoapFault.FAULT_CODE_SERVER); That will pretty much work anywhere in the chains (except for in the outgoing chains after stuff has already been written, but now much anyone can do there if stuff has already been sent) or from your service or handlers or anything. Dan On Tuesday 12 February 2008, Cencio wrote: Hi all, i have this question: there is a way to generate a SOAPMessage from en exception or a fault? What i have to do when a creation of a fault message fails? In Axis i do it in this way, that don't raise any exception: return new org.apache.axis.Message(new AxisFault(ErroreProcessamento)); How can i generate a SOAPMessage with a fault and be sure that it don't fail? thx, Lorenzo -- J. Daniel Kulp Principal Engineer, IONA [EMAIL PROTECTED] http://www.dankulp.com/blog
Re: Webservice client sending null parameters to host
Any chance you can send a sample project that shows the problem? Kind of hard to diagnos this without more details. What version of CXF? Code first/wsdl first? Can I see the wsdl? Can you capture the soap message? JAXB/Aegis? etc Dan On Friday 08 February 2008, mrsv wrote: I have a cxf webservice and a client generated using wsdl2java. When the client tries to contact the service the parameters are being null. I am unable to figure out the reason.Tried including all the jars from cxf. Any answers are appreciated. Thanks -- J. Daniel Kulp Principal Engineer, IONA [EMAIL PROTECTED] http://www.dankulp.com/blog
Re: message context is null
Yep. That would do it. The creation of the JAXWS WebServiceContext is taken care of in the JAXWSMethodInvoker. I'm not sure what your custom invoker was doing, but possibly subclassing JAXWSMethodInvoker might make it work. In anycase, I'd be more than happy to refactor the JAXWSMethodInvoker a little bit to make subclassing it easier to get it to work. If you have suggestions (or better yet: a patch) feel free to post them here or in JIRA. Dan On Tuesday 12 February 2008, Mayank Thakore wrote: Found the panga. Seems my custom invoker was eating up the context. Works like a charm after removing the custom invoker. Regards Mayank -Original Message- From: Mayank Thakore [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 12, 2008 14:04 To: cxf-user@incubator.apache.org Subject: message context is null Hi, I inject the context into my service impl like this: @Resource private WebServiceContext context; The context is available during invocation, but when I do: MessageContext messageContext = context.getMessageContext(); The messageContext comes up null in Solaris. In Windows it comes fine. What am I doing wrong? Mayank ** ** This e-mail and attachments contain confidential information from HUAWEI, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient's) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it! -- J. Daniel Kulp Principal Engineer, IONA [EMAIL PROTECTED] http://www.dankulp.com/blog
Re: CXF 2.0.3/2.0.4 Build problems with Maven and wsdl2java
My md5 is: 3bb1b336bec8f94af824b524b2bd515f jaxws-api-2.0.jar And there definitely is a WebServiceContext in there. I just checked: http://repo1.maven.org/maven2/javax/xml/ws/jaxws-api/2.0/ And is the same as what I have. Thus, I'm not sure where you got yours. :-) Seriously, I would try doing: rm -rf ~/.m2/repository/javax/xml/ws/jaxws-api and rebuilding and seeing what it finds and where it finds it. You're right. CXF should definitely be pulling in the correct version for you, but if there already is a 2.0 version there that is corrupt, it won't know that it's corrupt and thus won't re-try grabbing it. :-( Dan On Tuesday 12 February 2008, Richard Sheldon wrote: Daniel, I'm using JDK 5, build 1.5.0_13. If I specify jaxws-api 2.0, I get lots of class not found errors like: java.lang.NoClassDefFoundError: javax/xml/ws/WebServiceContext I checked in the v2.0 jar file in my maven repo, and it doesn't contain this class. I checked the manifest for the jar file, and it says it's specification-version is 2.0. I was actually surprised to have to add any dependency at all, as I didn't see people doing this in the examples, and I thought the CXF poms would have handled it for me (transitive dependencies). Perhaps I have a bad version in my repo? Can you do an md5sum of your 2.0 jar and send it to me (or just send me your 2.0 pom and jar?) Thanks for the help. Richard On Tuesday 12 February 2008 14:29:45 Daniel Kulp wrote: What version of the JDK are you using? If you are using JDK 6, update 4, that's going to be an issue. (possibly any version of JDK 6) Also, I see: dependency groupIdjavax.xml.ws/groupId artifactIdjaxws-api/artifactId version2.1/version /dependency That's probably going to be a huge issue and may be the cause of the issue. CXF 2.0.x implements the JAX-WS 2.0 API, not the 2.1 API. (CXF 2.1/trunk is working towards the 2.1 API) Dan On Tuesday 12 February 2008, rsheldon wrote: This is driving me nuts, so hopefully somebody wiser than me can enlighten me. Here are the problems I've been having trying to use maven/cxf to generate code from a wsdl, then wire up a simple client via spring. Different versions of CXF have different behaviours/features/bugs: 2.0.2 - Generates code from WSDL with no error. When starting the client I get the following error: 2008-02-11 10:04:21,316 FATAL com.localmatters.ds.controller.search.WWWSearchController - No conduit initiator was found for the namespace http://schemas.xmlsoap.org/soap/http. javax.xml.ws.soap.SOAPFaultException: No conduit initiator was found for the namespace http://schemas.xmlsoap.org/soap/http. at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java :175 ) If I add cxf-rt-transports-http-jetty.jar to my build (maven) then it works OK. However, I don't want to do this as I'm using tomcat, and don't want this dependency. So, I thought I would upgrade to 2.0.3 and see what happens. 2.0.3 gives me the following error when generating the code from wsdl, but stills runs and says it's successful (from maven): INFO: Refreshing [EMAIL PROTECTED]: display name [EMAIL PROTECTED]; startup date [Mon Feb 11 23:57:02 GMT-07:00 2008]; root of context hierarchy Feb 11, 2008 11:57:03 PM org.springframework.beans.factory.xml.DefaultNamespaceHandlerResol ver initHandlerMappings WARNING: Ignoring namespace handler [org.apache.cxf.jaxws.spring.NamespaceHandler]: problem with handler class file or dependent class java.lang.IncompatibleClassChangeError: class org.apache.cxf.jaxws.EndpointImpl has interface javax.xml.ws.Endpoint as super class at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:620) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java :124 ) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$100(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at org.apache.cxf.jaxws.spring.EndpointDefinitionParser.init(Endpoi ntDe finitionParser.java:50) at org.apache.cxf.jaxws.spring.NamespaceHandler.init(NamespaceHandler .jav a:29) As maven completed successfullly (it said so at least, despite the errors), I tried it in my application and it seems to work. 2.0.4 - I decided to try 2.0.4 out to see if it gave me the same errors generating code as 2.0.3.
Re: Lazy instantiation of Web Service Client
Hi Richard Hi For the client instantiation, it just need to create the service model[1] first. If you add the wsdlLocation attribute in your SEI's WebService annotation or specify the wsdlLocation property for the JaxWsProxyFactoryBean with your service endpoint's address, the client will hit the service before you call the proxy's operation. Otherwise the client will not access service endpoint the before your start to call the proxy's operation. [1]http://cwiki.apache.org/CXF20DOC/cxf-architecture.html#CXFArchitecture-TheServiceModel Willem rsheldon wrote: I've just started using CXF with Spring. I'm only using it to create SOAP WS clients (code generated from WSDL using CXF maven tools). I'd like to be able to have the services not connect on startup, but wait until they are first used - ie. lazy instantiation. Can this be done in CXF? Here's my very simple client configuration: bean id=accountProxyFactory class=org.apache.cxf.jaxws.JaxWsProxyFactoryBean property name=serviceClass value=my.web.service.AccountService/ property name=address value=${account.service}/ /bean bean id=accountService class=my.web.service.AccountService factory-bean=accountProxyFactory factory-method=create/ I can't see any attribute I can set on JaxWsProxyFactoryBean or it's parent ClientProxyFactoryBean that looks like it would work. There is a properties property, but I can't find a reference to the valid properties/values I can put into this map. Can anyone help?? Is there an attribute or property I can set to prevent immediate creation of the service? Many thanks, Richard Thanks Richard
How to specify XSD for WSDL definition
I am new to CXF and have a few questions. I have used XFire before with good success, however this is a different use case and I'm not sure how to proceed. I want to create a web-service with a couple of simple methods where each of them have either a input or output that is a type defined by XSD and generated by JAXB 2.1 (lets call it JAXBGeneratedClass). That is, I have a jar with a JAXB generated type (JAXBGeneratedClass) that I want to pass through the web-service/wsdl. (JAXBGeneratedClass was generated with JAXB 2.1 and has annotations, I don't know if either is a problem as CXF, I think, is using JAXB 2.0.) For the other parameters in the web-service API I don't really care how they are marshaled because they are not later validating against an XSD. Another way of stating this is 'how do you pass data through a web-service that will be later validating against an XSD on the server?' (Note that I don't want to pass raw XML through the API because then the clients would not have a typesafe data-bound API to work with.) Per the web site docs I did setup a web-service class/interface using @WebService annotations and fired it up using the Jetty HTTP server, all is running but I have the following questions/problems. (I am using the maven build/configuration approach.) 1. It seems wrong that I am letting CXF 'figure out' how to marshal/data-bind JAXBGeneratedClass. It seems that it would be better to use the schema that generated JAXBGeneratedClass as part of the definition of the WSDL (where-ever in the API it uses JAXBGeneratedClass I should use the schema). What I am trying to do here is not only create a 'service' API but also I want to create client proxies in several languages, C++, Java, NET, etc and it is important that they all be generated such that when the data is passed to the web-service it is valid per the schema used to generate JAXBGeneratedClass. (Currently, it seems, that CXF does not know about my original XSD rather it is figuring out how to marshal something that was JAXB generated from my schema.) 2. How do I make sure that in all the client languages, the data is validated on the client. That is, I don't want them to guess what is required and what is optional (as specified in the schema) and only find out when the web-service API fails. Either the client generated code has to be generated such that instances cannot be created that are invalid or schema validation has to occur on the client as well. With JAXB, for instance, it just generates java beans with no validation; one doesn't know if the content is correct until it is saved to XML with validation. This would not work, it seems, because the client would never be 'saving' thus never be validating. I will try to generate a java client using CXF and see what it generates. If anyone can point me in the right direction on how to do this it would be much appreciated. -Dave -- View this message in context: http://www.nabble.com/How-to-specify-XSD-for-WSDL-definition-tp15433648p15433648.html Sent from the cxf-user mailing list archive at Nabble.com.
saml holder of key and CXF
Hi there, Does anybody have a sample demoing the use of SAML Hok, WSS4J and CXF? Any help appreciated! I have a code snippet at the end of this email but it keeps throwing the same exception: 12-Feb-2008 13:04:40 org.apache.cxf.endpoint.dynamic.DynamicClientFactory outputDebug INFO: Created classes: com.chemspider.ArrayOfString, com.chemspider.GetCompoundDetails, com.chemspider.GetCompoundDetailsResponse, com.chemspider.GetDatabases, com.chemspider.GetDatabasesResponse, com.chemspider.ObjectFactory, com.chemspider.SearchByFormula, com.chemspider.SearchByFormula2, com.chemspider.SearchByFormula2Response, com.chemspider.SearchByFormulaResponse, com.chemspider.SearchByMass, com.chemspider.SearchByMass2, com.chemspider.SearchByMass2Response, com.chemspider.SearchByMassResponse log4j:WARN No appenders could be found for logger (org.apache.xml.security.Init). log4j:WARN Please initialize the log4j system properly. java.lang.ClassCastException: com.sun.org.apache.xerces.internal.dom.DocumentImpl at com.sun.xml.messaging.saaj.soap.impl.ElementImpl.getOwnerDocument(Elemen tImpl.java:104) at com.sun.org.apache.xerces.internal.dom.ParentNode.internalInsertBefore(P arentNode.java:388) at com.sun.org.apache.xerces.internal.dom.ParentNode.insertBefore(ParentNod e.java:321) at com.sun.org.apache.xerces.internal.dom.NodeImpl.appendChild(NodeImpl.jav a:275) at org.opensaml.SAMLSubject.toDOM(Unknown Source) at org.opensaml.SAMLSubjectStatement.toDOM(Unknown Source) at org.opensaml.SAMLAuthenticationStatement.toDOM(Unknown Source) at org.opensaml.SAMLAssertion.toDOM(Unknown Source) at org.opensaml.SAMLObject.toDOM(Unknown Source) at org.opensaml.SAMLSignedObject.toDOM(Unknown Source) at org.opensaml.SAMLObject.toDOM(Unknown Source) at org.opensaml.SAMLSignedObject.sign(Unknown Source) at org.opensaml.SAMLSignedObject.sign(Unknown Source) at org.apache.ws.security.saml.SAMLIssuerImpl.newAssertion(SAMLIssuerImpl.j ava:193) at org.apache.ws.security.action.SAMLTokenSignedAction.execute(SAMLTokenSig nedAction.java:55) at org.apache.ws.security.handler.WSHandler.doSenderAction(WSHandler.java:1 92) at org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor.handleMessage(WSS4J OutInterceptor.java:169) at org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor.handleMessage(WSS4J OutInterceptor.java:43) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorC hain.java:208) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:276) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:222) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:180) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:200) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:186) at Test.testSAMLSignedHoK(Test.java:103) at Test.main(Test.java:129) public static void testSAMLSignedHoK(){ CXFBusFactory busFactory = new CXFBusFactory(); DynamicClientFactory f = DynamicClientFactory.newInstance(busFactory.createBus()); Client client = f.createClient(http://www.chemspider.com/massspecapi.asmx?WSDL;); client.getOutInterceptors().add(new org.apache.cxf.interceptor.LoggingOutInterceptor()); client.getInInterceptors().add(new org.apache.cxf.interceptor.LoggingInInterceptor()); MapString, Object configuration = new HashMapString,Object(); configuration.put(WSHandlerConstants.SAML_PROP_FILE,saml2.properties); configuration.put(WSHandlerConstants.ACTION,WSHandlerConstants.SAML_TOKE N_SIGNED ); configuration.put(WSHandlerConstants.SIG_PROP_REF_ID, C:/eclipse3.2.1/workspace/Kensington.SILVER/plugins/webservicestudio/te st/security/certs/clientKS.jks); configuration.put(WSHandlerConstants.PW_CALLBACK_REF, new CallbackHandler(){ public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { WSPasswordCallback pc = (WSPasswordCallback) callbacks[0]; pc.setPassword(change_on_install); }}); //configuration.put(WSHandlerConstants.SIG_KEY_ID, DirectReference); Properties properties = new Properties(); properties.put(org.apache.ws.security.crypto.provider,org.apache.ws.s ecurity.components.crypto.Merlin); properties.put(org.apache.ws.security.crypto.merlin.keystore.type,JKS ); properties.put(org.apache.ws.security.crypto.merlin.keystore.password, password); properties.put(org.apache.ws.security.crypto.merlin.file,C:/eclipse3. 2.1/workspace/Kensington.SILVER/plugins/webservicestudio/test/security/c erts/clientKS.jks);
RE: message context is null
Found the panga. Seems my custom invoker was eating up the context. Works like a charm after removing the custom invoker. Regards Mayank -Original Message- From: Mayank Thakore [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 12, 2008 14:04 To: cxf-user@incubator.apache.org Subject: message context is null Hi, I inject the context into my service impl like this: @Resource private WebServiceContext context; The context is available during invocation, but when I do: MessageContext messageContext = context.getMessageContext(); The messageContext comes up null in Solaris. In Windows it comes fine. What am I doing wrong? Mayank This e-mail and attachments contain confidential information from HUAWEI, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient's) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it!
Re: From byte[] to SOAPElement
Solved :) Thx anyway! Cencio wrote: Hi all, i have this problem... convert a byte array into a SOAPElement... i try passing by Document, but i fail :) Any idea? -- View this message in context: http://www.nabble.com/From-byte---to-SOAPElement-tp15429291p15433259.html Sent from the cxf-user mailing list archive at Nabble.com.