I have been using Staff Webservices library for implementing webservices with much success in my current application. However, I have run into a problem.
I am returning image data as a byte64 encoded std::string in one of my services. Whenever the response is over 2MB or so, I get a blank string as the response on my client side.
Note that I am using the simple Axis2c HTTP server to serve all my Staff services. Would this be causing me to hit the limit? Can I configure the maximum size of a service response somewhere?
WSF Staff itself does not have any limitations for response size. Internally it's processed by AxiOM (Axis2/C object model), which may introduce the limitations.
When using axis2c-unofficial I cannot reproduce it.
As example, this is my test service:
class TestBase64: public staff::IService
{
public:
// *restEnable: true
// *restMethod: GET
// *restLocation: test
virtual staff::base64Binary test() = 0;
};
// impl:
staff::base64Binary TestBase64Impl::test()
{
staff::ByteArray a(4 * 1024 * 1024);
staff::byte* b = a.GetData();
for (int i = 0, l = a.GetSize(); i < l; ++i) {
b[i] = static_cast<staff::byte>(i);
}
return staff::Base64Binary(a);
}
and client:
const staff::base64Binary& ttestResult = pTestBase64->test();
staff::LogInfo() << "test result: " << ttestResult.ToString().size();
Suggestions:
If nothing helps you could try to save the binary data as temporary file on web server and response with the url to that file and download that file on client separately;