MTOM content transfer Axis2

I have a POJO service in Axis2 which needs to transfer Content to the client. The content transfer mechnism is MTOM.
In the MTOM user guide
following example is given for the server side code

public void uploadFileUsingMTOM(OMElement element) throws Exception {
       OMText binaryNode = (OMText) (element.getFirstElement()).getFirstOMChild();
       DataHandler actualDH;
       actualDH = (DataHandler) binaryNode.getDataHandler();
       ... Do whatever you need with the DataHandler ...

but since I have a POJO web service, I do not have OMElement.
My web service method looks like this

      public GetResumeContentResponse getResumeContent(GetResumeContent getResumeContent) {
       String resumeId = getResumeContent.getResumeId();
       System.out.println("Resume ID is --"+resumeId);
       GetResumeContentResponse res = new GetResumeContentResponse();

Please let me know how can I transfer content using this POJO web service.

Thank You

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Siva Prasanna KumarPrincipal Solutions ArchitectCommented:
Here is the code:
 GetResumeContentResponse grs = new GetResumeContentResponse();
                	 javax.activation.DataHandler dataHandler = new javax.activation.DataHandler(new FileDataSource("SomeFile"));
                      return grs;

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ank9Author Commented:
Thanks a lot.
Similarly on the client side it says
         ServiceClient serviceClient = new ServiceClient ();
        Options options = new Options();
        options.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
        serviceClient .setOptions(options);
Can you please let me know what is targetEPR.
Is it the endpoint? Should it be "
http://localhost:8080/axis2/services/ResumeService" in my case?
thank you
ank9Author Commented:
In the client, I did the following but an getting these error
1. The method setOptions(Options) is undefined for the type ResumeClient
2. Constants cannot be resolved
I checked the class "org.apache.axis2.Constants.Configuration" but  "FORCE_MIME" was not a field there.
Please let me know which class to import and how to set the options.
Thank you

public static void getResumeContent(String resumeId) {
		System.out.println("Resume ID is getResumeContent --"+resumeId);		
		ResumeClient serviceClient = new ResumeClient();
        Options options = new Options();
        EndpointReference rs = new EndpointReference("http://localhost:8080/axis2/services/ResumeService");
        options.setProperty(Constants.Configuration.FORCE_MIME, Constants.VALUE_TRUE);        

Open in new window

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.