users@jax-ws.java.net

Re: Message unmarshalling problem

From: Jitendra Kotamraju <Jitendra.Kotamraju_at_Sun.COM>
Date: Mon, 18 Dec 2006 22:43:29 -0800

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
>