File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes Parameter names in wsdl - axis2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Parameter names in wsdl - axis2" Watch "Parameter names in wsdl - axis2" New topic
Author

Parameter names in wsdl - axis2

Dudley Dawson
Ranch Hand

Joined: Dec 14, 2004
Posts: 57
Hi-
how can I have my service method parameter names exposed in the WSDL in axis2?
Currently, the wsdl is created as:


Why are they specified as "param0" and "param1", this is not very descriptive to the client.

Thanks
Arafat Nalkhande
Ranch Hand

Joined: Jul 20, 2006
Posts: 51
Correct me if I am wrong but as far as I can see these are not service method parameter names but are complex type definition defined in <types>

If so tell me how are you generating the WSDL.
When you use the ant task provided by axis it generates the WSDL with proper names.

Following is an example of the WSDL that I generated for a complex type using the ant task



I want to be myself, but a better myself.<br />~ SCJP 1.4 (91%), SCWCD 1.4 (86%) ~
Dudley Dawson
Ranch Hand

Joined: Dec 14, 2004
Posts: 57
The wsdl was generated live by the axis war. I believe that it is the type definition that a client will use to create stub objects, correct?
Shariq Roomi
Ranch Hand

Joined: Oct 19, 2004
Posts: 31
Dudley, I am laso having the same issue with Axis2. I looked into sample apps of Axis2, they also have same problem. This wsdl is useless then as I can't asl client to use param0, param1 etc.Please share if you find any work around.


Arafat, this wsdl is generated by accessing localhost:8080.services.
Arafat Nalkhande
Ranch Hand

Joined: Jul 20, 2006
Posts: 51
Dudley, you are right. Thats the type definition that the client will be using.
Shariq, the wsdl generated is not useless because even if you say param0, param1 are just names and can be anything.

you need to define the finer details in your tmodel which the client looks up at and derives more sense about the webservice

Anyways here is the ant task that I used and the one that gets me the proper parameter names instead of param0, param1.

Hope it helps
Arafat Nalkhande
Ranch Hand

Joined: Jul 20, 2006
Posts: 51
Sorry forgot to paste the nat task

Shariq Roomi
Ranch Hand

Joined: Oct 19, 2004
Posts: 31
Okay I figure out the issue but I have no solution.

If your service is implementing some interface then the parameters are named as param0 and param1 of functions from interface. It has nothing to do with debug option.

Is there any work around ??
Raghav Mathur
Ranch Hand

Joined: Jan 12, 2001
Posts: 641
Dudley-

You should have the messages defined in your wsdl . for example

<message name="MySoapIn">
<part name="parameters" element="enr:My_Request"/>
</message>


where My_Request is your parameter which should defined in the <types>. Now this defined message will be plugged with the port. So My_Request becomes the input parameter for the method "testOperation"

<portType name="MySoap">
<operation name="testOperation">
<input message="s0:MySoapIn"/>
<output message="s0:SoapOut"/>
</operation>
</portType>

[ June 30, 2007: Message edited by: Raghav Mathur ]

Raghav.
Dudley Dawson
Ranch Hand

Joined: Dec 14, 2004
Posts: 57
Thanks all for the help. I'm not sure i fully understand.
I'm simply designating a POJO as a service by configuring services.xml within the META-INF of the axis war. The wsdl is being generated dynamically by Axis when accessing http://localhost/warname/MyServiceName?wsdl
My question is - obviously Axis uses some sort of reflection to determine what parameters, and what types are passed into the method. Why is not picking up the parameter names, and instead renaming them to param0 and param1?
Milan Mogin
Greenhorn

Joined: Jun 04, 2008
Posts: 1
Better late than never. I was searching for the answer to this question and it took me a while to find it, so maybe there are people still looking for the solution.

You can save the wsdl that you get as http://localhost/warname/MyServiceName?wsdl in services/MyServiceName/META-INF/service.wsdl and change param0, param1... for your own parameter names.
[ June 04, 2008: Message edited by: Milan Mogin ]
sumedha rubasinghe
Greenhorn

Joined: Jun 22, 2008
Posts: 1
Editing the WSDL by hand to make the parameters appear correct is not the best option.
You have to compile your classes with debug option. Please read following article for complete example/solution.

http://wso2.org/blog/sumedha/3727
Valentine Lsync
Greenhorn

Joined: Jul 10, 2012
Posts: 1
Hi,
becouse google still finds this frequently, and because some answers are right, yet another (a little better) solution:

mark your parameters with @WebParam(name = "theNameYouNeed"). For example:



- Lsync
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Parameter names in wsdl - axis2
 
Similar Threads
Webservice Design
Meaningful Parameter names in wsdl
How to use enum types with Axis2?
axis2/webshpere response != axis2/glassfish response........ why?
XmlException on calling WSDL2Java