JBoss Community

javaTypeAdapter for Strings

created by Zoli Szugyi in JBoss Web Services - View the full discussion

I'm trying to specify an XmlAdapter for all the String fields in our API to remove all the invalid xml characters

from the SOAP response before sending it to a client.

I've added the following to binding.xsd under globalBindings:

 

      <javaType
         name="java.lang.String" xmlType="xs:string"
         parseMethod="our.package.StringAdapter.parseString"
         printMethod="our.package.StringAdapter.printString"/>

 

When generating the client classes, the adapter class is generated and the string fields on the generated classes

get the annotation:

 

    @XmlJavaTypeAdapter(Adapter2 .class)

    protected String name;

 

The parseString and printString methods don't ever seem to be called though.

Is it possible to even override how strings are converted?

 

We're using JBoss 4.2.3

 

Thanks!

 

ps.: I've also tried specifying the XmlJavaTypeAdapter in the package-info, but that didn't have any effect. A post on these forums suggest that

JBoss 4.2.3 doesn't support this.

Reply to this message by going to Community

Start a new discussion in JBoss Web Services at Community