Hi,
I don't understand I looked at the api and the only way to create an
OMFactory is to call
OMFactory fac = OMAbstractFactory.getOMFactory();
there is no option for namespace.
Also I printed the XML just before returning and the XML haven't
changed.
It really looks like it's something whithin AXIS:
SERVER SIDE CODE:
OMElement res = XMLStringToOMElement(reply);
System.out.println(OMElementToString(res)); --> this
doesn't show any xmlns:tns
return res;
Functions used below:
public String OMElementToString(OMElement elm) throws
XMLStreamException, Facto
ryConfigurationError
{
StringWriter sw= new StringWriter();
XMLStreamWriter writer =
XMLOutputFactory.newInstance().createXMLStreamW
riter(
sw);
elm.serialize(writer);
writer.flush();
return sw.toString();
}
public OMElement XMLStringToOMElement(String xml) throws
XMLStreamException,
FactoryConfigurationError
{
StringReader sr = new StringReader(xml);
XMLStreamReader parser =
XMLInputFactory.newInstance().createXMLStreamRe
ader(sr);
StAXOMBuilder builder =
new StAXOMBuilder(OMAbstractFactory.getOMFactory(), parser);
OMElement documentElement = builder.getDocumentElement();
return documentElement;
}
---------------------------------------
CLIENT SIDE CODE:
OMElement res = sender.sendReceive(msg);
System.out.println("done");
String response = OMElementToString(res);
System.out.println("response:"+res); ---> This
contains the xmlns:tns
regards.
________________________________
From: Michele Mazzucco [mailto:[EMAIL PROTECTED]
Sent: 15 January 2007 15:09
To: [email protected]
Subject: Re: unexpected xmlns:tns in soap response xml.
Giuseppe,
try to provide a "full" configured OMFactory object (i.e. with the
namespace - null is a legal value).
Michele
On 15 Jan 2007, at 15:01, Giuseppe Sarno wrote:
Thanks,
Hi, thanks for your reply,
This is how I convert the XML from a String to an OMElement.
Do you see anything wrong with it ?
public OMElement XMLStringToOMElement(String xml) throws
XMLStreamException, F
actoryConfigurationError
{
StringReader sr = new StringReader(xml);
XMLStreamReader parser =
XMLInputFactory.newInstance().createXMLStreamRe
ader(sr);
StAXOMBuilder builder =
new StAXOMBuilder(OMAbstractFactory.getOMFactory(),
parser);
OMElement documentElement =
builder.getDocumentElement();
return documentElement;
}
Regards.
________________________________
From: Michele Mazzucco [mailto:[EMAIL PROTECTED]
Sent: 15 January 2007 14:57
To: [email protected]
Subject: Re: unexpected xmlns:tns in soap response xml.
Giuseppe,
if I'm right the xmlns:tns element value comes from the factory
object used to create the SOAP elements, while you get those numbers
before and after the SOAP message because you have the chunked option
enabled in axis2.xml (please check the transport out section).
Hope this helps,
Michele
On 15 Jan 2007, at 13:54, Giuseppe Sarno wrote:
Hi I used Tcpmon:
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
X-Powered-By: Servlet 2.4; JBoss-4.0.4.GA (build:
CVSTag=JBoss_4_0_4_GA date=200605151000)/Tomcat-5.5
Set-Cookie: JSESSIONID=562AF18DB095A4637FCB5E666BAD1FD6;
Path=/
Content-Type: text/xml;charset=UTF-8
Transfer-Encoding: chunked
Date: Mon, 15 Jan 2007 13:49:00 GMT
144
<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/
<http://schemas.xmlsoap.org/soap/envelope/>
"><soapenv:Header /><soapenv:Body><samlp:x
xmlns:tns="http://<reverse>.<package <http://<reverse>.<package> >"
xmlns:samlp="ww"
xmlns="ff">blah</samlp:x></soapenv:Body></soapenv:Envelope>
0
(I also get those numbers 144 at the beginning of the
SOAP message and 0 at the end, what are those ?)
XML I want to be sent back :
<samlp:x xmlns:samlp="ww" xmlns="ff">blah</samlp:x>
Many thanks.
________________________________
From: Michele Mazzucco
[mailto:[EMAIL PROTECTED]
Sent: 15 January 2007 13:32
To: [email protected]
Subject: Re: unexpected xmlns:tns in soap response xml.
Hi Giuseppe,
try to post the full SOAP message please.
Thanks,
Michele
On 15 Jan 2007, at 10:44, Giuseppe Sarno wrote:
Hi,
can anyone tell me at least if this could be a
bug ? or intended behaviour ?
Thanks.
________________________________
From: Sarno, Giuseppe (MOP:GM15)
Sent: 13 January 2007 23:58
To: [email protected]
Subject: unexpected xmlns:tns in soap response
xml.
Hi,
I'm using AXIOM and I have a basic client/server
similar to the one in the sample dir (quickstartaxiom)
the main difference is that I exchange request
and response XML reading then from a String (which I than convert in
OMElement and vice versa).
I noticed that in the response (at the client
side) along with the expected namespaces declaration, I get a
xmlns:tns="http//<package>.<directory>" in the root element which I
didn't put in my response XML at the Server side..
Does anyone know why ?
How can I get rid of it (as I don't want my
request/response to be changed by AXIS)?
regards.
Giuseppe.