Your server log snippet looks correct (assuming that the jxdm namespace
declaration is on an enclosing element, which you don't show).
You should try using the Axis2 1.1.1 release, since several
namespace-related issues were fixed in that code.
Also, it would help if you could do a capture (using Tcpmon, or a
similar tool) of the actual message going out on the line. That will
show the point at which the namespace information is being lost.
- Dennis
Danny Lin wrote:
Anne,
The WS server log indicates it is sending a document like this:
...
<jxdm:PersonAlternateName jxdm:personNameCommentText="M">
<jxdm:PersonGivenName>Rebecca</jxdm:PersonGivenName>
<jxdm:PersonMiddleName>Anne</jxdm:PersonMiddleName>
<jxdm:PersonSurName>Mace</jxdm:PersonSurName>
</jxdm:PersonAlternateName>...
The client receives:
...
<PersonAlternateName personNameCommentText="M"
xmlns:ns238="http://jxdm.ws.doc.state.sc.us">
<PersonGivenName>Rebecca</PersonGivenName>
<PersonMiddleName>Anne</PersonMiddleName>
<PersonSurName>Mace</PersonSurName>
</PersonAlternateName>
...
So, it has the prefix BUT NOT the additional namespace as an attribute.
The client is receiving an attribute WITHOUT the prefix but with a
secondary attribute indicating the namespace.
Thank you for your help.
Danny
-----Original Message-----
From: Anne Thomas Manes [mailto:[EMAIL PROTECTED]
Sent: Monday, January 22, 2007 10:35 AM
To: [email protected]
Subject: Re: not able to retrieve attribute (elements work fine)
Danny,
You don't just need the namespace declaration, you also must use the
prefix with the attribute. e.g.:
<PersonAlternateName ns1:personNameCommentText="A"
xmlns:ns1="http://jxdm.ws.doc.state.sc.us">
<PersonGivenName>Rebecca</PersonGivenName>
<PersonMiddleName>Mace</PersonMiddleName>
<PersonSurName>Smith</PersonSurName>
</PersonAlternateName>
Are you certain that XMLBeans returns the correct XML?
Anne
On 1/22/07, Danny Lin <[EMAIL PROTECTED]> wrote:
Thank you Anne and Dennis for looking into this problem. However, I
wonder if it is a problem with Axis2, not XMLBenas because I added the
logger and on the server side the <ConvictionSubject> XML generated
contains the namespace for the "personNameCommentText" attribute in
the <PersonAlternateName> element. But, by the time the client
receives the document, it doesn't have namespace any more. The client
and the server both were generated from the same WSDL at the same
time. Any suggestions as what else I can try out?
Thanks again.
Danny
-----Original Message-----
From: Dennis Sosnoski [mailto:[EMAIL PROTECTED]
Sent: Saturday, January 20, 2007 6:29 PM
To: [email protected]
Subject: Re: not able to retrieve attribute (elements work fine)
Duh! Of course, my bad. This has caught me before, I'm sad to say - it
just somehow seems unnatural for attributes to be put into a namespace
without anything special being done to cause it.
- Dennis
Anne Thomas Manes wrote:
attributeFormDefault only applies to local attributes (those defined
within a complexType). But this attribute is defined as a global
attribute (a direct child of the <schema>). All entities (elements,
attributes, and types) that are defined as global belong to the
targetNamespace.
Anne
On 1/20/07, Dennis Sosnoski <[EMAIL PROTECTED]> wrote:
Here's the start of jxdm.xsd:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://jxdm.ws.doc.state.sc.us"
xmlns="http://jxdm.ws.doc.state.sc.us"
elementFormDefault="qualified">
This does not specify attributeFormDefault="qualified", so why are
you saying the attribute needs to be namespace qualified?
- Dennis
Anne Thomas Manes wrote:
The attribute is defined as a global attribute in the jxdm.xsd,
therefore it must be namespace qualified. The error is in the
message generated by the server.
Anne
On 1/20/07, Dennis Sosnoski <[EMAIL PROTECTED]> wrote:
I think this is the wrong way around, Anne. It looks to me like
the attribute is not namespace qualified in the schema (it's
defined in jxdm.xsd, not in the WSDL schema which has
attributeFormDefault="qualified"), so the response being sent
from
the
server is good and the error is apparently in the client-side
generated
code.
Either way, it looks like a problem with the XMLBeans code
generation for Axis2. That's assuming you're using the same
exact WSDL and
schema
for both client and server code generation - you might want to
double-check that to be sure. Then can you try this out using
the
Axis2
1.1.1 release? There were a number of bug fixes in that, and
it's possible this problem has been corrected.
- Dennis
Dennis M. Sosnoski
SOA and Web Services in Java
Training and Consulting
http://www.sosnoski.com - http://www.sosnoski.co.nz Seattle, WA
+1-425-939-0576 - Wellington, NZ +64-4-298-6117
Anne Thomas Manes wrote:
Danny,
According to your schema, the attribute should be namespace
qualified.
Hence the message you get back from the service should look
like
this:
<xml-fragment ns1:personNameCommentText="A"
xmlns:ns1="http://jxdm.ws.doc.state.sc.us"
xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<ns1:PersonGivenName>Rebecca</ns1:PersonGivenName>
<ns1:PersonMiddleName>Mace</ns1:PersonMiddleName>
<ns1:PersonSurName>Smith</ns1:PersonSurName>
</xml-fragment>
The reason why your request for the comment text returns null
is
because it's looking for an attribute called
ns1:personNameCommentText. Since that attribute doesn't exist,
it returns null.
If you implemented the service using Axis2 and XMLBeans, then
I
think
this is a bug in XMLBeans.
Anne
On 1/19/07, Danny Lin <[EMAIL PROTECTED]> wrote:
I added more logging on the web service server end just to
see
what's
going
on. The document that was prepared contains the namespace in
the attribute.
However, at the point where the client received, the
namespace
in the
attribute is gone. Can someone please help? I feel that has
something
to do
with the WSDL which I do not have very good understanding.
Thanks.
Danny
________________________________
From: Danny Lin
Sent: Friday, January 19, 2007 6:24 PM
To: [email protected]; [email protected]
Subject: not able to retrieve attribute (elements work fine)
I am attaching my WSDL and my schema to this message.
Hopefully
someone with good knowledge can spot where I did wrong here.
I am using
XMLBeans
binding
(version 2.2). My Axis2 version 1.1.
Basically I am having problem in getting the
"personNameCommentText"
attribute in the "PersonAlternateName" element.
After my webservice is called, the server returns:
...
<PersonAlternateName personNameCommentText="A"
xmlns:ns1="http://jxdm.ws.doc.state.sc.us">
<PersonGivenName>Rebecca</PersonGivenName>
<PersonMiddleName>Mace</PersonMiddleName>
<PersonSurName>Smith</PersonSurName>
</PersonAlternateName>
...
In my client side, I have code that looks like this:
...
String commentText = al.getPersonNameCommentText();
log.debug("XML: "+al);
...
The output is:
<xml-fragment personNameCommentText="A"
xmlns:ns1="http://jxdm.ws.doc.state.sc.us"
xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<ns1:PersonGivenName>Rebecca</ns1:PersonGivenName>
<ns1:PersonMiddleName>Mace</ns1:PersonMiddleName>
<ns1:PersonSurName>Smith</ns1:PersonSurName>
</xml-fragment>
BUT, the commentText is null, not the "A" that I am
expecting!!
Then, I just want to see what the client is expecting for the
XML to
look
like, I added the code:
...
al.setPersonNameCommentText("R");
log.debug("XML after change:\n"+al);
...
Now the output added a namespace to the
personNameCommentText.
<xml-fragment personNameCommentText="A"
ns1:personNameCommentText="R"
xmlns:ns1="http://jxdm.ws.doc.state.sc.us"
xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<ns1:PersonGivenName>Rebecca</ns1:PersonGivenName>
<ns1:PersonMiddleName>Mace</ns1:PersonMiddleName>
<ns1:PersonSurName>Smith</ns1:PersonSurName>
</xml-fragment>
And, if I call getPersonNameCommentText(), I am getting "R".
Any help is greatly appreciated.
Danny
-------------------------------------------------------------------
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
----------------------------------------------------------------
--
--- To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
-----------------------------------------------------------------
--
-- To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
-------------------------------------------------------------------
-- To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------
- To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]