I have a web service process developed in Ivy that should send binary files using MTOM. Currently this service has the field of javax.activation.DataHandler type as the result parameter but it returns binary data in Base64 format. The code of the process is the following:

FileDataSource dataSource = new FileDataSource("c:\\test.png");
in.dataHandler = new DataHandler(dataSource);

In the response I have the file encoded using Base64 and no attachments.

Is it possible to change the settings of Ivy server (and designer if it is possible) to change the way of sending binary data so that clients get the responses with MTOM attachments and not as files encoded in Base64.

asked 31.05.2011 at 09:24

Andriy%20Petrivskyy's gravatar image

Andriy Petri...
(suspended)
accept rate: 25%


in fact the WS Processes are published using CXF framework. The WS stub classes are JAX-WS POJO classes generated by Xpert.ivy builders. These builders re-generate these POJO's on any change in the ws process or e.g. on a "clean project".

So unfortunately the only way is to add the annotation javax.xml.ws.soap.MTOM to the web service POJO's (See the CXF documentation for enabling MTOM).

Meanwhile you have to make sure that your POJO's are not re-generated (you can switch of the ws generation builder but this is a kind of tweaking only for experts) or you add the annotations in a separate step after the builders from Ivy. You can do this for example with your own builder that you add at the end of the build queue or you can do it in your build process.

link

answered 06.06.2011 at 05:29

Tamas%20KIS's gravatar image

Tamas KIS
(suspended)
accept rate: 60%

Hello Andriy,

Xpert.ivy generates WebService Java Stubs to invoke Axis2 Stubs. These files are located within your project. You can patch these files keeping in mind that a "Generate WS classes" (in WS configurations) overwrites your changes.
To enable MTOM you have to patch each WS client stub-s you want to use MTOM for. There is no way to globally set options for the Axis2 client class.

I recommend to experience with a dedicated mini ivy project.

So, locate your stub (e.g. MyXYWebServiceStub.java - this files ends with Stub.java). Find its method, which you invoke in your WS Step (the name is the same as the method you see in WS Step, just like the parameters which you see in your Ws Step configuration).
Add your modifications there, e.g.
_serviceClient.getOption().setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);

From ivy v4.2 all Axis2 client files are packed into jar-s to improve compilation performance. So whenever you patch an Axis2 stub, these stub-s have to be re-compiled, and re-packed into the jars.
These jars are located in your project's lib_ws/client folder.

Best regards
Tamas

-------------------
ivyTeam AG
link

answered 01.06.2011 at 09:56

Andriy%20Petrivskyy's gravatar image

Andriy Petri...
(suspended)
accept rate: 25%

Hello Tamas,

Sorry for the confusion, perhaps my explanation of problem wasn't clear. I understood what you answered, this information is also very useful and highly appreciated.

Let me try once again. I meant not the web-services that I can call from the Ivy using WS-steps, but WS-processes that I can create in Ivy since version 4.2 and that can be called outside of Ivy using, for instance, SoapUI (see attached screenshot ws_processes_issue_1.png). So I would like Ivy web-services to send clients the responses with MTOM attachments and not the files encoded in Base64.

I found in src_wsproc the file with name MyIvyProcessWS.java, but I am not sure if I can set options there. Perhaps there are any configuration files in IvyServer directories where I can configure this?

Thank you,
Andriy
link

answered 02.06.2011 at 07:33

Andriy%20Petrivskyy's gravatar image

Andriy Petri...
(suspended)
accept rate: 25%

Hello Tamas,

Thank you for your help.

The problem was solved by simple adding the following annotation:

@javax.xml.ws.soap.MTOM

to the generated WS stub file that located in src_wsproc directory.

As you noticed this file is re-generated after any changes in WS process are done or project is cleared, but to me it is not so big problem to add the annotation right before the deploying on the server :-)

Thank you again and have a nice day.

Cheers,
Andriy
link

answered 09.06.2011 at 03:33

Tamas%20KIS's gravatar image

Tamas KIS
(suspended)
accept rate: 60%

It is easier to use ch.ivyteam.ivy.scripting.objects.Binary instead of the DataHandler as an input parameter. So you dont need the MTOM Annotation. And you don't need to add it each clean.

thx to Christian Strebel for this input.

link

answered 09.09.2014 at 16:40

Daniel%20Oechslin's gravatar image

Daniel Oechslin
(suspended)
accept rate: 39%

edited 09.09.2014 at 16:41

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×48

Asked: 31.05.2011 at 09:24

Seen: 4,726 times

Last updated: 09.09.2014 at 16:41