简体   繁体   中英

Java QName prefix not working

My question is quite simple. I'm adding a header to a SOAP request that needs to have a namespace prefix. As such I'm using

QName(String namespaceURI,
             String localPart,
             String prefix)

The problem is that although I set the prefix nothing is added, ie:

new QName("http://lit.com/schemas/Bobsled", "bob:sessionId")

I get <bob:sessionId xmlns="http://lit.com/schemas/Bobsled">

And with the prefix:

new QName("http://lit.com/schemas/Bobsled", "bob:sessionId","bob")

I get exactly the same thing, when it should be:

<bob:sessionId xmlns:bob="http://lit.com/schemas/Bobsled">

...it seems like the prefix in the constructor isn't doing anything!

qname的前缀是QName构造函数中的第三个参数

new QName("http://lit.com/schemas/Bobsled", "sessionId","bob")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM