You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Dave <em...@gmail.com> on 2006/02/27 22:49:12 UTC

[AXIS1.3] Service method returns null while it should return a object?

Hi all,

For a school assignment, we have to use axis. We have deployed a webservice
succesfully but it doesnt return the correct value. First of all, the
webservice is ok, the beanmappings are fine, everything thats has to be in
the code and in the deploy.wsdd file is present. So there is nothing wrong
with any of those. The problem that occures is the following:

There's a class Tour with the folowing attributes and constructor:
    private long id;
    private String name;
    private Welcome welcome;
    public Tour(long id, String name, Welcome welcome)

The class Welcome has the folowing attributes and constructor:
    private long id;
    private String title;
    private String text;
    private byte[] picture;
    public Welcome(String title, String text, byte[] picture)

We run a service that does the following when you call it:
    Welcome w=new Welcome("title welcome", "text welcome", null);
    return new Tour(0, "name tour", w);

When we deploy this service and try to use it with a client everything goes
fine. In our client we recieve an object of the class Tour with all the data
present. There's an object Welcome in the object Tour with the title, test,
and null for the figure (it's just testdata).

Now we adjust the service:
    return new Tour(0, "name tour", null);

Here the problem occures. Suddenly our client recieves null for the object
Tour... We enabled the soap monitor to track the SOAP message, and the soap
message looks fine, there's an object of the class Tour and the String 'name
tour' and the id '0' is present in the message. Also the null of the Welcome
object is present, something like 'nil=true' is in the soap message for the
Welcome part. The class Welcome is nillable (as we can see in the wsdl
created by axis).
It is pretty strange that axis suddenly returns null for the Tour object
because one of its params is null...

Is there somebody who has experience with this problem or can help us out
cause we don't have a clue what the problem could be this time.

We had the same problem with a TestObjectService (a row of objects turns
null because one of the params of those objects is null)... How can this
happen???


thanks in advance
Dave and Fre

Re: [AXIS1.3] Service method returns null while it should return a object?

Posted by Dave <Em...@gmail.com>.
Well, we've just got our service up and running perfect!

The problem was we didnt had a default constructor in the class Tour... 
yes, really stupid!

You always have to follow the 3 rules of JavaBean:
1) Public getters en setters for properties
2) at least a no-arg contructor
3) implement java.io.Serializable

when you use those 3 your service should not be doing strange things 
like ours did.

greetings
Dave



Dave wrote:
> Hi all,
> 
> For a school assignment, we have to use axis. We have deployed a 
> webservice succesfully but it doesnt return the correct value. First of 
> all, the webservice is ok, the beanmappings are fine, everything thats 
> has to be in the code and in the deploy.wsdd file is present. So there 
> is nothing wrong with any of those. The problem that occures is the 
> following:
> 
> There's a class Tour with the folowing attributes and constructor:
>     private long id;
>     private String name;
>     private Welcome welcome;
>     public Tour(long id, String name, Welcome welcome)
> 
> The class Welcome has the folowing attributes and constructor:
>     private long id;
>     private String title;
>     private String text;
>     private byte[] picture;
>     public Welcome(String title, String text, byte[] picture)
> 
> We run a service that does the following when you call it:
>     Welcome w=new Welcome("title welcome", "text welcome", null);
>     return new Tour(0, "name tour", w);
> 
> When we deploy this service and try to use it with a client everything 
> goes fine. In our client we recieve an object of the class Tour with all 
> the data present. There's an object Welcome in the object Tour with the 
> title, test, and null for the figure (it's just testdata).
> 
> Now we adjust the service:
>     return new Tour(0, "name tour", null);
> 
> Here the problem occures. Suddenly our client recieves null for the 
> object Tour... We enabled the soap monitor to track the SOAP message, 
> and the soap message looks fine, there's an object of the class Tour and 
> the String 'name tour' and the id '0' is present in the message. Also 
> the null of the Welcome object is present, something like 'nil=true' is 
> in the soap message for the Welcome part. The class Welcome is nillable 
> (as we can see in the wsdl created by axis).
> It is pretty strange that axis suddenly returns null for the Tour object 
> because one of its params is null...
> 
> Is there somebody who has experience with this problem or can help us 
> out cause we don't have a clue what the problem could be this time.
> 
> We had the same problem with a TestObjectService (a row of objects turns 
> null because one of the params of those objects is null)... How can this 
> happen???
> 
> 
> thanks in advance
> Dave and Fre