users@jax-ws.java.net

Re: Message unmarshalling problem

From: Dima Gutzeit <dima_at_mailvision.com>
Date: Tue, 19 Dec 2006 09:24:20 +0200

The handler is being invoked, I am printing the message before and after the
handling (inside the handler execution body), so I positive that the SOAP
message was changed.

Here is the trace :

Caused by: javax.xml.bind.UnmarshalException: Unable to create an instance
of com.mailvision.ws.blah.Criterion
 - with linked exception:
[java.lang.InstantiationException]
        at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:556)
        at
com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:199)
        at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.createInstance(UnmarshallingContext.java:523)
        at
com.sun.xml.bind.v2.runtime.unmarshaller.StructureLoader.startElement(StructureLoader.java:145)
        at
com.sun.xml.bind.v2.runtime.unmarshaller.XsiTypeLoader.startElement(XsiTypeLoader.java:36)
        at
com.sun.xml.bind.v2.runtime.unmarshaller.ProxyLoader.startElement(ProxyLoader.java:19)
        at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:402)
        at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:380)
        at
com.sun.xml.bind.v2.runtime.unmarshaller.InterningXmlVisitor.startElement(InterningXmlVisitor.java:35)
        at
com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.handleStartElement(StAXStreamConnector.java:208)
        at
com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(StAXStreamConnector.java:142)
        at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:333)
        ... 31 more
Caused by: javax.xml.bind.UnmarshalException: Unable to create an instance
of com.blah.Criterion
 - with linked exception:
[java.lang.InstantiationException]
        ... 43 more
Caused by: java.lang.InstantiationException
        at
sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImp
l.java:30)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
        at com.sun.xml.bind.v2.ClassFactory.create0(ClassFactory.java:83)
        at
com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.createInstance(ClassBeanInfoImpl.java:221)
        at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.createInstance(UnmarshallingContext.java:517)
        ... 40 more



----- Original Message -----
From: "Jitendra Kotamraju" <Jitendra.Kotamraju_at_Sun.COM>
To: <users_at_jax-ws.dev.java.net>
Sent: Tuesday, December 19, 2006 8:43 AM
Subject: Re: Message unmarshalling problem


> Can you post the stack trace ? Also do you know whether the handler is
> getting invoked ?
>
> Jitu
> Dima Gutzeit wrote:
>> Hi,
>>
>> I have a webservice that includes "abstract" schema elements and its
>> extensions.
>> Whenever I use JAXWS as a client for the webservice, the "inheritance" is
>> supported using xsi:type attribute like the following:
>>
>> <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
>> <S:Header/>
>> <S:Body>
>> <ns2:getSomething xmlns:ns2="http://www.blah.com/services/commons/web"
>> xmlns:ns3="http://www.blah.com/services/commons">
>> <searchCriteria>
>> <criterions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xsi:type="ns3:someExpression">
>> <propertyName>name</propertyName>
>> <matchMode>START</matchMode>
>> <criterionType>SomeExpression</criterionType>
>> </criterions>
>> <numberOrItemsPerRequest>50</numberOrItemsPerRequest>
>> <requestNumber>0</requestNumber>
>> </searchCriteria>
>> </ns2:getSomething>
>> </S:Body>
>> </S:Envelope>
>>
>> On the server side this is being unmarshalled with no problem to class
>> "LikeExpression" and execution continues.
>>
>>
>> Another webservices client that I've been using is Adobe Flex. For some
>> reason it does not support the xsi:type and send the message as
>> following:
>>
>> <SOAP-ENV:Envelope
>> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
>> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>> <SOAP-ENV:Body>
>> <ns0:getInformation
>> xmlns:ns0="http://www.blah.com/services/commons/web">
>> <searchCriteria>
>> <criterions>
>> <criterionType>SomeExpression</criterionType>
>> <matchMode>START</matchMode>
>> <propertyName>name</propertyName>
>> <value/>
>> </criterions>
>> <numberOrItemsPerRequest>0</numberOrItemsPerRequest>
>> <requestNumber>0</requestNumber>
>> <subCriterias xsi:nil="true"/>
>> </searchCriteria>
>> </ns0:getInformation>
>> </SOAP-ENV:Body>
>> </SOAP-ENV:Envelope>
>>
>> In this case JAXWS server side fails with exception:
>>
>> Caused by: javax.xml.bind.UnmarshalException: Unable to create an
>> instance of com.blah.Criterion
>>
>> Because it is an abstract class.
>>
>> What I tried is plugging in SOAPMessage handler that would change the
>> incoming SOAP message and add "xsi:type" attribute to <criterions>
>> element.
>> So I end up with the following message:
>>
>> <SOAP-ENV:Envelope
>> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
>> <SOAP-ENV:Header/>
>> <SOAP-ENV:Body>
>> <ns1:getInformation xmlns:ns1="http://www.blah.com/services/commons/web"
>> xmlns:ns2="http://www.blah.com/services/commons">
>> <searchCriteria>
>> <criterions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xsi:type="ns2:likeExpression">
>> <criterionType>SomeExpression</criterionType>
>> <matchMode>START</matchMode>
>> <propertyName>name</propertyName>
>> <value/>
>> </criterions>
>> <numberOrItemsPerRequest>0</numberOrItemsPerRequest>
>> <requestNumber>0</requestNumber>
>> <subCriterias xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xsi:nil="true"/>
>> </searchCriteria>
>> </ns1:getInformation>
>> </SOAP-ENV:Body>
>> </SOAP-ENV:Envelope>
>>
>> Which has xsi:type attribute and looks very decent to me :-).
>>
>> The problem is that it still fail with the same exception !!!!!
>>
>>
>> The question is what am I doing wrong ?????
>>
>> Thanks in advance.
>>
>> Regards,
>> Dima Gutzeit.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jax-ws.dev.java.net
>> For additional commands, e-mail: users-help_at_jax-ws.dev.java.net
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jax-ws.dev.java.net
> For additional commands, e-mail: users-help_at_jax-ws.dev.java.net
>
>