4

My intent is to prevent the XML parser from referencing external entities, defined in a DOCTYPE section at the beginning of the request's XML, but I'm interested in being able to more generally configure the XML parser used by the JAX-WS runtime.

Going through the available JAX-WS documentation (not formal, not complete, "not" in many ways) I can't find a way to express my configuration requirements to JAX-WS. That would be great, because I wouldn't have to deal with what's underneath.

Jamming the gears with a screwdriver reveals that it uses StAX. This means I could use javax.xml.stream.XMLInputFactory and its setProperty(String, Object) method to configure it, but I need the specific XMLInputFactory instance used by JAX-WS to do it. Setting System properties at JVM start-up doesn't do the trick; the properties need to be set on the instance used by JAX-WS.

So, either there is some way to configure JAX-WS's XML parser I'm not aware of, or I'll have to dig into JAX-WS's innards to somehow get a hold of the parser and configure it directly. The latter would be pretty lame.

Edit: I am referring to the standard JAX-WS implementation present in the Sun / Oracle JDK. I'm using Java 1.6.0 Update 24. I guess this must be the RI.

vagelis
  • 334
  • 3
  • 9
  • Since JAX-WS libraries are a dime-a-dozen, solutions may be implementation-dependent. If you have a specific runtime in mind, it would be worth mentioning it. – McDowell Sep 16 '11 at 20:42

1 Answers1

0

I suggest better you can use XStream for the same.

java_enthu
  • 2,279
  • 7
  • 44
  • 74