You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Amila Suriarachchi <am...@gmail.com> on 2007/08/01 07:50:32 UTC

Re: OMElement construction for xsd:anySimpleType

This is an ADB problem. I have fixed this in the trunk and did not merge it
since it was big change and no one have report this earlier.
use  xsd:anyType for your element.
use a nightly build from the trunk.

Amila.


On 7/31/07, Richard Pöttler <ri...@gmail.com> wrote:
>
> Hi,
>
> I got to create a web service interface for a reasoner (a datalog
> evaluation
> engine). Finally i managed to write a wsdl file which will be accepted by
> axis2.
> At the construction time of the wsdl file I don't know the datatype of the
> value
> wich will be returned by the reasoner. The datatypes of the reasoner are
> simmilar to the xml datatypes, so converting the values shouldn't be a
> problem.
>
> The problem is the construction of the varmapping (see attached wsdl
> file) when i got the answer of the reasoner. Actually i got no clue how to
> set
> the value of the generated Varmapping class which should be returned in
> the
> Varmappings after the evaluate operation. It should be a OMElement
> implementation, but i don't know which attributes, values and namespaces
> it
> shoudl have (also i don't have any experience with AXIOM).
>
> All the classes are generated with the ADB data binding.
>
> I hope my question is not too dump and that i hava provided you all the
> needed
> information to help me with my problem. If there are any further questions
> just
> ask.
>
> bye
> richi
> --
> quoting guide: http://www.xs4all.nl/~hanb/documents/quotingguide.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>


-- 
Amila Suriarachchi,
WSO2 Inc.

Re: OMElement construction for xsd:anySimpleType

Posted by Richard Pöttler <ri...@gmail.com>.
On Wed, Aug 01, 2007 at 02:31:31PM +0530, Amila Suriarachchi wrote:
>    these are the types it supports
>    if (value instanceof String) {
>                serializeAnyType("string", value.toString(), xmlStreamWriter);
>            } else if (value instanceof Integer) {
>                serializeAnyType("int", value.toString(), xmlStreamWriter);
>            } else if (value instanceof Boolean) {
>                serializeAnyType("boolean", value.toString(),
>    xmlStreamWriter);
>            } else if (value instanceof URI) {
>                serializeAnyType("anyURI", value.toString(), xmlStreamWriter);
>            } else if (value instanceof Date) {
>                serializeAnyType("date", convertToString((Date) value),
>    xmlStreamWriter);
>            } else if (value instanceof Calendar) {
>                serializeAnyType("dateTime", convertToString((Calendar)
>    value), xmlStreamWriter);
>            } else if (value instanceof Time) {
>                serializeAnyType("time", convertToString((Time) value),
>    xmlStreamWriter);
>            } else if (value instanceof Float) {
>                serializeAnyType("float", value.toString(), xmlStreamWriter);
>            } else if (value instanceof Long) {
>                serializeAnyType("long", value.toString(), xmlStreamWriter);
>            } else if (value instanceof Double) {
>                serializeAnyType("double", value.toString(), xmlStreamWriter);
>            } else if (value instanceof Short) {
>                serializeAnyType("short", value.toString(), xmlStreamWriter);
>            } else if (value instanceof BigDecimal) {
>                serializeAnyType("decimal", value.toString(),
>    xmlStreamWriter);
>            } else if (value instanceof QName) {
>                QName qNameValue = (QName) value;
>                String prefix =
>    xmlStreamWriter.getPrefix(qNameValue.getNamespaceURI());
>                if (prefix == null) {
>                    prefix = BeanUtil.getUniquePrefix();
>                    xmlStreamWriter.writeNamespace(prefix,
>    qNameValue.getNamespaceURI());
>                    xmlStreamWriter.setPrefix(prefix,
>    qNameValue.getNamespaceURI ());
>                }
>                String attributeValue = qNameValue.getLocalPart();
>                if (!prefix.equals("")) {
>                    attributeValue = prefix + ":" + attributeValue;
>                }
>                serializeAnyType("QName", attributeValue, xmlStreamWriter);
>            } else if (value instanceof UnsignedLong) {
>                serializeAnyType("unsignedLong",
>    convertToString((UnsignedLong) value), xmlStreamWriter);
>            } else if (value instanceof UnsignedInt) {
>                serializeAnyType("unsignedInt", convertToString((UnsignedInt)
>    value), xmlStreamWriter);
>            } else if (value instanceof UnsignedShort) {
>                serializeAnyType("unsignedShort",
>    convertToString((UnsignedShort) value), xmlStreamWriter);
>            } else if (value instanceof UnsignedByte) {
>                serializeAnyType("unsignedByte",
>    convertToString((UnsignedByte) value), xmlStreamWriter);
>            } else if (value instanceof PositiveInteger) {
>                serializeAnyType("positiveInteger",
>    convertToString((PositiveInteger) value), xmlStreamWriter);
>            } else if (value instanceof NegativeInteger) {
>                serializeAnyType("negativeInteger",
>    convertToString((NegativeInteger) value), xmlStreamWriter);
>            } else if (value instanceof NonNegativeInteger) {
>                serializeAnyType("nonNegativeInteger",
>    convertToString((NonNegativeInteger) value), xmlStreamWriter);
>            } else if (value instanceof NonPositiveInteger) {
>                serializeAnyType("nonPositiveInteger",
>    convertToString((NonPositiveInteger) value), xmlStreamWriter);
>            } else {
>                throw new XMLStreamException("Unknow type can not serialize");
>            }
> 
>    Please tell all the types you need. I'll add them.

Hm, this lists looks quite comprehensive. I think i can work with this list
;). Didn't know that is would be that simple. Thanks again.

bye
richi
-- 
quoting guide: http://www.xs4all.nl/~hanb/documents/quotingguide.html

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


Re: OMElement construction for xsd:anySimpleType

Posted by Amila Suriarachchi <am...@gmail.com>.
these are the types it supports
if (value instanceof String) {
            serializeAnyType("string", value.toString(), xmlStreamWriter);
        } else if (value instanceof Integer) {
            serializeAnyType("int", value.toString(), xmlStreamWriter);
        } else if (value instanceof Boolean) {
            serializeAnyType("boolean", value.toString(), xmlStreamWriter);
        } else if (value instanceof URI) {
            serializeAnyType("anyURI", value.toString(), xmlStreamWriter);
        } else if (value instanceof Date) {
            serializeAnyType("date", convertToString((Date) value),
xmlStreamWriter);
        } else if (value instanceof Calendar) {
            serializeAnyType("dateTime", convertToString((Calendar) value),
xmlStreamWriter);
        } else if (value instanceof Time) {
            serializeAnyType("time", convertToString((Time) value),
xmlStreamWriter);
        } else if (value instanceof Float) {
            serializeAnyType("float", value.toString(), xmlStreamWriter);
        } else if (value instanceof Long) {
            serializeAnyType("long", value.toString(), xmlStreamWriter);
        } else if (value instanceof Double) {
            serializeAnyType("double", value.toString(), xmlStreamWriter);
        } else if (value instanceof Short) {
            serializeAnyType("short", value.toString(), xmlStreamWriter);
        } else if (value instanceof BigDecimal) {
            serializeAnyType("decimal", value.toString(), xmlStreamWriter);
        } else if (value instanceof QName) {
            QName qNameValue = (QName) value;
            String prefix = xmlStreamWriter.getPrefix(
qNameValue.getNamespaceURI());
            if (prefix == null) {
                prefix = BeanUtil.getUniquePrefix();
                xmlStreamWriter.writeNamespace(prefix,
qNameValue.getNamespaceURI());
                xmlStreamWriter.setPrefix(prefix, qNameValue.getNamespaceURI
());
            }
            String attributeValue = qNameValue.getLocalPart();
            if (!prefix.equals("")) {
                attributeValue = prefix + ":" + attributeValue;
            }
            serializeAnyType("QName", attributeValue, xmlStreamWriter);
        } else if (value instanceof UnsignedLong) {
            serializeAnyType("unsignedLong", convertToString((UnsignedLong)
value), xmlStreamWriter);
        } else if (value instanceof UnsignedInt) {
            serializeAnyType("unsignedInt", convertToString((UnsignedInt)
value), xmlStreamWriter);
        } else if (value instanceof UnsignedShort) {
            serializeAnyType("unsignedShort",
convertToString((UnsignedShort) value), xmlStreamWriter);
        } else if (value instanceof UnsignedByte) {
            serializeAnyType("unsignedByte", convertToString((UnsignedByte)
value), xmlStreamWriter);
        } else if (value instanceof PositiveInteger) {
            serializeAnyType("positiveInteger",
convertToString((PositiveInteger) value), xmlStreamWriter);
        } else if (value instanceof NegativeInteger) {
            serializeAnyType("negativeInteger",
convertToString((NegativeInteger) value), xmlStreamWriter);
        } else if (value instanceof NonNegativeInteger) {
            serializeAnyType("nonNegativeInteger",
convertToString((NonNegativeInteger) value), xmlStreamWriter);
        } else if (value instanceof NonPositiveInteger) {
            serializeAnyType("nonPositiveInteger",
convertToString((NonPositiveInteger) value), xmlStreamWriter);
        } else {
            throw new XMLStreamException("Unknow type can not serialize");
        }

Please tell all the types you need. I'll add them.

On 8/1/07, Richard Pöttler <ri...@gmail.com> wrote:
>
> On Wed, Aug 01, 2007 at 11:20:32AM +0530, Amila Suriarachchi wrote:
> >    This is an ADB problem. I have fixed this in the trunk and did not
> merge
> >    it since it was big change and no one have report this earlier.
> >    use  xsd:anyType for your element.
> >    use a nightly build from the trunk.
>
> Thanks for your reply.
> Do you mean use anyType AND use nightly build of use anyType OR use
> nightly build? I've downloaded the nightly build. If I then stick with the
> anySimpleType the value interface is still OMElement. If I use anyType the
> class changes to java.lang.Object. Now is the question which objects will
> be accepted and transformed by axis2? What would i set for value, if i
> want
> to send a GMonth object?
>
> bye
> richi
> --
> quoting guide: http://www.xs4all.nl/~hanb/documents/quotingguide.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>


-- 
Amila Suriarachchi,
WSO2 Inc.

Re: OMElement construction for xsd:anySimpleType

Posted by Richard Pöttler <ri...@gmail.com>.
On Wed, Aug 01, 2007 at 11:20:32AM +0530, Amila Suriarachchi wrote:
>    This is an ADB problem. I have fixed this in the trunk and did not merge
>    it since it was big change and no one have report this earlier.
>    use  xsd:anyType for your element.
>    use a nightly build from the trunk.

Thanks for your reply.
Do you mean use anyType AND use nightly build of use anyType OR use
nightly build? I've downloaded the nightly build. If I then stick with the
anySimpleType the value interface is still OMElement. If I use anyType the
class changes to java.lang.Object. Now is the question which objects will
be accepted and transformed by axis2? What would i set for value, if i want
to send a GMonth object?

bye
richi
-- 
quoting guide: http://www.xs4all.nl/~hanb/documents/quotingguide.html

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