Re: java2wsdl -> wsdl2java lossy? (newbie alert!)
Hi list, I apologise in advance for my ignorance but I am trying to convert my Axis 1 SOAP client/services to CXF, and as a complete newbie to CXF and JAXB, am having quite a few difficulties. My latest issue is the same as a recent correspondent (Brett) in that my web service interface methods that ought to return arrays are being converted into java.util.Lists. Also some of my original java prototype interface methods had throws RemoteException clauses which apparently do not propogate through the WSDL to the generated java source. On the first issue, James Mao replied to Brett: --- Yes, There are two ways Put the customization section into your schema in the wsdl, or change it to an external style, and feed the 'binding file' to the > wsdl2java -b $YOUR_BINDNIG_FILE - Trying to use the second method, I have a bindings.jxb file that looks like the following, where ./PfC.wsdl is m java2wsdl generated file: http://java.sun.com/xml/ns/jaxb"; xmlns:wsdl="http://schemas.xmlsoap.org/wsdl"; xmlns:xsd="http://www.w3.org/2001/XMLSchema"; > Unfortunately it doesn't seem to work for me when I run wsdl2java -b bindings.jxb ... because, although it runs without throwing any exsceptions, the array return methods still return java.util.Lists As I mentioned, I am a complete novice to this, so would appreciate if someone could provide a more explicit answer (and also a pointer to how to solve the exception returning problem) Should I have explicitly annotated all the array return methods in my original java prototype interface somehow? Many thanks Doug P.S. running wsdl2java - 2.0-incubator
Re: java2wsdl -> wsdl2java lossy? (newbie alert!)
If I explicitly modify the generated WSDL file as follows: http://www.w3.org/2001/XMLSchema"; xmlns:tns="urn:srv" attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="urn:srv" xmlns:jxb="http://java.sun.com/xml/ns/jaxb"; jxb:version="1.0" > [snip] [cut] then wsdl2java runs without any exceptions and I still end up with java.util.List responses: @WebService(targetNamespace = "urn:srv", name = "PfC") public interface PfC { @ResponseWrapper(targetNamespace = "urn:srv", className = "au.net.mmsn.pfc.servlet.pfcws.GetApplicationPushletIDsResponse", localName = "getApplicationPushletIDsResponse") @RequestWrapper(targetNamespace = "urn:srv", className = "au.net.mmsn.pfc.servlet.pfcws.GetApplicationPushletIDs", localName = "getApplicationPushletIDs") @WebResult(targetNamespace = "", name = "return") @WebMethod public java.util.List getApplicationPushletIDs(); My original prototype interface was: @WebService(name="PfC", targetNamespace="urn:srv", serviceName="PfCService", portName="PfC") @SOAPBinding(style=Style.DOCUMENT, use=Use.LITERAL, parameterStyle = ParameterStyle.WRAPPED) public interface PfC extends java.rmi.Remote { // primary pushlet url public java.lang.String getPushletURL() throws java.rmi.RemoteException; public java.lang.String[] getApplicationPushletIDs() throws java.rmi.RemoteException; ... The commandline was: wsdl2java -verbose -server -compile -classdir /home/timeout/ddb/MMSN/gridsphere-2.2.7/projects/pfc/build/classes -impl -d /home/timeout/ddb/MMSN/gridsphere-2.2.7/projects/pfc/src -p au.net.mmsn.pfc.servlet.pfcws PfC.wsdl wsdl2java - 2.0-incubator Changing the collectionType attribute to an ArrayList has no effect iether. Hope somone can see what I am doing wrong. thanks Doug On Thursday 09 August 2007 17:00, doug wrote: > Hi list, > I apologise in advance for my ignorance but I am trying to > convert my Axis 1 SOAP client/services to CXF, and as a complete > newbie to CXF and JAXB, am having quite a few difficulties. > > My latest issue is the same as a recent correspondent (Brett) in that my > web service interface methods that ought to return arrays are being > converted into java.util.Lists. > > Also some of my original java prototype interface methods had >throws RemoteException > clauses which apparently do not propogate through the WSDL to the > generated java source. > > On the first issue, James Mao replied to Brett: > --- > Yes, There are two ways > > Put the customization section into your schema in the wsdl, > > > > > > > > > or change it to an external style, and feed the 'binding file' to the > > > wsdl2java -b $YOUR_BINDNIG_FILE > > - > > Trying to use the second method, I have a bindings.jxb file that > looks like the following, where ./PfC.wsdl is m > java2wsdl generated file: > >xmlns:jxb="http://java.sun.com/xml/ns/jaxb"; > xmlns:wsdl="http://schemas.xmlsoap.org/wsdl"; > xmlns:xsd="http://www.w3.org/2001/XMLSchema"; > > > > > > > > Unfortunately it doesn't seem to work for me when I run > wsdl2java -b bindings.jxb ... > because, although it runs without throwing any exsceptions, > the array return methods still return java.util.Lists > As I mentioned, I am a complete novice to this, so would > appreciate if someone could provide a more explicit answer > (and also a pointer to how to solve the exception returning problem) > > Should I have explicitly annotated all the array return methods in my > original java prototype interface somehow? > > Many thanks > Doug > > P.S. running wsdl2java - 2.0-incubator
Re: java2wsdl -> wsdl2java lossy? (newbie alert!)
Ok, thanks for your advice Brett, James. I'll ponder the options over several beers, probably forget, and probably be back with follow up troubles next week. Thanks again Doug On Friday 10 August 2007 15:50, Brett Wooldridge wrote: > Jaxws ri claims to support MTOM but I have not used it. A web search > revealed that it's been in for about 18 months, so maybe it's baked > (depends on how much use it's gotten). Re: String[], I bit the bullet and > performed the refactor on our code, but we didn't have nearly as many > methods returning arrays (of any type) as you. > > I did notice one interesting thing in my refactor, because we use the new > Java5 'for' looping construct often in our code meant very little of the > code had to change, i.e.: > > String[] foos = service.doSomething(); > for (String foo : foos) > { >... > } > > Refactored seamlessly to: > > > List foos = service.doSomething(); > for (String foo : foos) > { >... > } > > Everything "just worked". There was a very few places where we did > something like foos[0] that we had to change to foos.get(0). >
Re: java2wsdl -> wsdl2java lossy? (newbie alert!)
Hi James, On Friday 10 August 2007 13:03, James Mao wrote: > Well, i tried yesterday, i have the same results as you gave, the > previous binding file is not correct, you can not put the wsdl location > inside the schemaLocation. Oh. That bit actually seemed to work, in the sense that changing the node to something like node="/xsd:schema/annotation/appinfo" throws exceptions owing to an empty nodeset or some such, but throws no such errors if I actually added the annotation and appinfo elements to the schema. Of course it didn't influence the generated WS interface at all. > The interface really did not change, what changed is the type class, you > can see there is String[], but it use the List indeed > I also tried the jaxws ri, what i got is the same results. > > I guess you must use String[] here, so hope someone else can shed some > lights here. Well, I have about 5 services, each with around 10 or so String[] return methods. I would prefer not to change the client and server code to use Lists if I could avoid it, but will do what I have to do I guess. I heard good things about MTOM for file transfer so I want to stick to a solution where its accessible. Not sure that jaxws ri supports it. Am still looking for insight into the server side Exception throwing aspects, if anyone had any pointers? Thanks Doug > > If I explicitly modify the generated WSDL file as follows: > > > > > > http://www.w3.org/2001/XMLSchema"; > > xmlns:tns="urn:srv" > > attributeFormDefault="unqualified" > > elementFormDefault="unqualified" > > targetNamespace="urn:srv" > > xmlns:jxb="http://java.sun.com/xml/ns/jaxb"; > > jxb:version="1.0" > > > > > > > > > > > > > > > > > [snip] > > > > > > > > > type="xs:string"/> > > > > > > > > [cut] > > > > then wsdl2java runs without any exceptions and I still end up with > > java.util.List responses: > > > > @WebService(targetNamespace = "urn:srv", name = "PfC") > > public interface PfC { > > @ResponseWrapper(targetNamespace = "urn:srv", className > > = "au.net.mmsn.pfc.servlet.pfcws.GetApplicationPushletIDsResponse", > > localName = "getApplicationPushletIDsResponse") > > @RequestWrapper(targetNamespace = "urn:srv", className > > = "au.net.mmsn.pfc.servlet.pfcws.GetApplicationPushletIDs", localName > > = "getApplicationPushletIDs") > > @WebResult(targetNamespace = "", name = "return") > > @WebMethod > > public java.util.List getApplicationPushletIDs(); > > > > > > My original prototype interface was: > > > > @WebService(name="PfC", > > targetNamespace="urn:srv", > > serviceName="PfCService", > > portName="PfC") > > @SOAPBinding(style=Style.DOCUMENT, use=Use.LITERAL, > > parameterStyle = ParameterStyle.WRAPPED) > > public interface PfC extends java.rmi.Remote { > > // primary pushlet url > > public java.lang.String getPushletURL() throws > > java.rmi.RemoteException; public java.lang.String[] > > getApplicationPushletIDs() throws > > java.rmi.RemoteException; > > ... > > > > > > The commandline was: > > wsdl2java -verbose -server -compile -classdir > > /home/timeout/ddb/MMSN/gridsphere-2.2.7/projects/pfc/build/classes -impl > > -d /home/timeout/ddb/MMSN/gridsphere-2.2.7/projects/pfc/src -p > > au.net.mmsn.pfc.servlet.pfcws PfC.wsdl > > wsdl2java - 2.0-incubator > > > > > > Changing the collectionType attribute to an ArrayList has no effect > > iether. > > > > > > Hope somone can see what I am doing wrong. > > thanks > > Doug > > > > On Thursday 09 August 2007 17:00, doug wrote: > >> Hi list, > >> I apologise in advance for my ignorance but I am trying to > >> convert my Axis 1 SOAP client/services to CXF, and as a complete > >> newbie to CXF and JAXB, am having quite a few difficulties. > >> > >> My latest issue is the same as a recent correspondent (Brett) in that my > >> web service interface methods that ought to return arrays are being > >> converted into java.util.Lists. > >> > >> Also some of my original java prototype interface methods had > >>throws RemoteException > >> clauses
problem with @WebFault annotation
I am trying to compile a subclass of java.lang.Exception with the @WebFault annotation drawn from jaxb-api-2.0.jar of the apache-cxf-2.0.1-incubator.tar.gz binary package. import javax.xml.ws.WebFault; @WebFault(name="PfCServiceFault", faultName="au.net.mmsn.pfc.servlet.PfCServiceFault") public class PfCServiceFault extends Exception { ... } Unfortunately when I compile that I get the compilation error PfCServiceFault.java:6: cannot find symbol symbol : method faultName() location: @interface javax.xml.ws.WebFault faultName="au.net.mmsn.pfc.servlet.PfCServiceFault") ^ 1 error Is that normal? I am using javac 1.5.0_06 on linux. I was hoping that the faultName might propogate through into the imports of the wsdl2java created interface and its implementation (because it doesn't seem to curently) Thanks for any advice. Doug
Re: problem with @WebFault annotation
sun-j2sdk1.5_1.5.0 I think this is the standard edition rather than the enterprise edition. Would that make a difference? On Tuesday 14 August 2007 17:06, Velidanda Srinivas wrote: > Check the JDK version, it should be working if you are compiling with JDK > 5.0, also jaxb-api-2.0.jar in the classpath. > > > -Original Message- > > From: doug [mailto:[EMAIL PROTECTED] > > Sent: 14 August 2007 12:38 > > To: cxf-user@incubator.apache.org > > Subject: problem with @WebFault annotation > > > > > > I am trying to compile a subclass of java.lang.Exception with the > > @WebFault annotation drawn from jaxb-api-2.0.jar of the > > apache-cxf-2.0.1-incubator.tar.gz binary package. > > > > import javax.xml.ws.WebFault; > > @WebFault(name="PfCServiceFault", > > faultName="au.net.mmsn.pfc.servlet.PfCServiceFault") > > public class PfCServiceFault extends Exception { > > ... > > } > > > > Unfortunately when I compile that I get the compilation error > > > > PfCServiceFault.java:6: cannot find symbol > > symbol : method faultName() > > location: @interface javax.xml.ws.WebFault > > faultName="au.net.mmsn.pfc.servlet.PfCServiceFault") > > ^ > > 1 error > > > > Is that normal? > > I am using javac 1.5.0_06 on linux. > > I was hoping that the faultName might propogate through into > > the imports of the wsdl2java created interface and its implementation > > (because it doesn't seem to curently) > > > > Thanks for any advice. > > Doug > > > > __ > > __ > > This e-mail has been scanned for all viruses by MessageLabs. > > __ > > __ > > > This e-mail has been scanned for all viruses by MessageLabs. > > To learn more about Singularity's business process management solutions and > services please visit: www.singularity.co.uk > www.singularity.us.com > Singularity operates globally through its offices in New York, London, > Singapore, Ireland and India. Singularity Limited is incorporated in the > United Kingdom with Registration Number NI 31519 and its Registered Office > at 100 Patrick Street, Derry, BT48 7EL, United Kingdom.
CXF based applet client jars
I am wondering if there is a list someplace of all the jar files needed by a simple CXF based service consumer (client)? and then the additions needed to use MTOM? thanks Doug
CXF client applet ServiceConstructionException
Hi, I think I have my server set up ok because if I visit this page: http://192.168.98.46:8080/pfc/services/ I get a list of the services I implemented: {http://impl.chat.serbices.servlet.pfc.mmsn.net.au/}ChatServiceImplPort {http://impl.rfio.serbices.servlet.pfc.mmsn.net.au/}RemoteFileImplPort {http://impl.imageshare.serbices.servlet.pfc.mmsn.net.au/}ImShServiceImplPort {http://impl.rfio.serbices.servlet.pfc.mmsn.net.au/}RemoteFileSystemImplPort {http://impl.rfio.serbices.servlet.pfc.mmsn.net.au/}RemoteFileIOImplPort {http://impl.serbices.servlet.pfc.mmsn.net.au/}PfCServicesImplPort The last one is a link to http://192.168.98.46:8080/pfc/services/PfC?wsdl and serves up the appropriate wsdl description of the PfC interface. The problem is that when I try to get a handle on the PfC interface from within my client applet, I end up with the error: org.apache.cxf.service.factory.ServiceConstructionException: Could not find definition for service {urn:srv}PfCService. I used the following client side code (both the client and server side service code were generated from wsdl2java): serviceAddress = "http://"; + (String)configOpts.get("hostName") + ":" + (String)configOpts.get("port") + serviceURI +"?wsdl"; // i.e. http://192.168.98.46:8080/pfc/services/PfC?wsdl URL url = new URL(serviceAddress); QName SERVICE = new QName("urn:srv", "PfCService"); PfCService service = new PfCService(url, SERVICE ); PfC pfc = service.getPfC(); Sorry, I am new to all this, so likely I am doing something foolish. Hope this is enough to work from. Thanks for any insights Doug
Re: CXF client applet ServiceConstructionException
I get the following WSDL, but I am not sure exactly what the Service QName should be trying to match. Thanks Doug http://impl.serbices.servlet.pfc.mmsn.net.au/";> http://192.168.98.46:8080/pfc/services/PfC?wsdl=PfC.wsdl"; namespace="urn:srv"/> http://schemas.xmlsoap.org/soap/http"/> [snip] http://192.168.98.46:8080/pfc/services/PfC"/> On Wednesday 22 August 2007 13:10, Willem Jiang wrote: > Hi > It looks like the Service Name is not a right one from the exception's > message. > Please check the Service QName with the wsdl which you get from the > > http://192.168.98.46:8080/pfc/services/PfC?wsdl > > > Willem. > > doug wrote: > > Hi, > > I think I have my server set up ok because if I visit this page: > > http://192.168.98.46:8080/pfc/services/ > > I get a list of the services I implemented: > > > > {http://impl.chat.serbices.servlet.pfc.mmsn.net.au/}ChatServiceImplPort > > {http://impl.rfio.serbices.servlet.pfc.mmsn.net.au/}RemoteFileImplPort > > {http://impl.imageshare.serbices.servlet.pfc.mmsn.net.au/}ImShServiceImpl > >Port > > {http://impl.rfio.serbices.servlet.pfc.mmsn.net.au/}RemoteFileSystemImplP > >ort > > {http://impl.rfio.serbices.servlet.pfc.mmsn.net.au/}RemoteFileIOImplPort > > {http://impl.serbices.servlet.pfc.mmsn.net.au/}PfCServicesImplPort > > > > The last one is a link to http://192.168.98.46:8080/pfc/services/PfC?wsdl > > and serves up the appropriate wsdl description of the PfC interface. > > > > The problem is that when I try to get a handle on the PfC interface from > > within my client applet, I end up with the error: > > > > org.apache.cxf.service.factory.ServiceConstructionException: > > Could not find definition for service {urn:srv}PfCService. > > > > I used the following client side code (both the client and server side > > service code were generated from wsdl2java): > > > > serviceAddress = "http://"; + (String)configOpts.get("hostName") + ":" + > > (String)configOpts.get("port") + serviceURI > > +"?wsdl"; > > // i.e. http://192.168.98.46:8080/pfc/services/PfC?wsdl > > URL url = new URL(serviceAddress); > > QName SERVICE = new QName("urn:srv", "PfCService"); > > PfCService service = new PfCService(url, SERVICE ); > > PfC pfc = service.getPfC(); > > > > Sorry, I am new to all this, so likely I am doing something foolish. > > Hope this is enough to work from. > > Thanks for any insights > > Doug
Re: CXF client applet ServiceConstructionException
Thanks Willem. Ok, that morphed the exception into: javax.xml.ws.WebServiceException: Port {urn:srv}PfC not found. My wsdl2java generated PfC_PfC_Client.java file records it as: private static final QName SERVICE_NAME = new QName("urn:srv", "PfCService"); I'm guessing I've screwed up my original java2wsdl and wsdl2java commands somehow? I started with a PfC java interface file with the package line: package au.net.mmsn.pfc.servlet.pfcws; Built the wsdl as: SERVICE=PfC SPACKAGE="au.net.mmsn.pfc.servlet.pfcws" ${CXF}/bin/java2wsdl -verbose -o ${SERVICE}.wsdl -d . -s ./jaxws \ -classdir ./jaxws \ -cp ./jaxws \ -servicename "${SERVICE}Service" \ -portname "${SERVICE}" \ ${SPACKAGE}.${SERVICE} built the client as: CPACKAGE=au.net.mmsn.pfc.client.pfcws ${CXF}/bin/wsdl2java -verbose -client \ -compile \ -classdir ${CPROJBIN} \ -impl \ -d ${CPROJSRC} \ -p ${CPACKAGE} \ ${SERVICE}.wsdl and server as: SPACKAGE="au.net.mmsn.pfc.servlet.pfcws" ${CXF}/bin/wsdl2java -verbose -server \ -compile \ -classdir ${SPROJBIN} \ -impl \ -d ${SPROJSRC} \ -p ${SPACKAGE} \ ${SERVICE}.wsdl Thanks again Doug On Wednesday 22 August 2007 14:11, Willem Jiang wrote: > The Service QName should be > > QName SERVICE = new QName("http://impl.serbices.servlet.pfc.mmsn.net.au/ > ", "PfCServicesImplService"); > > > Willem. > > doug wrote: > > I get the following WSDL, but I am not sure exactly what the Service > > QName should be trying to match. > > Thanks > > Doug > > > > > targetNamespace="http://impl.serbices.servlet.pfc.mmsn.net.au/";> > > > location="http://192.168.98.46:8080/pfc/services/PfC?wsdl=PfC.wsdl"; > > namespace="urn:srv"/> > > > > > transport="http://schemas.xmlsoap.org/soap/http"/> > > > > > > > > [snip] > > > > > > > > > name="PfCServicesImplPort"> > > http://192.168.98.46:8080/pfc/services/PfC"/> > > > > > > > > > > On Wednesday 22 August 2007 13:10, Willem Jiang wrote: > >> Hi > >> It looks like the Service Name is not a right one from the exception's > >> message. > >> Please check the Service QName with the wsdl which you get from the > >> > >> http://192.168.98.46:8080/pfc/services/PfC?wsdl > >> > >> > >> Willem. > >> > >> doug wrote: > >>> Hi, > >>> I think I have my server set up ok because if I visit this page: > >>> http://192.168.98.46:8080/pfc/services/ > >>> I get a list of the services I implemented: > >>> > >>> {http://impl.chat.serbices.servlet.pfc.mmsn.net.au/}ChatServiceImplPort > >>> {http://impl.rfio.serbices.servlet.pfc.mmsn.net.au/}RemoteFileImplPort > >>> {http://impl.imageshare.serbices.servlet.pfc.mmsn.net.au/}ImShServiceIm > >>>pl Port > >>> {http://impl.rfio.serbices.servlet.pfc.mmsn.net.au/}RemoteFileSystemImp > >>>lP ort > >>> {http://impl.rfio.serbices.servlet.pfc.mmsn.net.au/}RemoteFileIOImplPor > >>>t {http://impl.serbices.servlet.pfc.mmsn.net.au/}PfCServicesImplPort > >>> > >>> The last one is a link to > >>> http://192.168.98.46:8080/pfc/services/PfC?wsdl and serves up the > >>> appropriate wsdl description of the PfC interface. > >>> > >>> The problem is that when I try to get a handle on the PfC interface > >>> from within my client applet, I end up with the error: > >>> > >>> org.apache.cxf.service.factory.ServiceConstructionException: > >>> Could not find definition for service {urn:srv}PfCService. > >>> > >>> I used the following client side code (both the client and server side > >>> service code were generated from wsdl2java): > >>> > >>> serviceAddress = "http://"; + (String)configOpts.get("hostName") + ":" > >>> + (String)configOpts.get("port") + serviceURI +"?wsdl"; > >>> // i.e. http://192.168.98.46:8080/pfc/services/PfC?wsdl > >>> URL url = new URL(serviceAddress); > >>> QName SERVICE = new QName("urn:srv", "PfCService"); > >>> PfCService service = new PfCService(url, SERVICE ); > >>> PfC pfc = service.getPfC(); > >>> > >>> Sorry, I am new to all this, so likely I am doing something foolish. > >>> Hope this is enough to work from. > >>> Thanks for any insights > >>> Doug
jaxws:endpoint and depends-on attribute
I have implemented some services and configure them in a WEB-INF/beans.xml file. I was using this file to specify some initialization parameters that get stored in a bean (FileUtilities) and which are subsequently accessed by several other jaxws:endpoint definedservices. I thought everything was configured ok because all services are loaded without problems on my development server, running apache-tomcat-5.5.20 Unfortunately when I try to deploy to our production server, apache-tomcat-5.5.16 it fails to load, on account of the error below. Basically, it seems to me that the FileUtilities bean hasn't been loaded or initialized at the time the endpoint is being instatiated, whereas it was under tomcat 5.5.20. I read that there is a attribute that induces otherID beans to be loaded and initialized first, but apparently that doesn't exist for jaxws:endpoint Is there another way to achieve the same result? Thanks Doug 879 [main] ERROR org.springframework.web.context.ContextLoader - Context initialization failed org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext r esource [/WEB-INF/beans.xml]; nested exception is org.springframework.beans.FatalBeanException: Could not load class: au.net.mm sn.pfc.servlet.serbices.rfio.impl.RemoteFileImpl; nested exception is java.lang.NullPointerException Caused by: org.springframework.beans.FatalBeanException: Could not load class: au.net.mmsn.pfc.servlet.serbices.rfio.impl.RemoteFileImpl; nested exception is java.lang.NullPointerException Caused by: java.lang.NullPointerException at au.net.mmsn.pfc.servlet.serbices.rfio.impl.FileUtilities.getServicePreference(FileUtilities.java:76) at au.net.mmsn.pfc.servlet.serbices.rfio.impl.RemoteFileImpl.(RemoteFileImpl.java:29) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
Re: jaxws:endpoint and depends-on attribute
Hi Willem, Thanks to you both for that. Now the depends-on attribute parses ok in the jaxws:endpoint elements of the beans.xml file, but I still have the same error as before. i.e. it doesn't seem to have preloaded the depends-on bean. thanks again Doug On Thursday 06 September 2007 17:56, Willem Jiang wrote: > Hi doug , > > I just committed a patch CXF-955 which is contributed by Fred into the > trunk. > It added the depends-on attribute in the jaxws:endpoint. I think you > just want that :) > > You can try latest version in the trunk , or wait for the next snapshot. > > Willem. > > doug wrote: > > I have implemented some services and configure them in a > > WEB-INF/beans.xml file. I was using this file to specify some > > initialization parameters that get stored in a bean (FileUtilities) > > and which are subsequently accessed by several other jaxws:endpoint > > definedservices. I thought everything was configured ok because all > > services are loaded without problems on my development server, running > > apache-tomcat-5.5.20 Unfortunately when I try to deploy to our > > production server, apache-tomcat-5.5.16 it fails to load, on account of > > the error below. > > > > Basically, it seems to me that the FileUtilities bean hasn't been > > loaded or initialized at the time the endpoint is being instatiated, > > whereas it was under tomcat 5.5.20. > > > > I read that there is a attribute that induces > > otherID beans to be loaded and initialized first, but apparently that > > doesn't exist for jaxws:endpoint > > > > Is there another way to achieve the same result? > > > > Thanks > > Doug > > > > > > > > 879 [main] ERROR org.springframework.web.context.ContextLoader - > > Context initialization failed > > org.springframework.beans.factory.BeanDefinitionStoreException: > > Unexpected exception parsing XML document from ServletContext r > > esource [/WEB-INF/beans.xml]; nested exception is > > org.springframework.beans.FatalBeanException: Could not load class: > > au.net.mm sn.pfc.servlet.serbices.rfio.impl.RemoteFileImpl; nested > > exception is java.lang.NullPointerException > > Caused by: > > org.springframework.beans.FatalBeanException: Could not load class: > > au.net.mmsn.pfc.servlet.serbices.rfio.impl.RemoteFileImpl; > > nested exception is java.lang.NullPointerException > > Caused by: > > java.lang.NullPointerException > > at > > au.net.mmsn.pfc.servlet.serbices.rfio.impl.FileUtilities.getServicePrefer > >ence(FileUtilities.java:76) at > > au.net.mmsn.pfc.servlet.serbices.rfio.impl.RemoteFileImpl.(RemoteFi > >leImpl.java:29) at > > sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) > > at > > sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAc > >cessorImpl.java:39) at > > sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConst > >ructorAccessorImpl.java:27) at > > java.lang.reflect.Constructor.newInstance(Constructor.java:494)
Re: jaxws:endpoint and depends-on attribute
Thank you Willem, and many apologies for wasting your time. I just discovered an hour ago that apparently I accidently had two versions of the compiled classfiles floating aroundand the older tomcat loaded preferentially from WEB-INF/classes whereas the newer tomcat loaded from my WEB-INF/lib/ jar file (discovered after rewriting the class to eliminate any traces of servicePreference and still getting the same error with bogus line numbers) Now my server loads and works, but my applet client still takes forever to properly establish a connection - as I described in another email: http://www.nabble.com/CXF-based-applet-initialization-worries-tf4375613.html#a12472137 Basically the applet is making about 200 calls to the server for nonexistent jaxb.properties files and http://192.168.98.46:8080/pfc/lib/jaxb-impl-2.0.5.jar I have no idea what the significance of that is, but it adds about 2 to 5 minutes to the startup time of the applet. Also, the jar file was already downloaded and cached by the JRE. Any insights into this one would be much appreciated! Thanks again Doug On Wednesday 12 September 2007 11:55, Willem Jiang wrote: > Hi Doug, > > After I reviewed your stack trace , I just found you need to set the > servicePreference in the FileUtilities first. > > Willem. > > java.lang.NullPointerException > > > > at > > > au.net.mmsn.pfc.servlet.serbices.rfio.impl.FileUtilities.getServicePref > > >er ence(FileUtilities.java:76) at > > > au.net.mmsn.pfc.servlet.serbices.rfio.impl.RemoteFileImpl.(Remote > > >Fi leImpl.java:29) at > > > sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) > > doug wrote: > > Hi Willem, > > Thanks to you both for that. > > Now the depends-on attribute parses ok in the jaxws:endpoint elements of > > the beans.xml file, but I still have the same error as before. i.e. it > > doesn't seem to have preloaded the depends-on bean. > > > > thanks again > > Doug > > > > On Thursday 06 September 2007 17:56, Willem Jiang wrote: > >> Hi doug , > >> > >> I just committed a patch CXF-955 which is contributed by Fred into the > >> trunk. > >> It added the depends-on attribute in the jaxws:endpoint. I think you > >> just want that :) > >> > >> You can try latest version in the trunk , or wait for the next snapshot. > >> > >> Willem. > >> > >> doug wrote: > >>> I have implemented some services and configure them in a > >>> WEB-INF/beans.xml file. I was using this file to specify some > >>> initialization parameters that get stored in a bean (FileUtilities) > >>> and which are subsequently accessed by several other jaxws:endpoint > >>> definedservices. I thought everything was configured ok because all > >>> services are loaded without problems on my development server, running > >>> apache-tomcat-5.5.20 Unfortunately when I try to deploy to our > >>> production server, apache-tomcat-5.5.16 it fails to load, on account of > >>> the error below. > >>> > >>> Basically, it seems to me that the FileUtilities bean hasn't been > >>> loaded or initialized at the time the endpoint is being instatiated, > >>> whereas it was under tomcat 5.5.20. > >>> > >>> I read that there is a attribute that > >>> induces otherID beans to be loaded and initialized first, but > >>> apparently that doesn't exist for jaxws:endpoint > >>> > >>> Is there another way to achieve the same result? > >>> > >>> Thanks > >>> Doug > >>> > >>> > >>> > >>> 879 [main] ERROR org.springframework.web.context.ContextLoader - > >>> Context initialization failed > >>> org.springframework.beans.factory.BeanDefinitionStoreException: > >>> Unexpected exception parsing XML document from ServletContext r > >>> esource [/WEB-INF/beans.xml]; nested exception is > >>> org.springframework.beans.FatalBeanException: Could not load class: > >>> au.net.mm sn.pfc.servlet.serbices.rfio.impl.RemoteFileImpl; nested > >>> exception is java.lang.NullPointerException > >>> Caused by: > >>> org.springframework.beans.FatalBeanException: Could not load class: > >>> au.net.mmsn.pfc.servlet.serbices.rfio.impl.RemoteFileImpl; > >>> nested exception is java.lang.NullPointerException > >>> Caused by: > >>> java.lang.NullPointerException > >>> at > >>> au.net.mmsn.pfc.servlet.serbices.rfio.impl.FileUtilities.getServicePref > >>>er ence(FileUtilities.java:76) at > >>> au.net.mmsn.pfc.servlet.serbices.rfio.impl.RemoteFileImpl.(Remote > >>>Fi leImpl.java:29) at > >>> sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) > >>> at > >>> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructor > >>>Ac cessorImpl.java:39) at > >>> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingCon > >>>st ructorAccessorImpl.java:27) at > >>> java.lang.reflect.Constructor.newInstance(Constructor.java:494)
JSR-311 and JAXB and JSON
Hi, I am trying to set up a JSR-311 REST "like" service and POSTing a string of JSON to my /service/init/{id} address. The server seems to recognise the address because catalina.out reports: Mar 18, 2008 11:11:37 AM org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor handleMessage INFO: Found operation: init The problem is that my init service function is never actually called. I figure that something is going wrong with the JAXB? interpretation of my JSON data. Is there some way to switch on debugging of this process to see what is or isn't going on? After the above server message my client connection eventually just times out. I am just assuming that consuming application/json works ...? @POST @Path("init/{clientId}") @ProduceMime("text/plain") @ConsumeMime("application/json") public String init(@UriParam("clientId") String id, @HttpContext UriInfo info, CrystalParameters cp) { System.out.println("---received the sucker!--"); MultivaluedMap params = info.getQueryParameters(); // nothing happening here yet ... String url = "/ReflnCover/" + id + "/basic"; return url; } Thanks Doug P.S. I'm using apache-cxf-2.1-incubator-20080306.021818-37.zip under apache-tomcat-5.5.20 on kubuntu.
Re: JSR-311 and JAXB and JSON
Thanks Sergey, I think it is a problem with the format of my JSON. I can actually get my service to respond by POSTing the following equivalent XML: 5.05.05.0 5.05.05.0 50.0 1.00.00.00.01.0 0.00.00.01.0 50.050.0 50.00.7 54.7450.2- 0.0-15.00.0Omega 130.0-28.85.0 54.7450.2- 0.0-15.0120.0Omega 130.0-28.85.0 but POSTing this JSON string doesn't work: {"CrystalParameters":{"machineData":{"wavelength":0.71069, "d2x":[1,0,0,0,1,0,0,0,1], "leftOffset":0.05,"rightOffset":0.05,"upperOffset":0.05,"bottomOffset":0.05}, "scanData":[{"scan":"Omega","detector":50.2,"twotheta":-28.8,"omega":-15, "phi":0,"chi":54.74,"width":5,"sweep":130,"direction":"-"}, {"scan":"Omega","detector":50.2,"twotheta":-28.8,"omega":-15, "phi":120,"chi":54.74,"width":5,"sweep":130,"direction":"-"}], "crystalData":{"a":5,"b":5,"c":5,"alpha":90,"beta":90,"gamma":90}}} Actually if I strip it down to just: {"CrystalParameters":{"crystalData": {"a":5,"b":5,"c":5,"alpha":90,"beta":90,"gamma":90}}} then the service calls init correctly, but if I try to include any kind of array data in the JSON string then the init just never gets called, e.g. {"CrystalParameters":{"crystalData": {"a":5,"b":5,"c":5,"alpha":90,"beta":90,"gamma":90, "ub"=[0.2,0,0,0,0.2,0,0,0,0.2]}}} Do arrays need some special treatment? ub, like d2x above is expected to be just java type double[]. Thanks Doug
Re: JSR-311 and JAXB and JSON
Actually there is something funny going wrong with the JSON emitted by the JAXRS process. This was just a dummy service to see the output format: @GET @Path("get/{clientId}") @ProduceMime("application/json") public CrystalParameters dummy(@UriParam("clientId") String id, @HttpContext UriInfo info) { CrystalParameters cpn = new CrystalParameters(); MachineData md = new MachineData(); md.setWavelength(0.7); md.setD2x(new double[] {1.0,0,0,0,1.0,0,0,0,1.}); md.setBottomOffset(50.);md.setUpperOffset(50.); md.setLeftOffset(50.); md.setRightOffset(50.); cpn.setMachineData(md); return cpn; } When I did a wget on this service it gave me JSON: {"CrystalParameters":{"machineData":{"bottomOffset":50,"d2x": [1,0,0,0,1,0,0,0,1,50,50,50,0.7]}}} the XML precursor was, from my previous email: 50.0 1.00.00.00.01.0 0.00.00.01.0 50.050.0 50.00.7 i.e., the d2x array soaked up all trailing MachineData bean parameters in the emitted JSON representation. So unless there is some JAXB annotation stuff for arrays in java beans, I'm guessing both the in and out JSON to XML JAXRS convertors may be broken? Thanks for any info. Doug
Re: Base class members not serializing / deserializing
On Sun, 6 Apr 2008, Brad O'Hearne wrote: > I've moved to 2.1 SNAPSHOT -- my @UriTemplate annotations still won't > compile. Is there another dependency needed? > I think @UriTemplate was deprecated/replaced by @Path by the JSR-311 folks, but their spec documents aren't uptodate (thats my understanding anyway) Something like the following works for me (from the 2.1 SNAPSHOT): import javax.ws.rs.Path; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.core.HttpContext; import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.ProduceMime; import javax.ws.rs.ConsumeMime; import javax.ws.rs.UriParam; import javax.ws.rs.WebApplicationException; @Path("/rc") public class ReflectionCoverageService { @POST @Path("init/{clientId}") @ProduceMime("text/plain") public String init(@UriParam("clientId") String id, @HttpContext UriInfo info, SomeJavaBeanClass sjbc) { MultivaluedMap params = info.getQueryParameters();
Re: Base class members not serializing / deserializing
On Sun, 6 Apr 2008, Brad O'Hearne wrote: > Thanks for the reply. Couple things -- first, @UriParam is now > apparently @PathParam. Additionally, I cannot get the paths to work. I > repeatedly get Tomcat errors that there's "No operation matching > request path...", and others like itstill a black artI'd love > to get this worked out, as I've got jax-rs loaded, I just need to be > able to hit it now. I've tried about every URL combination > possibleno dice. @PathParam may well be the next JSR-311 incarnation, but at least for apache-cxf-2.1-incubator-20080306.021818-37.zip the annotation that works, for me, is @Path. Specifically, using my previous example, I have a tomcat webapps project "reflncover" which I access by the URL: http://localhost:8080/reflncover/svc/rc/init/myclientid?arg1=val1&arg2=val2 The "svc" component of the URL originates from the WEB-INF/web.xml file: CXFServlet /svc/* Also, in my beans.xml file (referenced by web.xml) I have: It works for me. Originally I had a bit of trouble figuring the format of the XML to POST to my /init/ REST service, so I ended up creating a dummy @GET service URL that returned a dummy bean class (as XML) that I created and populated within my ReflectionCovergeService class (below). Once I had that then submitting the same XML structure back "just worked". Hope this helps. Doug > Prior to your post, I had reverted back to my Jax-WS frontend, and I > discovered that inheritance IS working on serialization (outbound > serialization on return types) but is NOT working on deserialization > (inbound deserialization of XML to Java types on parameters). The > problem is definitely there. Not sure what you mean by "inheritance" here. I looked briefly at JAX-WS but wrapping everything in SOAP headers wasn't flexible enough for my needs. Hope this helps Doug > > On Apr 5, 2008, at 7:54 PM, Doug wrote: > > On Sun, 6 Apr 2008, Brad O'Hearne wrote: > >> I've moved to 2.1 SNAPSHOT -- my @UriTemplate annotations still won't > >> compile. Is there another dependency needed? > > > > I think @UriTemplate was deprecated/replaced by @Path by the JSR-311 > > folks, > > but their spec documents aren't uptodate (thats my understanding > > anyway) > > > > > > Something like the following works for me (from the 2.1 SNAPSHOT): > > > > import javax.ws.rs.Path; > > import javax.ws.rs.GET; > > import javax.ws.rs.POST; > > import javax.ws.rs.core.HttpContext; > > import javax.ws.rs.core.HttpHeaders; > > import javax.ws.rs.core.Response; > > import javax.ws.rs.core.UriInfo; > > import javax.ws.rs.core.MultivaluedMap; > > import javax.ws.rs.ProduceMime; > > import javax.ws.rs.ConsumeMime; > > import javax.ws.rs.UriParam; > > import javax.ws.rs.WebApplicationException; > > > > @Path("/rc") > > public class ReflectionCoverageService { > > > > @POST > > @Path("init/{clientId}") > > @ProduceMime("text/plain") > > public String init(@UriParam("clientId") String id, @HttpContext > > UriInfo > > info, SomeJavaBeanClass sjbc) { > > MultivaluedMap params = info.getQueryParameters();
Re: jax-rs URLs not working (was: Base class members not serializing / deserializing)
Maybe the annotations have to go in the implementation class instead/as well? I didn't use an "interface" - just an instantiatable class (with method bodies). Apart from broken POST data, thats the only other thing I can think of. Doug On Mon, 7 Apr 2008, Brad O'Hearne wrote: > Doug, > > Thanks for the reply. I'm still getting the same errors, going to show > you exactly what happens in my implementation. Here is my web.xml: > > PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" > "http://java.sun.com/dtd/web-app_2_3.dtd";> > > > contextConfigLocation > WEB-INF/beans.xml > > > > org.springframework.web.context.ContextLoaderListener > > > > CXFServlet > CXF Servlet > > org.apache.cxf.transport.servlet.CXFServlet > > 1 > > > CXFServlet > /services/* > > > > Here is my beans.xml: > > > http://www.springframework.org/schema/beans"; > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; > xmlns:jaxrs="http://cxf.apache.org/jaxrs"; > xsi:schemaLocation=" > http://www.springframework.org/schema/beans > http://www.springframework.org/schema/beans/spring-beans.xsd > http://cxf.apache.org/jaxrs > http://cxf.apache.org/schemas/jaxrs.xsd";> > > > resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml" /> > > > > class="com.brad.UserService" /> > > > > > Here is my service interface (which is implemented by the UserService > class referenced in beans.xml): > > @Path("/UserService") > public interface IUserService { > @POST > @Path("authenticate") > @ConsumeMime("application/xml") > @ProduceMime("application/xml") > AuthenticateResponse authenticate(AuthenticateRequest request); > } > > Tomcat loads cleanly (as far as I can tell -- no exceptions). When I > try to access this service with an xml payload and the following URL: > http://localhost:8080/MyWebApp/services/UserService/authenticate > > I get the following exception on the server: > > Apr 6, 2008 7:38:46 AM > org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor handleMessage > SEVERE: No operation found for path: /UserService/authenticate/, > contentType: application/xml, Accept contentType: */* > Apr 6, 2008 7:38:46 AM org.apache.cxf.phase.PhaseInterceptorChain > doIntercept > INFO: Interceptor has thrown exception, unwinding now > org.apache.cxf.interceptor.Fault: .No operation matching request path / > UserService/authenticate/ is found, ContentType : application/xml, > Accept : */*. > at > org > .apache > .cxf > .jaxrs > .interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java: > 120) > at > org > .apache > .cxf > .phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220) > at > org > .apache > .cxf > .transport > .ChainInitiationObserver.onMessage(ChainInitiationObserver.java:78) > at > org > .apache > .cxf > .transport.servlet.ServletDestination.invoke(ServletDestination.java:92) > at > org > .apache > .cxf > .transport > .servlet.ServletController.invokeDestination(ServletController.java:214) > at > org > .apache > .cxf.transport.servlet.ServletController.invoke(ServletController.java: > 113) > at > org > .apache > .cxf > .transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java: > 170) > at > org > .apache > .cxf > .transport.servlet.AbstractCXFServlet.doPost(AbstractCXFServlet.java: > 148) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:710) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) > at > org > .apache > .catalina > .core > .ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java: > 290) > at > org > .apache > .catalina > .core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) > at > org > .apache > .catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java: > 233) > at > org > .apache > .catalina.core.StandardContextValve.invoke(StandardContextValve.java: >