cancel
Showing results for 
Search instead for 
Did you mean: 

urn: Namespace identifier problem

Former Member
0 Kudos

soapelement.addAttribute(envelope.createName("xmlns:ns1"), "urn:Login");

is throwing up the following error message

org.w3c.dom.DOMException: Prefix is 'xmlns', but URI is not 'http://www.w3.org/2000/xmlns/' in the qualified name, 'xmlns:ns1'

This is happening will creating soap message.

Kindly let me know if you have any hint on it

Regards,

Satish

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Satish,

Try this...

soapelement.addNamespaceDeclaration("ns1","urn:Login");

or

soapelement.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:ns1","urn:Login");

Regards,

Uma

Message was edited by: Uma Maheswari

Former Member
0 Kudos

It did't solve the problem. I am using webas 6.40 sps15 preview version. I am using old soap jars (soap 1.0 specification). How is urn: namespace handled in webas soap implementation ?

The actual code is this

Code -


SOAPConnectionFactory conFactory = SOAPConnectionFactory.newInstance();

SOAPConnection con = conFactory.createConnection();

MessageFactory mesFactory = MessageFactory.newInstance();

SOAPMessage message = mesFactory.createMessage();

SOAPPart part = message.getSOAPPart();

SOAPEnvelope envelope = part.getEnvelope();

URLEndpoint endpoint = new URLEndpoint(url);

SOAPBody soapBody = envelope.getBody();

envelope.addNamespaceDeclaration("xsi", "http://www.w3.org/2000/XMLSchema-instance");

envelope.addNamespaceDeclaration("xsd","http://www.w3.org/1999/XMLSchema");

SOAPBody body = envelope.getBody();

message.saveChanges();

SOAPElement element = body.addChildElement(envelope.createName("ns1:" + method));

Name name = envelope.createName("xmlns:ns1");

<b>SOAPElement element1 = element.addAttribute(name, "urn:Login"); </b>