axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Glen Daniels <gdani...@macromedia.com>
Subject RE: [PATCH] MessageElement value serialization, etc
Date Thu, 14 Mar 2002 15:11:34 GMT

> >>3. I made setObjectValue protected as we don't want to encourage the
> >>setting of the value by arbitrary classes.
> >I was thinking of it, as a required public function. There 
> is no other way
> >to construct simple XML for a Header/Body element.
> The problem is that the value set by setObjectValue may bear 
> no resemblance
> to the contents of the element, so I'm afraid I'm not comfortable with
> committing that as a public function. What do others think?

Hm - maybe I'll go take a look at this.... the idea is that this API is for programattic generation
of XML from serializable Java stuff, and thus the contents of the XML are EXACTLY the serialized
data of the Java objects.

i.e. 

SOAPHeader myHeader = new SOAPHeader(new QName("myNS", "header1"));
MessageElement e1 = new MessageElement(new QName("myNS", "anInt"));
e1.setObjectValue(new Integer(55));
myHeader.addChild(e1);

should generate:

<SOAP:Header>
  <ns1:header1 xmlns:ns1="myNS">
    <ns1:anInt xsi:type="xsd:int">55</ns1:anInt>
  </ns1:header1>
</SOAP:Header>

In fact to support this nicely, we should provide a MessageElement constructor that matches
the SOAPHeader one (namespace, localPart, objectValue).  [Oh, sorry in the examples above
I shouldn't have used the QNames, since those constructors don't exist]

I also think it doesn't make sense to set the object value on an element created from actual
XML, so that shouldn't work.

Make sense?

--Glen

Mime
View raw message