JBoss Community

Is polymorphic JAX-WS operation parameter possible to implement?

created by Guillermo L in JBoss Web Services - View the full discussion

Hi,

I'm developing a web service and I need it to accept a polymorphic parameter. For example, imagine an operation named processRequests(List<Request> requests) which may accept a "Request" and a "CustomRequest" type (extending from Request) and possibly some others. It is my understanding that it should be possible to achieve however no matter how I do it I allways get the paramter unmarshaled as the base class.

 

I'm testing it with SOAP UI in the following way:

 

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://test.com/">

   <soapenv:Header/>

   <soapenv:Body>

      <ser:processRequests>

         <!--Zero or more repetitions of customRequest -->

         <requests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="customRequest">

             <prop1/>

             <prop2/>

         </requests>

      </ser:processRequests>

   </soapenv:Body>

</soapenv:Envelope>

 

The pojos are as the following:

 

@XmlRootElement

@XmlSeeAlso({CustomRequest.class})

publc class Request {}

 

publc class CustomRequest extends Request{}

 

¿Am I tryin to do something impossible?

 

Your help is highly appreciated!

Reply to this message by going to Community

Start a new discussion in JBoss Web Services at Community