FYI,

In order to avoid re-inventing the wheel with every new project, I wrote a
semi-generic helper class to handle Map properties. Docs are
here<http://dellroad-stuff.googlecode.com/svn/trunk/publish/reports/javadoc/org/dellroad/stuff/jibx/MapEntry.html>in
case anyone is interested.

-Archie

On Sun, Feb 27, 2011 at 9:00 PM, Dennis Sosnoski <[email protected]> wrote:

>  Hi Ayash,
>
> There's no one way of representing maps directly in XML or schema terms.
> Depending on the actual data in the map, one form of representation or
> another may be appropriate. The best I can suggest is that you use an array
> (or List) of key-value pairs to represent the data from the map, and modify
> your code to match when using Jibx2Wsdl. So for instance, if you have a
> method that returns a map of String to Widget, "Map<String,Widget>
> getMap()", create a pair class:
>
> public class StringWidgetPair {
>   public String key;
>   public Widget value;
>   public StringWidgetPair(String key, Widget value) {
>     this.key = key;
>     this.value = value;
>   }
> }
>
> and substitute an adapter method "List<StringWIdgetPair> getList()". This
> will let you generate an appropriate schema for your XML data.
>
> If you want to use the generated schema and binding with JiBX you can
> easily implement the adapter method:
>
> List<StringWidgetPair> getList() {
>   Map<String,Widget> map = getMap();
>   List<StringWidgetPair> list = new ArrayList<StringWidgetPair>();
>   for (String key : map.keySet()) {
>     list.add(new StringWidgetPair(key, map.get(key));
>   }
>   return list;
> }
>
> (ignoring any typos).
>
>   - Dennis
>
>  Dennis M. Sosnoski
> Java SOA and Web Services Consulting<http://www.sosnoski.com/consult.html>
> Axis2/CXF/Metro SOA and Web Services 
> Training<http://www.sosnoski.com/training.html>
> Web Services Jump-Start <http://www.sosnoski.com/jumpstart.html>
>
> On 02/16/2011 11:31 PM, Ayash Kant Baral wrote:
>
>  Hi team,
>
>
>
>
>
> I am finding problem to convert java to wsdl using jibx2wsdl if any model
> is having java.util.map.
>
> The exception is  as follows:-
>
>
>
> Exception in thread "main" *java.lang.IllegalStateException*: No way to
> handle type java.util.Map, referenced from
> com.aegon.dot.model.bo.ProposalDetails
>
>
>
>
>
> Regards,
>
> Ayash
>
>
>
>
>
>
>
> ------------------------------
> ::DISCLAIMER::
>
> -----------------------------------------------------------------------------------------------------------------------
>
> The contents of this e-mail and any attachment(s) are confidential and
> intended for the named recipient(s) only.
> It shall not attach any liability on the originator or HCL or its
> affiliates. Any views or opinions presented in
> this email are solely those of the author and may not necessarily reflect
> the opinions of HCL or its affiliates.
> Any form of reproduction, dissemination, copying, disclosure, modification,
> distribution and / or publication of
> this message without the prior written consent of the author of this e-mail
> is strictly prohibited. If you have
> received this email in error please delete it and notify the sender
> immediately. Before opening any mail and
> attachments please check them for viruses and defect.
>
>
> -----------------------------------------------------------------------------------------------------------------------
>
>
> ------------------------------------------------------------------------------
> The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
> Pinpoint memory and threading errors before they happen.
> Find and fix more than 250 security defects in the development cycle.
> Locate bottlenecks in serial and parallel code that limit 
> performance.http://p.sf.net/sfu/intel-dev2devfeb
>
>
> _______________________________________________
> jibx-devs mailing 
> [email protected]https://lists.sourceforge.net/lists/listinfo/jibx-devs
>
>
>
> ------------------------------------------------------------------------------
> Free Software Download: Index, Search & Analyze Logs and other IT data in
> Real-Time with Splunk. Collect, index and harness all the fast moving IT
> data
> generated by your applications, servers and devices whether physical,
> virtual
> or in the cloud. Deliver compliance at lower cost and gain new business
> insights. http://p.sf.net/sfu/splunk-dev2dev
> _______________________________________________
> jibx-devs mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jibx-devs
>
>


-- 
Archie L. Cobbs
------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
jibx-devs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-devs

Reply via email to