Hi Surjit,

You have several choices here. One is to just treat the guid simpleType 
as though it were a plain string in schema terms (since it's a 
restriction type based on string). In this case you just have a <value> 
element in your binding that links the element using the guid type to a 
String value in your Java code. The drawback to this approach is just 
that you don't get any checking of the values.

Another alternative is to use a String representation in Java terms, but 
with a <format> that uses special serializer/deserializer methods which 
can verify that the guid value is in the correct form. To do this, you'd 
have something like this in your binding:

<format label='guid' type='java.lang.String' 
serializer='com.whatever.Utility.serializeGuid' 
deserializer='com.whatever.Utility.deserializeGuid'/>

and then reference that format on any <value>s the matched the type:

<value name='aGuid' field='guidString' format='guid'/>

the serializer and deserializer are just static methods, and can be in 
any convenient class. In this case you'd only be using them to verify 
the proper format, so they'd just be something like:

public static String serializeGuid(String guid) throws JiBXException {
// use the Java regular expression classes to verify the format, or 
check any way you want, throwing an exception on error
return guid;
}

public static String deserializeGuid(String guid) throws JiBXException {
// use the Java regular expression classes to verify the format, or 
check any way you want, throwing an exception on error
return guid;
}

A third possibility is to define your own Guid class, and then have the 
serializer method take a Guid as it's input parameter and return the 
String value, and the deserializer method take a String as its input 
parameter and return a Guid value. Doing that would let you make the 
<format> the default for this Guid type, so that you could drop the 
name='guid' on the <format> and the format='guid' on the <value>s using 
that type.

- Dennis

Dennis M. Sosnoski
SOA and Web Services in Java
Training and Consulting
http://www.sosnoski.com - http://www.sosnoski.co.nz
Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117



Konjengbam Singh wrote:
>
> Hi
>
> Inside my schema I m using a simpletype which belongs to a different 
> name space. This simple type is used as a some other complex type.
>
> I m trying to create a binding.xml file with mapping for this 
> simpletype. I also found that “If the child elements reference schema 
> /simpleType/ definitions the binding must also define a /format/s for 
> each /simpleType/, with a /label/ attribute matching the schema 
> /simpleType/ name.”
>
> The schema for the simpletype is defined like this:
>
> <s:schema elementFormDefault="qualified" 
> targetNamespace="http://microsoft.com/wsdl/types/";>
>
> <s:simpleType name="guid">
>
> <s:restriction base="s:string">
>
> <s:pattern 
> value="[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}"
>  
> />
>
> </s:restriction>
>
> </s:simpleType>
>
> </s:schema>
>
> What should be the corresponding mapping for this on the binding.xml 
> if we use unwrapping?
>
> Thanking in advance,
>
> Surjit
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> ------------------------------------------------------------------------
>
> _______________________________________________
> jibx-users mailing list
> jibx-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jibx-users
>   

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to