Details
-
Bug
-
Status: Closed
-
Blocker
-
Resolution: Fixed
-
1.5 Final
-
None
-
None
-
Win32 (maybe Linux too)
Description
The XSD_BASE64BINARY is wrongly copied when you add a parameter on a client call to a WS.
A XSD_BASE64BINARY is treated as a string instead as a memory block in SoapSerializer::addOutputParam method. In line 970 I've found the statement:
strcpy((char*)(pParam->m_Value.b64bValue->_ptr), (char*)(*((xsdbase64Binary *) (pValue)))._ptr);
and should be:
memcpy((char*)(pParam->m_Value.b64bValue->_ptr), (char*)(*((xsdbase64Binary *) (pValue))).ptr, pParam->m_Value.b64bValue->_size);
otherwise the copy will stopped at the first null value. Applying that patch the call works fine.
Steps to reproduce the bug
==========================
Expose on the server a WS with a method that accepts a binary memory block as parameter (a Java byte[]). Create the wsdl and a C++ client prototype with the tool:
%JAVA_HOME%\bin\java -classpath %AXIS_C_HOME%\lib\axis\wsdl2ws.jar;%AXISCLASSPATH% org.apache.axis.wsdl.wsdl2ws.WSDL2Ws %1 -o./ClientOut -lc++ -sclient class.wsdl
Complete the client call pasting some chunks of binary data on the parameter, whit a 0 value on the middle (e.g.: "abcd\0x00defg"). Compile the C++ client and run it, the server will receive correcltly the left side of the string preceding the 0, the other side will be undefined.