aspose file tools*
The moose likes Web Services and the fly likes Null response object from Java Web Service Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Null response object from Java Web Service" Watch "Null response object from Java Web Service" New topic
Author

Null response object from Java Web Service

Anthony D'Souz
Ranch Hand

Joined: Oct 13, 2011
Posts: 64
I tried running the Web Service as a java application by adding a main method in the service, i got all the model values getting populated perfectly. There are some DAO operations with Oracle 10g DB, have classes12.jar in my classpath.

Then i created a wsdl and tested it in SOAP UI. There I can see that the service is returning a null object as response.

The wsdl was created using Apache AXIS v1.4.

This means the wsdl getting generated is not correct since all my code is working fine when i run it as java client application.

Additional Info:

When the return type of a method present in the web service is integer, then the value is getting returned correctly while invoking the Web Service using SOAP UI. But when i try to return a model, a null response object is returned.



Please help. Ask if you need some more information about this.

Regards,
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12804
    
    5
I don't understand this sentence:
I tried running the Web Service as a java application by adding a main method in the service,


A web service is usually hosted by a web "container" which provides the logic for listening at a port and composing a request object, also creating a response object.

In your modified service code, what performs these functions?

Bill
Anthony D'Souz
Ranch Hand

Joined: Oct 13, 2011
Posts: 64
Hi,

Thanks for a reply.

I wrote the Web service. Basically, in the service layer, we have all the signatures of the methods(i.e. the return typr, method name and parameters to be passed for the method) which will be exposed to the outside world by sharing the WSDL file.

Just for testing purpose, i added a main method in the service layer(which contains all the method signature). Then i invoked all the methods one by one inside the main method and tested it by running the file as a java application. In this way i did the unit testing of each and every method present in the web service.

Finally, once confirmed that everything is working fine, i removed the main method and created the WSDL file for my service by New => Web Service option.

Hope you understand what i am trying to explain.

Please help me out of this, if you want some further information then please ask.

Regards,
Anthony D'Souz
Ranch Hand

Joined: Oct 13, 2011
Posts: 64
something like this:

William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12804
    
    5
Let me try another approach since you seem to have missed my point entirely.

Your Java client or SOAPUI creates an HTTP request to your web service.

In you stand alone java application run from a main method, what receives this request? How?

Bill


Anthony D'Souz
Ranch Hand

Joined: Oct 13, 2011
Posts: 64
Hi Bill,

empId is the request related information that the method of my service is expecting.

EmployeeDetails is the model which will be returned by my service.

I apologise if i did n't get you this time also.

Another thing I am noticing is like when i create the WSDL, then the _SEI is not created for my service. Again, the _helper, _ser and _deser are not getting created for the model.

Thanks & Regards,
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12804
    
    5
You keep answering questions I have not asked.

What is hosting your web service? Something has to receive the socket connection created by the client software HTTP request. What is it?

For example, Tomcat web server can host a web service application. Getting a "null object as response" may indicate that the host did not recognize the request. Tomcat can record each attempt to connect - the log would show how your client is trying to connect.

bill
James Boswell
Bartender

Joined: Nov 09, 2011
Posts: 1030
    
    5

William Brogden wrote:Let me try another approach since you seem to have missed my point entirely.

Your Java client or SOAPUI creates an HTTP request to your web service.

In you stand alone java application run from a main method, what receives this request? How?

Bill




Bill

He is using the main method to unit test the backend methods outside of a web container. I am assuming the input to these methods from the main method are simply populated POJOs.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12804
    
    5
So if the methods work, the debugging question is - is the request getting through to the web service code. Thats why I keep asking about what is hosting the service.

Bill
Anthony D'Souz
Ranch Hand

Joined: Oct 13, 2011
Posts: 64
Hi James,

Thanks for your reply.
You got it correct. Since its called by a main method for unit testing, hence its simple POJO. Thats why i posted the code for the main method present in the service layer.

Hi Bill,

Thanks for your reply.
It is hosted in Apache Tomcat v6.0. While creating the web service, i commented out the main method(posted above for unit testing). Hence the main method is not present in the generated WSDL file.

Please ask if you have further queries. Please inform how to make it work

Another surprising thing is while creating the web service, i cant see any _SEI, or any of the ser,deser or helper getting generated. WHY?

Thanks & Regards,
Anthony D'Souz
Ranch Hand

Joined: Oct 13, 2011
Posts: 64
Hi Bill/James,

Ok fine I solved the problem. The problem was with the connection with DB issue. I placed the jar file classes12.jar in the lib folder of WEB_INF and it worked for me.

I am not able to understand a few things:

1) Why is there no _SEI, ser, deser and helper created (i asked in the previous post)

2) what are the use of _SEI, ser, deser and helper files? In IBM RSA and WebSphere i can see these files (in that case I use the RPC approach, use the webservices.jar rather than using axis.jar). Is it like these generated files are needed for AXIS but not for IBM RPC?

Totally confused with these two questions

Please clear my confusion.

Regards,
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Null response object from Java Web Service