Hey, the problem is that you have a custom object aka PurchaseOrder as an argument to the method in the service class. Axis does not know how to serialize it i.e. represent it as a WSDL request message. You need to define a custom serializer for this object. This url may be a kick-start.
Document/Literal web services are typically designed WSDL first. I.e. you design your Purchase Order XML Schema, reference the schema in your WSDL and then use WSDL2Java. Then you write the "glue code" to map the generated stubs to your existing objects. Patterns and Strategies for Building Document-Based Web Services
Custom serialization usually results in RPC/encoded web services. [ July 31, 2007: Message edited by: Peer Reynders ]
Hi Nishant and Peer, thanks you so much for sending over your valuable comments. In mycase I need to generate WSDL file from the Java classes as posted above where I need to run - java2wsdl on AXIS. When I try to run the command java2Wsdl there only I do encounter this error, that forbids me to generate WSDL file. Could you suggest some good websites where a complete example is given using Object as an argument (like my case), that I can refer for my document/literal type webservices.
With the WTP (Web Tools Platform), you can (in Eclipse), click on any JavaBean in a Dynamic Web Project, and see an option for "Web Services-->Generate WebService" or something like that. It has the option of using Axis APIs/libraries that you can choose in one of the dialogs that pop up when you do this.
You may have more luck with this. It can also generate the Java proxy to access/test the web service as well.
If you have IBM Rational Application Developer, then this functionality comes automatically, though you may have to 'enable' the web services Capability under Windows-->Preferences.
Joined: Aug 19, 2005
You have to create a deploy.wsdd (WSDD Reference) for Java2WSDL and in it specify the bean mapping or type mapping for PurchaseOrder.
If your PurchaseOrder class follows JavaBean conventions then you can get away with a beanMapping. Encoding Your Beans - the BeanSerializer(look for axis/samples/userguide/example5) (Don't forget the -y DOCUMENT option on Java2WSDL (literal is implied for DOCUMENT))
Otherwise you need a typeMapping - this requires you to code your own serializer and deserializer - i.e. you still have to design the XML that is equivalent to your class yourself. Moreover this implies RPC/encoded - not Document/literal. When Beans Are Not Enough - Custom Serialization
Joined: Dec 02, 2005
Thanks a lot Peer and Jimmy, I'm going to try it out as suggested by you.