• Post Reply Bookmark Topic Watch Topic
  • New Topic

What value to use for <j2ee:param-type> in webservices.xml for Arrays?  RSS feed

 
Shailesh Welankar
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I have this method as one of the contracts in my web service -
java.lang.String removeUsers(java.lang.String sourceApp, java.lang.String[] userIDList)

The corresponding WSDL definitions look like (Auto-generated by Weblogic v10 Workshop from the service Java file) -


My question is - What value should I use for the <j2ee:param-type> element in the JAX-PRC mapping file webservices.xml file (bold-red in code below) for Java Arrays (The string Array I am using for the paramater of the method)?



I am using Eclipse IDE, Weblogic v10, JDK1.5 and manually writing the JAX-RPC mapping file (webservices.xml) to match to the WSDL. An EAR file is generated that I deploy on Linux based Weblogic v10 App server. I dont want to use client-gen just as yet. I have been coding webservice for couple of years now, but never had to code for String Arrays and such ... just domain objects may be.
I searched on the net, googled it - but everybody seems to be showing simple examples where they just pass and return a long or String ... no sample codes for advance data types!!


 
Shailesh Welankar
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK!! I found out the solution to this on my own. Below is the listing for others to refer if they are having similar issues -

The solution is that, the <j2ee:param-type> tag will contain the value:
<j2ee:param-type>java.lang.String[]</j2ee:param-type>

But, within the jaxrpc mapping XML file, have this entry to define the String Array:


while the WSDL will have the mapping for this as:



and the Request definition for the method will be defined as:



You can similarly have Array of objects (domain objects) defined, but instead of java.lang.String[], have the fully qualified class path for the domain class, like:
com.company.domain.pojoClass[].

Hope somebody finds this useful - I had a hard time getting this information from the net, but did not find anything there.
This issue is faced if you use Eclipse (not BEA WorkShop with a WebService Project, which generates the mapping files automatically when you export the project as EAR for deployment), but do not have any tools like wstools, wsimport etc configured into your Maven/ANT within Eclipse and are stuck with writing the JAXRPC mapping file on your own and have complex objects like String/Object Arrays as the params.


 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!