Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CxfSoapMtomIT fails in native mode #4214

Merged
merged 1 commit into from
Oct 26, 2022
Merged

CxfSoapMtomIT fails in native mode #4214

merged 1 commit into from
Oct 26, 2022

Conversation

ppalaga
Copy link
Contributor

@ppalaga ppalaga commented Oct 25, 2022

fix #4208

@ppalaga
Copy link
Contributor Author

ppalaga commented Oct 25, 2022

cc @llowinge

@llowinge
Copy link
Contributor

Thank you @ppalaga , i'm tagging @ffang if he can provide explanation why using directly awt.Image isn't working.

Btw will we remove the non-awt scenario then ?

@ppalaga ppalaga merged commit a3b728e into apache:main Oct 26, 2022
@ppalaga
Copy link
Contributor Author

ppalaga commented Oct 26, 2022

Btw will we remove the non-awt scenario then ?

No, I think both are useful and most importantly, we cannot merge them into a single Maven module, because they have different set of deps.

@ppalaga
Copy link
Contributor Author

ppalaga commented Oct 26, 2022

i'm tagging @ffang if he can provide explanation why using directly awt.Image isn't working.

Indeed, @ffang is that expected, that an MTOM service must have the Image BLOB wrapped inside a request/response object ( uploadImage(ImageData image)) while the Image blob does not work as a direct service method arg (uploadImage(Image image, String name))? - see here https://github.com/apache/camel-quarkus/pull/4214/files#diff-d9291904f16dd04eb3b85f9c557ac62ae9fc3978b9fa380551a76201f58e2a2aR25-R30

Within jbossws-cxf I also found only tests using that wrapped style and no BLOB args directly in service methods.

@ffang
Copy link
Contributor

ffang commented Oct 26, 2022

Hi @ppalaga , @llowinge ,

So CxfSoapMtomAwtIT only failed in native mode, but it's JVM mode counterpart CxfSoapMtomAwtTest passed, right?

If so, my gut is that this is something related to the javax.awt.headless in native mode, so that the javax.awt maynot fully working in native mode. As java.awt.Image requires graphic sever(something like X11 server on linux/unix machine), so javax.awt may not work if lack the graphic server or whatnot.

Freeman

@ppalaga
Copy link
Contributor Author

ppalaga commented Oct 27, 2022

So CxfSoapMtomAwtIT only failed in native mode, but it's JVM mode counterpart CxfSoapMtomAwtTest passed, right?

No that's not really the case. The test passes after changing the signature of the service method from uploadImage(javax.awt.Image image, String name) to uploadImage(ImageData image) where ImageData is just a wrapper for javax.awt.Image.

In Quarkiverse CXF I saw the uploadImage(javax.awt.Image image, String name) variant to be failing also in JVM mode.

So the question is whether @MTOM annotated services require single arg service methods or whether the BLOBs may not occur as service method parameters?

@ffang
Copy link
Contributor

ffang commented Oct 27, 2022

So the question is whether @MTOM annotated services require single arg service methods or whether the BLOBs may not occur as service method parameters?

No, there is no such requirements from CXF point of view. The signature

uploadImage(javax.awt.Image image, String name)

definitely should work if being defined correctly. If it doesn't work in your or Quarkiverse CXF, most likely the SEI(service endpoint interface) is incorrect(most likely annotations there not fully follow the JAXWS spec), then this can mess up the service model(what the message payload should be) which is generated from the SEI on the fly. If the SEI in your testcase is handwriting rather than auto-generated from a wsdl, you may run into this issue.

And here I just post a SEI which works with javax.awt.Image image but not in a wrapper, and this is auto-generated from a well-defined wsdl, just FYI

@WebService(targetNamespace = "http://apache.org/camel/cxf/mtom_feature", name = "Hello")
@XmlSeeAlso({org.apache.camel.cxf.mtom_feature.types.ObjectFactory.class})
@Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date = "2022-10-27T09:34:52.889-04:00", comments = "Apache CXF 3.5.3")
public interface Hello {

    @WebMethod(operationName = "DetailOneway")
    @Oneway
    @RequestWrapper(localName = "DetailOneway", targetNamespace = "http://apache.org/camel/cxf/mtom_feature/types", className = "org.apache.camel.cxf.mtom_feature.types.DetailType")
    @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date = "2022-10-27T09:34:52.889-04:00")
    public void detailOneway(

        @WebParam(name = "photo", targetNamespace = "http://apache.org/camel/cxf/mtom_feature/types")
        byte[] photo,
        @WebParam(name = "image", targetNamespace = "http://apache.org/camel/cxf/mtom_feature/types")
        java.awt.Image image
    );
}

@ppalaga
Copy link
Contributor Author

ppalaga commented Oct 27, 2022

Thanks a lot, I should try whether adding @RequestWrapper will make a difference.

@ppalaga
Copy link
Contributor Author

ppalaga commented Oct 27, 2022

... and strange enough, when I changed

uploadImage(javax.awt.Image image, String name)

to

uploadImage(String image, String name)

it worked flawlessly.

@ffang
Copy link
Contributor

ffang commented Oct 27, 2022

Hi @ppalaga ,

I just add a CxfMtomConsumerMutipleParameterTest on my CSB working branch to demonstrate

uploadImage(javax.awt.Image image, String name)

work here ffang/camel-spring-boot-apache@e43b155
and you may want to take a look.

Freeman

@ppalaga
Copy link
Contributor Author

ppalaga commented Oct 28, 2022

Adding an explicit @RequestWrapper and @ResponseWrapper makes it work in JVM mode quarkiverse/quarkus-cxf#579 It fails in native mode due to some new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CxfSoapMtomIT fails in native mode
4 participants