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 Robert Sanford <rs...@trefs.com> on 2004/06/25 23:40:51 UTC

Client Access Violation

All,

I've previously used the Axis Java client code to great success but am now
trying to work through a simple SOAP client in C++ and having great
difficulty and am receiving an Access Violation. Using the Visual C++
debugger I trace the code down into 
  SoapSerializer::operator <<(const AxisChar* cSerialized)

And see that the violation is occuring at:
   strcat((char*)m_pSZBuffers[m_nCurrentBufferIndex].buffer,
   cSerialized);

I am trying to send up an XSD_STRING parameter that is the contents of a
file. After escaping the size of the buffer is just under 11,000 bytes. In
digging through the source code it appears to me that the size of the buffer
that the strcat is attempting to go into is 1024 bytes which will result in
an access violation as I ingloriously overwrite memory. I'm guessing this
because previous in the method I see
    int iTmpSerBufferSize = strlen(cSerialized);
    if((m_nFilledSize + iTmpSerBufferSize)>= m_nCurrentBufferSize) 

And m_nCurrentBufferSize is 1024 which is what is allocated when
SetNextSerializeBuffer is called. 

Basically, I don't see anything that is taking the size of what I want to
send into account.

Please tell me that I'm missing something. My code is amazingly simplistic
and is copied below my sig.

Many thanks!

rjsjr

m_pCall = new Call();

m_pCall->SetProtocol(APTHTTP);
m_pCall->SetEndpointURI("http://localhost/soap/services/RequestDispatch");

Ret = m_pCall->Initialize(CPP_RPC_PROVIDER, NORMAL_CHANNEL);
if (AXIS_SUCCESS != Ret)
	return Ret;

m_pCall->SetSOAPVersion(SOAP_VER_1_1);
m_pCall->SetOperation("dispatch", "http://soapinterop.org/");
m_pCall->AddParameter(&xmlDoc, "arg0", XSD_STRING);
	
if (AXIS_SUCCESS == m_pCall->Invoke())
{
	if(AXIS_SUCCESS == m_pCall->CheckMessage("dispatch",
"http://localhost/soap/services/RequestDispatch"))
	{
		AxisChar* ret = m_pCall->GetElementAsString("dispatch", 0);
	}
}

m_pCall->UnInitialize();

RE: Client Access Violation

Posted by Susantha Kumara <su...@opensource.lk>.
Hi Robert,

This is a bug. This is unhandled situation. Thanks a lot for tracking it
down. Have you entered this as a bug at Jira ?. If not please add it.

Susantha.
---

> -----Original Message-----
> From: Robert Sanford [mailto:rsanford@trefs.com]
> Sent: Saturday, June 26, 2004 3:41 AM
> To: axis-c-user@ws.apache.org
> Subject: Client Access Violation
> 
> All,
> 
> I've previously used the Axis Java client code to great success but am
now
> trying to work through a simple SOAP client in C++ and having great
> difficulty and am receiving an Access Violation. Using the Visual C++
> debugger I trace the code down into
>   SoapSerializer::operator <<(const AxisChar* cSerialized)
> 
> And see that the violation is occuring at:
>    strcat((char*)m_pSZBuffers[m_nCurrentBufferIndex].buffer,
>    cSerialized);
> 
> I am trying to send up an XSD_STRING parameter that is the contents of
a
> file. After escaping the size of the buffer is just under 11,000
bytes. In
> digging through the source code it appears to me that the size of the
> buffer
> that the strcat is attempting to go into is 1024 bytes which will
result
> in
> an access violation as I ingloriously overwrite memory. I'm guessing
this
> because previous in the method I see
>     int iTmpSerBufferSize = strlen(cSerialized);
>     if((m_nFilledSize + iTmpSerBufferSize)>= m_nCurrentBufferSize)
> 
> And m_nCurrentBufferSize is 1024 which is what is allocated when
> SetNextSerializeBuffer is called.
> 
> Basically, I don't see anything that is taking the size of what I want
to
> send into account.
> 
> Please tell me that I'm missing something. My code is amazingly
simplistic
> and is copied below my sig.
> 
> Many thanks!
> 
> rjsjr
> 
> m_pCall = new Call();
> 
> m_pCall->SetProtocol(APTHTTP);
>
m_pCall->SetEndpointURI("http://localhost/soap/services/RequestDispatch"
);
> 
> Ret = m_pCall->Initialize(CPP_RPC_PROVIDER, NORMAL_CHANNEL);
> if (AXIS_SUCCESS != Ret)
> 	return Ret;
> 
> m_pCall->SetSOAPVersion(SOAP_VER_1_1);
> m_pCall->SetOperation("dispatch", "http://soapinterop.org/");
> m_pCall->AddParameter(&xmlDoc, "arg0", XSD_STRING);
> 
> if (AXIS_SUCCESS == m_pCall->Invoke())
> {
> 	if(AXIS_SUCCESS == m_pCall->CheckMessage("dispatch",
> "http://localhost/soap/services/RequestDispatch"))
> 	{
> 		AxisChar* ret = m_pCall->GetElementAsString("dispatch",
0);
> 	}
> }
> 
> m_pCall->UnInitialize();