out_sid3r
out_sid3r

Reputation: 1028

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, i.e:

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!

Upvotes: 3

Views: 7967

Answers (1)

viliam
viliam

Reputation: 523

prefix for qname is third parameter in QName constructor

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

Upvotes: 14

Related Questions