Please let us know the exact detail of exception, No problem can be solved unless you let it open for the others to think about. I guess the reason nobody hasn't yet answered your post is that your problem description points out only your guess not the real description of error, and it makes the reader to create a story in their mind.
The problem don't seem so complex, and I guess the problem description begins with
"I call a web service to store a PDF in a repository, the web service method signature
is this: e.g. <<public void attach(byte[] pdfBuffer, String pdfName)>>, but when I call that, an exception raises as follows: ......"
now it's your turn to complete the description.