About Question enthuware.ocejws.v6.2.157 :

Moderators: Site Manager, fjwalraven

Post Reply
howdy2u
Posts: 3
Joined: Sat Apr 25, 2015 10:51 am
Contact:

About Question enthuware.ocejws.v6.2.157 :

Post by howdy2u »

The answer may be correct, but I haven't been able to confirm.

1) The API doc says ABOVE, ' binary data above this size in bytes will be XOP encoded or sent as attachment. ' So if attachment is 100 bytes and MTOM(threshold=100), then it should be sent inline. 101 would be sent as attachment.

2) Hell if this works correctly on Weblogic 12.1.3. I have an image that is 32063 bytes. I have to set the threshold real high to get it to be sent inline. Not sure where the cut off is. With MTOM(threshold=320640) (notice the extra 0) it is still sent as an attachment. If I add another zero to the end, it gets sent inline.

fjwalraven
Posts: 429
Joined: Tue Jul 24, 2012 2:43 am
Contact:

Re: About Question enthuware.ocejws.v6.2.157 :

Post by fjwalraven »

Hi!
With MTOM(threshold=320640) (notice the extra 0) it is still sent as an attachment. If I add another zero to the end, it gets sent inline.
That is odd, you should check Weblogic for this particulair behaviour. It is obvious that Weblogic does not follow the JAX-WS specs here.

Regards,
Frits

khaled
Posts: 3
Joined: Thu Jun 18, 2015 3:42 am
Contact:

Re: About Question enthuware.ocejws.v6.2.157 :

Post by khaled »

Hi,
But the client didn't specify any threshold, why the file will be sent as attachment from the client ? I don't understand that. Can anyone explain me please.

fjwalraven
Posts: 429
Joined: Tue Jul 24, 2012 2:43 am
Contact:

Re: About Question enthuware.ocejws.v6.2.157 :

Post by fjwalraven »

If no threshold is specified then the default of 0 bytes is used. That is why it is sent as an attachment.

Regards,
Frits

victor2016
Posts: 18
Joined: Wed Jan 20, 2016 7:16 pm
Contact:

Re: About Question enthuware.ocejws.v6.2.157 :

Post by victor2016 »

Hi,

Please confirm my understanding:

- the File is always sent inline when the size is less than specified threshold
- if no threshold is specified, the File is always sent as attachment

Thanks,
Victor.

fjwalraven
Posts: 429
Joined: Tue Jul 24, 2012 2:43 am
Contact:

Re: About Question enthuware.ocejws.v6.2.157 :

Post by fjwalraven »

Hi Victor!

Yes, you understood it correctly!

Note that if you don't specify a threshold, the default of 0 bytes will be used.

Regards,
Frits

Gerardo
Posts: 16
Joined: Tue Nov 08, 2016 9:39 pm
Contact:

Re: About Question enthuware.ocejws.v6.2.157 :

Post by Gerardo »

Hi,
As howdy2u mentioned:
The API doc says ABOVE, ' binary data above this size in bytes will be XOP encoded or sent as attachment. ' So if attachment is 100 bytes and MTOM(threshold=100), then it should be sent inline. 101 would be sent as attachment. (http://docs.oracle.com/javase/6/docs/ap ... /MTOM.html)

For sending the binary data as an attachment which is true?
SIZE >= threshold?
or
SIZE > threshold?

Thanks in advance.

fjwalraven
Posts: 429
Joined: Tue Jul 24, 2012 2:43 am
Contact:

Re: About Question enthuware.ocejws.v6.2.157 :

Post by fjwalraven »

The API doesn't mention it like he is writing it, the answer is:

SIZE >= threshold?

You can verify it in the Metro JAX-WS documentation ( https://jax-ws.java.net/2.2.10/docs/rel ... ation.html )
7.2.4.1. How to specify MTOM data Threshold
Default threshold value for MTOM feature is 0 bytes. You can set a threshold value for MTOM by using @MTOM annotation on server-side or using MTOMFeature on client-side. Let's say you set MTOM threshold as 3000, this serves as hint to JAX-WS when to send binary dat as attachments. In this case, JAX-WS will send any byte array in the message thats equal to or larger than 3KB as attachment and the corresponding XML infoset will be XOP encoded (will contain reference to this attachment)
Regards,
Frits

Gerardo
Posts: 16
Joined: Tue Nov 08, 2016 9:39 pm
Contact:

Re: About Question enthuware.ocejws.v6.2.157 :

Post by Gerardo »

Thanks for the clarification Frits

johnlong
Posts: 197
Joined: Mon Jun 20, 2016 5:06 pm
Contact:

Re: About Question enthuware.ocejws.v6.2.157 :

Post by johnlong »

Client does not define any threshold, so it is assumed to be 0.
Does client infer threshold from server?

fjwalraven
Posts: 429
Joined: Tue Jul 24, 2012 2:43 am
Contact:

Re: About Question enthuware.ocejws.v6.2.157 :

Post by fjwalraven »

Good question!

You can define different thresholds on client and server. Let's say that the client has a threshold of 0 and the server has a threshold of 100. If you send a text message of 50 bytes from client to server and back. The message from client to server is sent as an attachment and from server to client inline.

The answer to your question: no they don't interfere.

Regards,
Frits

johnlong
Posts: 197
Joined: Mon Jun 20, 2016 5:06 pm
Contact:

Re: About Question enthuware.ocejws.v6.2.157 :

Post by johnlong »

Is default threshold 0 or 1Kb?

https://jax-ws.java.net/2.2.1/docs/mtom-swaref.html
As defined by JAXB 2.0 specification xs:base64Binary and xs:hexBinary mapping to java is byte[]. JAX-WS implementation has set a threshold of 1KB of byte[] size.
Default threshold value for MTOM feature is 0 bytes.

fjwalraven
Posts: 429
Joined: Tue Jul 24, 2012 2:43 am
Contact:

Re: About Question enthuware.ocejws.v6.2.157 :

Post by fjwalraven »

Follow the specs (JAX-WS 2.2) in this case:
6.5.2 javax.xml.ws.soap.MTOMFeature
The MTOMFeature has one property threshold, that can be configured to serve as a hint for which binary
data SHOULD be sent as an attachment. The threshold is the size in bytes that binary data SHOULD be
in order to be sent as an attachment. The threshold MUST not be negative. The default value is 0.
Regards,
Frits

Post Reply

Who is online

Users browsing this forum: No registered users and 29 guests