• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Parameter names in wsdl - axis2

 
Dudley Dawson
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

 
Dudley Dawson
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry forgot to paste the nat task

 
Shariq Roomi
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 641
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Dudley Dawson
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic