axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Grimshaw, Jeffrey" <Jeffrey.Grims...@greenpoint.com>
Subject [axis2] String arrays as a property
Date Thu, 15 Mar 2007 21:38:36 GMT
Hi all.  I generated a new web service and one of the types in the wsdl
has the following definition:

<xsd:complexType name="MyStuffResponse">
	<xsd:all>
		<xsd:element name="ListOfStuff" type="xsd:String"
minOccurs="0" maxOccurs="unbounded"/>
	</xsd:all>
</xsd:complexType>

A simple string list, right?  Well, what wsdl2java generated from this
definition is and object with this property:

	protected org.apache.axiom.om.OMElement[] localListOfStuff;

So the adder for this list looks like this:

	public void addHeader(org.apache.axiom.om.OMElement param) {
		if (localListOfStuff == null) {
			localListOfStuff = new
org.apache.axiom.om.OMElement[] {};
		}

		// update the setting tracker
		localListOfStuffTracker = true;

		java.util.List list =
org.apache.axis2.databinding.utils.ConverterUtil
				.toList(localListOfStuff);
		list.add(param);
		this.localListOfStuff =
(org.apache.axiom.om.OMElement[]) list
				.toArray(new
org.apache.axiom.om.OMElement[list.size()]);

	}

Unfortunately, another part of the service that uses this class doesn't
know about the type org.apache.axiom.om.OMElement, and I don't want it
to have to.  Is there an easy way to create an adder that has a
signature like this (which is what I was aiming for in the first place):

	public void addHeader(String param)

Perhaps make a wrapper that creates a new org.apache.axiom.om.OMElement
and delegates?  I've been digging into the javadoc for
org.apache.axiom.*, but I don't know enough about the libraries to know
what to look for.

Any help will be very much appreciated.

Thanks,

Jeff Grimshaw
Sr. Programmer/Analyst
Green Point Mortgage



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Mime
View raw message