Replies: 4 comments
-
Hi @uugan Perhaps this may be helpful for you... https://stackoverflow.com/questions/1163795/marshalling-polymorphic-objects-in-jax-ws |
Beta Was this translation helpful? Give feedback.
-
Hi @uugan I'm not sure if you had a chance to explore the link shared previously, pls see the attached quarkus-cxf-interface.zip project that uses a The crux of the implementation is depicted below ... @WebService(serviceName = "HelloService")
public class HelloServiceImpl implements HelloService {
@Inject
HelloUtil helloUtil;
@WebMethod
@Override
public HelloResponse hello(String name) {
return helloUtil.hello(name);
}
} Where @XmlTransient
@XmlSeeAlso({HelloResponseQuarkusImpl.class, HelloResponseSimpleImpl.class})
public interface HelloResponse {
} You can invoke the service with something like below, each invocation should alternate between the curl -v -X POST -H "Content-Type: text/xml;charset=UTF-8" \
-d \
'<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body><ns2:hello xmlns:ns2="http://acme.org/"><arg0>Shumon</arg0></ns2:hello></soap:Body>
</soap:Envelope>' \
http://localhost:8080/soap/hello Keep us posted if you still have any issues. |
Beta Was this translation helpful? Give feedback.
-
Hi @shumonsharif I tried that code, but it gives that first object as second object with its parameters. @XmlTransient
@XmlSeeAlso({SubtractPointsResponse.class, PaypointsSoapFault.class})
public interface ISubtract{
} @XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name="SubtractPointsResponse")
public class SubtractPointsResponse implements ISubtract{
...
} @XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name="PaypointsSoapFault", propOrder = {"defaultMessage", "customMessage", "code"})
public class PaypointsSoapFault implements ISubtract{
...
} mainUtil if (0 != outmsg) {
return new PaypointsSoapFault("service error", outmsg, 1);
}
else {
return new SubtractPointsResponse(num);
} But when call it, response looks like: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<pay:SubtractPointsResponse xmlns:pay="http://******">
<pay:return xsi:type="pay:PaypointsSoapFault" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<pay:defaultMessage>service error</pay:defaultMessage>
<pay:customMessage>not found.</pay:customMessage>
<pay:code>1</pay:code>
</pay:return>
</pay:SubtractPointsResponse>
</soap:Body>
</soap:Envelope> But i need response like below: <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<pay:PaypointsSoapFault xmlns:pay="http://*******">
<pay:defaultMessage>service error</pay:defaultMessage>
<pay:customMessage>not found.</pay:customMessage>
<pay:code>1</pay:code>
</pay:PaypointsSoapFault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope> |
Beta Was this translation helpful? Give feedback.
-
Hi @uugan Pls feel free to attach a reproducer that demonstrates what you're experiencing (you can update the sample project I provided earlier)! |
Beta Was this translation helpful? Give feedback.
-
I need to return different types of objects, these object are implemented from interface but cxf does not support it.
for example:
and webservice function looks like below:
How to do this?
Beta Was this translation helpful? Give feedback.
All reactions