Removing ns1 namespace prefix from xml or Soap message

I am starting to program, so please bear my lack of knowledge.

I am working on sending and receiving a soap request through HttpsURLConnection. The problem is that the response from the input stream contains namespace declarations and the application does not recognize them.

I take the result from the input stream as text:

def reply = bufferedReader.getText()

but I can also create a Soap message:

reply = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL).createMessage(null, conn.getInputStream())

Both methods still provide a namespace prefix. But I'm not sure I missed something. I can manipulate both XML and SoapMessage, so any pointers will help.

When I send a request using SoapConnection.connect(), the XML file does not contain a prefix. However, when I use HttpsURLConnection, I get them. I can not use SoapConnection.connect()for other reasons.

. . , , .

,

+4

Source: https://habr.com/ru/post/1547626/


All Articles