Re: Axis2/POJO: Caveats with data classes?
It is addition of getters and setters which fix the problem, Thanks Deepal Jeremy wrote: > Deepal Jayasinghe wrote: > >> Hi Jeremy , >> by changing your SomeType as shown below, I was able to fix the issue. >> > > Hey Deepal, > Thanks for looking into the problem. It's interesting that this fixes > it. I wonder if it's the change from object-based fields (e.g. > Integer) to native language typed fields (e.g. int), or the addition > of the getter/setter methods? In any case, I suppose I should have > adhered to JavaBean-ish standards in the first place. Thanks for the > solution! > > Jeremy > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- Thanks, Deepal "The highest tower is built one brick at a time" - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Axis2/POJO: Caveats with data classes?
Deepal Jayasinghe wrote: Hi Jeremy , by changing your SomeType as shown below, I was able to fix the issue. Hey Deepal, Thanks for looking into the problem. It's interesting that this fixes it. I wonder if it's the change from object-based fields (e.g. Integer) to native language typed fields (e.g. int), or the addition of the getter/setter methods? In any case, I suppose I should have adhered to JavaBean-ish standards in the first place. Thanks for the solution! Jeremy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Axis2/POJO: Caveats with data classes?
Hi Jeremy , by changing your SomeType as shown below, I was able to fix the issue. public class SomeType { public int foo; public int bar; public float baz; public int getFoo() { return foo; } public void setFoo(int foo) { this.foo = foo; } public int getBar() { return bar; } public void setBar(int bar) { this.bar = bar; } public float getBaz() { return baz; } public void setBaz(float baz) { this.baz = baz; } } > Martin Gainty wrote: > >> Hello Jeremy >> >> here is one an example which identifies a POJO named >> sample.pojo.service.WeatherService. >>> name="ServiceClass">sample.pojo.service.WeatherService >> > I did set up the services.xml, and the web service is fine except that > the parameters are not being passed properly. > > I came up with this example to show what I'm doing; maybe someone can > tell me where I went wrong. There is one service class (BasicExample) > and one auxiliary class that essentially functions as a struct (or a > ComplexType in SOAP). > > //---BasicExample.java > > package guy.jeremy.examples; > > public class BasicExample > { > public Boolean doomedToFail(SomeType parameter) >{ >if(parameter == null) >return Boolean.FALSE; > return Boolean.TRUE; >} > public BasicExample() >{ > } > } > //- > > //---SomeType.java > > package guy.jeremy.examples; > > public class SomeType > { >public Integer foo; >public Integer bar; >public Float baz; > } > > //--- > > > I send this SOAP message: > > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";> > >xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"; > xmlns:ns="http://examples.jeremy.guy/xsd"; > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; > xmlns:xsd="http://www.w3.org/2001/XMLSchema";> > >52.2 >78 >95 > > > > > > > and get back a "false", meaning the parameter was recieved as null > even though it was clearly passed in. > > > What am I doing wrong here? > > > Thanks, > Jeremy > > > > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- Thanks, Deepal "The highest tower is built one brick at a time" - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Axis2/POJO: Caveats with data classes?
Martin Gainty wrote: Hello Jeremy here is one an example which identifies a POJO named sample.pojo.service.WeatherService. name="ServiceClass">sample.pojo.service.WeatherService I did set up the services.xml, and the web service is fine except that the parameters are not being passed properly. I came up with this example to show what I'm doing; maybe someone can tell me where I went wrong. There is one service class (BasicExample) and one auxiliary class that essentially functions as a struct (or a ComplexType in SOAP). //---BasicExample.java package guy.jeremy.examples; public class BasicExample { public Boolean doomedToFail(SomeType parameter) { if(parameter == null) return Boolean.FALSE; return Boolean.TRUE; } public BasicExample() { } } //- //---SomeType.java package guy.jeremy.examples; public class SomeType { public Integer foo; public Integer bar; public Float baz; } //--- I send this SOAP message: http://schemas.xmlsoap.org/soap/envelope/";> http://schemas.xmlsoap.org/soap/encoding/"; xmlns:ns="http://examples.jeremy.guy/xsd"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:xsd="http://www.w3.org/2001/XMLSchema";> 52.2 78 95 and get back a "false", meaning the parameter was recieved as null even though it was clearly passed in. What am I doing wrong here? Thanks, Jeremy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Axis2/POJO: Caveats with data classes?
Hello Jeremy assuming you're working with AXIS2 v1.1 available at http://archive.apache.org/dist/ws/axis/1_1rc2/ There exists a configuration for the service at the bottom of /META-INF/services.xml which should display a series of parameter definitions which define the pojo classes here is one an example which identifies a POJO named sample.pojo.service.WeatherService. name="ServiceClass">sample.pojo.service.WeatherService the examples from axis-2.1.1 specifically axis2-1.1\rampart-1.1\axis2-1.1\samples\pojoguide\README.txt should explain //Building the Service $ant from Axis2_HOME/samples/pojoguide //Running the Client $ant rpc.client HTH/ Martin-- This email message and any files transmitted with it contain confidential information intended only for the person(s) to whom this email message is addressed. If you have received this email message in error, please notify the sender immediately by telephone or email and destroy the original message without making a copy. Thank you. - Original Message - From: "Jeremy" <[EMAIL PROTECTED]> To: Sent: Monday, May 07, 2007 9:25 PM Subject: Axis2/POJO: Caveats with data classes? I've got a POJO-based service running. In the same package as the service class, I also have some public data classes that are used by the service. This one method I am testing accepts one of the data classes (User) as a parameter. Whenever this method is invoked via SOAP, the parameter comes up as null (which eventually leads to a NullPointerException and then to a java.lang.reflect.InvocationTargetException) despite the fact that it was passed in via SOAP. Is there a reason for this? The User type shows up just fine in the WSDL, and the client (SOAPScope) clearly doesn't see anything wrong until the SOAP fault comes back. Is there something else I need to do to make these data classes usable from SOAP? I tried invoking my service method manually through a java program and everything went fine - so it's somewhere in the SOAP dispatcher that things are going wrong. I thought this might be a common problem so I'd ask the mailing list. Any ideas? I'm kind of an Axis/Tomcat newbie (in case it wasn't obvious) but I'm pretty well-versed with Java. Thanks, Jeremy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]