Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JAX-WS: Duplicated namespace in outbound request #30121

Open
BerksanAtes opened this issue Nov 10, 2024 · 0 comments
Open

JAX-WS: Duplicated namespace in outbound request #30121

BerksanAtes opened this issue Nov 10, 2024 · 0 comments
Assignees
Labels
in:Web Services release bug This bug is present in a released version of Open Liberty team:Bobcats JAX-WS Web Services Team

Comments

@BerksanAtes
Copy link
Member

Describe the bug
Default namespace was added to the outbound request message. This action duplicated same namespace causing Web Service failure.

Sample soap envelope with duplicated default namespace

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
	<SOAP-ENV:Header/>
	<SOAP-ENV:Body>
		<ns0:getAddress xmlns="http://objects.get.address.io/" xmlns:ns0="http://objects.get.address.io/">
			<Address xmlns="">
				<streetNum>101</streetNum>
				<streetName>Main St.</streetName>
				<city>Some City</city>
				<state>Texas</state>
				<zip>78598</zip>
			</Address>
		</ns0:getAddress>
	</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Steps to Reproduce
Using SAAJ version 1.4.0 the sample code will create the issue

           MessageFactory mf = MessageFactory.newInstance(protocol);
           SOAPMessage request = mf.createMessage();
            SOAPPart part = request.getSOAPPart();
            SOAPEnvelope envelope = part.getEnvelope();
            SOAPBody body = envelope.getBody();

            SOAPFactory SOAP_FACTORY = SOAPFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
            SOAPElement getAddressElement = SOAP_FACTORY.createElement("getAddress", "ns0",
                    "http://objects.get.address.io/");

            SOAPElement addressElement = SOAP_FACTORY.createElement("Address", null, "");

            addressElement.addChildElement("streetNum").addTextNode("101");
            addressElement.addChildElement("streetName").addTextNode("Main St.");
            addressElement.addChildElement("city").addTextNode("Some City");
            addressElement.addChildElement("state").addTextNode("Texas");
            addressElement.addChildElement("zip").addTextNode("78598");

            getAddressElement.addChildElement(addressElement);

            body.addChildElement(getAddressElement);

            ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
            request.writeTo(byteOut);
            String requestString = new String(byteOut.toByteArray());
            out.write(requestString);

Expected behavior
Default namespace should be added once

Diagnostic information:

  • OpenLiberty Version: 24.0.0.9
  • Affected feature(s) jaxws-2.2
  • Java Version: 17
  • server.xml configuration (WITHOUT sensitive information like passwords)
  • If it would be useful, upload the messages.log file found in $WLP_OUTPUT_DIR/messages.log

Additional context
Add any other context about the problem here.

@BerksanAtes BerksanAtes added in:Web Services release bug This bug is present in a released version of Open Liberty team:Bobcats JAX-WS Web Services Team labels Nov 10, 2024
@BerksanAtes BerksanAtes self-assigned this Nov 10, 2024
@BerksanAtes BerksanAtes changed the title JAX-WS: Addition of default namespace into outbound request as duplication cause a problem JAX-WS: Duplicated namespace into outbound request Nov 10, 2024
@BerksanAtes BerksanAtes changed the title JAX-WS: Duplicated namespace into outbound request JAX-WS: Duplicated namespace in outbound request Nov 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in:Web Services release bug This bug is present in a released version of Open Liberty team:Bobcats JAX-WS Web Services Team
Projects
None yet
Development

No branches or pull requests

1 participant