My Oracle Support Banner

Extra SOAP element xmlns="" value after upgrading from WLS 10 MP1 when using createName method of SOAPEnvelope of WLS SAAJ (Doc ID 1280619.1)

Last updated on APRIL 06, 2018

Applies to:

Oracle Weblogic Server - Version: 10.0 and later   [Release: and later ]
Information in this document applies to any platform.


When Using the SAAJ API to create element or child element, if a namespace is not explicitly declared the default namespace is xmlns="" is getting appended.

Sample XML Output1:WLS 10.0 MP1
<env:Envelope xmlns:env="" xmlns="http://schemas"><env:Header/>

Sample XML Output2:WLS 10.0 MP2 , WLS 10.3 and above versions.
<env:Envelope xmlns:env="" xmlns="http://schemas><env:Header/>
<Login xmlns=""/>

The above Output1 is the SOAP envelope resulted when using the WLS 10.0 MP1 with weblogic.jar in the classpath.

The above output2 is the SOAP envelope resulted when using the WLS 10.0 MP2 with weblogic.jar or WLS 10.3 and above versions

 The difference is just the xmlns="" on the Login element.

Below is the sample code
import javax.xml.soap.*;
public class TestActuate {

public static void main (String[]argv) throws Exception {

SOAPMessage a_message = null;
SOAPFactory a_soapFactory = SOAPFactory.newInstance();
MessageFactory a_messageFactory = MessageFactory.newInstance();
a_message = a_messageFactory.createMessage();
SOAPEnvelope a_envelope = a_message.getSOAPPart().getEnvelope();
a_envelope.addNamespaceDeclaration("", "http://schemas");
SOAPHeader a_header = a_envelope.getHeader();
SOAPBody a_body = a_envelope.getBody();
Name a_bodyName = a_soapFactory.createName("Login");
//Name a_bodyName = a_soapFactory.createName("Login","","http://schmas");
SOAPBodyElement a_bodyElement = a_body.addBodyElement(a_bodyName);



To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!

In this Document

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.