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: axis-dev@ws.apache.org; axis-user@ws.apache.org
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]

Reply via email to