Guillermo L
2013-05-15 21:44:20 UTC
Guillermo L [https://community.jboss.org/people/gmlopezdev] created the discussion
"Is polymorphic JAX-WS operation parameter possible to implement?"
To view the discussion, visit: https://community.jboss.org/message/817907#817907
--------------------------------------------------------------
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/ http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser=" http://test.com/ 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 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
[https://community.jboss.org/message/817907#817907]
Start a new discussion in JBoss Web Services at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044]
"Is polymorphic JAX-WS operation parameter possible to implement?"
To view the discussion, visit: https://community.jboss.org/message/817907#817907
--------------------------------------------------------------
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/ http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser=" http://test.com/ 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 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
[https://community.jboss.org/message/817907#817907]
Start a new discussion in JBoss Web Services at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044]