aspose file tools*
The moose likes Web Services and the fly likes Error : Invalid number of payload elements Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Error : Invalid number of payload elements" Watch "Error : Invalid number of payload elements" New topic
Author

Error : Invalid number of payload elements

akhil achuthan
Ranch Hand

Joined: Mar 29, 2006
Posts: 69
I have a web method with couple of arguments. Created .wsdl and its client code using axis.. When i try to connect to the web service method, I get an error saying that Invalid number of payload elements : 2

what does this mean?

The web methods with no arguments works just fine, but when i try to access the web methods with arguments, i get this error - Invalid number of payload elements : <no>

Even methods with arguments as primitive data types throws me this error...


Any help
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
Have you tried to connect to the web service using soapUI or similar tool?
If soapUI is able to communicate with the web service's operations that have parameters, then you should check what is in the requests that your client sends to the web service. This can be done using a packet sniffer or TCP monitoring tool.
Best wishes!
akhil achuthan
Ranch Hand

Joined: Mar 29, 2006
Posts: 69
I tried soapUI. Now the communication is much better.. I am not getting any error, but the arguments that i pass to the server are always arriving at the server end web method as null. No value is reaching the web service methods............
akhil achuthan
Ranch Hand

Joined: Mar 29, 2006
Posts: 69
I tried to get the data using wireshark... it shows all the xml request data at the server machine perfect.... but my server side web service method always receives null......

Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
So you have good request messages going into the web service, but once your endpoint implementation class is invoked, the parameters are null, correct?
If this is the case, then at least you have isolated the problem to the server side. I cannot really help you further, except for saying that it seems like something funny is going on when the SOAP request messages are bound to Java objects. Since you are using Axis, I assume you are not using JAXB to do the binding. If you were, I would ask you if the generated JAXB classes are up to date or not - perhaps there is something similar with the binding mechanism you use that you can check.
Another tactic would be to start from scratch with a working example of web service and client developed in the environment of your choice and gradually work your way towards the desired implementation, checking each step to make sure things work as they should. By taking small steps, you will hopefully be able to pinpoint the problem.
Best wishes!
akhil achuthan
Ranch Hand

Joined: Mar 29, 2006
Posts: 69
Seems like a problem with the wsdl generated by ant- axis.

The communication worked just fine, when instead of using the wsdl file generated by the axis build, i used the wsdl generated by jboss ( for jboss4 the location is <JBOSS_HOME>server\default\data\wsdl\<deploy_name>)on deployment of the web service...

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error : Invalid number of payload elements
 
Similar Threads
Axis 1.4 does not validate input parameters?
Passing Parameters to a Web Service
problem while invoking jaxrpc web service from java client
Find THE jar containing a class Axis2
OK to read the request body within a filter?