I work with spring-ws 4.3.3 and I would like to know if it's possible to get the real content-size for a soap request that contains a datahandler parameter.
The following code works well if the request size seems to be less than 4096 bytes otherwise if content-size is greater than 4096, requestSize equals -1. However in the javadoc it's written :
Returns the length, in bytes, of the request body and made available by * the input stream, or -1 if the length is not known ir is greater than * Integer.MAX_VALUE
In my example I try to generate an error message if the soap request exceeded 51200000 but if my request is greater than 4096 the error appears.
TransportContext tc = TransportContextHolder.getTransportContext();
HttpServletConnection connection = (HttpServletConnection) tc.getConnection();
Integer requestSize = connection.getHttpServletRequest().getContentLength();
if (requestSize==-1 || requestSize > 51200000) {
response.setStatus(getStatusResponse(PricingConstants.WS_FILE_SIZE_EXCEEDED_CODE,
PricingConstants.WS_FILE_SIZE_EXCEEDED_MSG));
return response;
XSD
<xs:complexType name="wsAddDocumentRequest">
<xs:sequence>
<xs:element name="callingAspect">
<xs:complexType>
<xs:sequence>
<xs:element name="userId" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Id" type="xs:string" />
<xs:element name="contentPath" type="xs:string" minOccurs="0" />
<xs:element name="file" type="xs:base64Binary" minOccurs="0"
xmime:expectedContentTypes="application/octet-stream" />
<xs:element name="document" type="prc:document" />
<xs:element name="authorizedUsers" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="user" type="xs:string" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
Thanks