在jax-ws中操纵编组器 [英] manipulate marshaller in jax-ws
问题描述
是否有一种方法可以操纵在jaxws中使用的编组器. 我想发送在Web服务请求中提交的cdata,为此,我想在这里尝试进行以下描述:
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 );
}
});
jaxws是否可能以某种方式出现?
is this possible with jaxws somehow?
推荐答案
好,您的问题的答案是:
Well, the answer to your question is:
JAX-WS
是基于JAXB
的,因此是可能的,只需在应用程序中创建与JAXB
相关的内容(如您在问题中所显示的),您就可以从您的计算机中处理XML
您的网络服务中请求.
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.
这篇关于在jax-ws中操纵编组器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!