manipulate marshaller in jax-ws

送分小仙女□ 提交于 2021-02-18 15:31:53

问题


is there a way to manipulate the marshaller used in jaxws. I like to send a cdata filed in a webservice request and for this i want to try something like describet here: http://odedpeer.blogspot.de/2010/07/jaxb-sun-and-how-to-marshal-cdata.html

in short they does this:

Marshaller m = JAXBContext.newInstance( Item.class ).createMarshaller();  
m.setProperty( "com.sun.xml.internal.bind.characterEscapeHandler", new CharacterEscapeHandler() {  
  @Override  
  public void escape( char[] ac, int i, int j, boolean flag, Writer writer ) throws IOException  
  {  
   // do not escape  
   writer.write( ac, i, j );  
  }  
});  

is this possible with jaxws somehow?


回答1:


Well, the answer to your question is:

JAX-WS is based on JAXB so yes, it is possible, just create JAXB related stuff (as you showed in your question) in your application and you'll be able to process XML from your request in your web service.



来源:https://stackoverflow.com/questions/9907855/manipulate-marshaller-in-jax-ws

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!