You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-user@axis.apache.org by Jamie <ja...@mweb.co.za> on 2005/05/10 18:45:32 UTC
calling a method with xsd__base64Binary
Hi
I am using the Axis C++ API to send compressed emails from a C++ client
to a server implemented in Java.
In my client code (see below), I have an exposed function called
storeMessage, that has a xsd__base64Binary parameter. When I send the
email without compression (i.e. plaintext), the data is passed
correctly. However, when I compress the data using zlib, I get a wierd
message "xarchiveInternalReturn e" (each letter seperated by null
characters) coming through as a parameter. See source below.
CA2GZIP gzip((char*)pszBuffer,ulFileSize); //
wrapper library for zlib services.. pszBuffer contains plaintext email
char endpoint[256];
sprintf (endpoint,
"http://127.0.0.1:8080/testservice/services/TestService");
TestService webservice(endpoint);
xsd__base64Binary bb;
bb.__ptr = (xsd__unsignedByte*)gzip.pgzip; //
contains compressed data
bb.__size = gzip.Length;
FILE *aout=fopen("c:\\test.gz","wb"); // just
for testing to see that the message is valid for debugging purposes
size_t count1=fwrite(bb.__ptr,1,bb.__size,aout);
fclose(aout);
webservice.storeMessage(bb);
Am I missing something here? I assume the AXIS will take care of the
base64 conversion before sending the message?
I have also noticed that Axis C++ generates a nasty access fault when an
exception is thrown from the client. It tries to delete a stray pointer.
Has anyone experienced problems with exceptions?
Thanks in advance for your help.
Jamie
web service exception causes crash - possible bug in WSDL2Ws?
Posted by Jamie <ja...@mweb.co.za>.
Hi everyone,
I am using the latest nightly build of Axis C++. My client application
crashes when an exception is thrown from the server via Axis web
services. The generated code (see below), attempts to delete memory
pointed to by detail (fault point is marked below). The contents of
detail at this point is"<hostname>jamie</hostname>". Any ideas on how to
fix this? From time to time, my server application throws exceptions..
in which case i'd like the client app to behave responsibly.
Thanks in advance for your help.
Jamie
Is this a bug in the code generated by WSDL2Ws?
/*
* This method wrap the service methodstoreMessage
*/
xsd__boolean TestApp::storeMessage(xsd__base64Binary Value0)
{
xsd__boolean Ret = false_;
const char* pcCmplxFaultName;
pcCmplxFaultName = NULL;
try
{ if (AXIS_SUCCESS != m_pCall->initialize(CPP_DOC_PROVIDER))
return Ret;
if (NULL==m_pCall->getTransportProperty("SOAPAction",false))
{
m_pCall->setTransportProperty(SOAPACTION_HEADER , "");
}
m_pCall->setSOAPVersion(SOAP_VER_1_1);
m_pCall->setOperation("storeMessage", "url:TestApp");
includeSecure();
applyUserPreferences();
char cPrefixAndParamName0[13];
sprintf( cPrefixAndParamName0, "%s:in0",
m_pCall->getNamespacePrefix("url:TestApp"));
m_pCall->addParameter((void*)&Value0, cPrefixAndParamName0,
XSD_BASE64BINARY);
if (AXIS_SUCCESS == m_pCall->invoke())
{
if(AXIS_SUCCESS == m_pCall->checkMessage("storeMessageResponse",
"url:TestApp"))
{
xsd__boolean * pReturn =
m_pCall->getElementAsBoolean("storeMessageReturn", 0);
if(pReturn)
Ret = *pReturn;
}
}
m_pCall->unInitialize();
return Ret;
}
catch(AxisException& e)
{
int iExceptionCode = e.getExceptionCode();
if(AXISC_NODE_VALUE_MISMATCH_EXCEPTION != iExceptionCode)
{
m_pCall->unInitialize();
throw;
}
ISoapFault* pSoapFault = (ISoapFault*)
m_pCall->checkFault("Fault","http://127.0.0.1:8080/TestApp/services/TestAppService"
);
if(pSoapFault)
{
const char *detail = pSoapFault->getSimpleFaultDetail();
bool deleteDetail=false;
if (NULL==detail || 0==strlen(detail))
{
detail=m_pCall->getFaultAsXMLString();
if (NULL==detail)
{
detail="";
}
else
{
deleteDetail=true;
}
}
OtherFaultException ofe(pSoapFault->getFaultcode(),
pSoapFault->getFaultstring(),
pSoapFault->getFaultactor(),
detail, iExceptionCode);
if (deleteDetail && NULL!=detail)
{
delete [] const_cast<char*>(detail); //
!!!!!!!!!!!!!! CRASHES HERE !!!!!!!!!!!!!!!!!!!!
}
m_pCall->unInitialize();
delete pSoapFault;
throw ofe;
}
else
{
m_pCall->unInitialize();
delete pSoapFault;
throw;
}
}
}