Common AmeriCommerce SOAP Web Service API / SDK Errors

Follow

ERROR:  System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Security.SecurityException: Unauthorized Request: No security header in place, please pass proper security information in the SOAP header of the web service, see AmeriCommerce help for more information and samples.  Check that the security header on the request exists, if problem persists it can be related to the web method not requiring the security header but still calling authorize.

CAUSE/RESOLUTION

The AmeriCommerce security header is not in place within your API request, or the called method is not asking for the security header and is still attempting to authorize its operations.  The security header not in place is the problem 99% of the time.  See the getting started with the API document on how to set the security header and API token.

 

ERROR:  The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.   The remote certificate is invalid according to the validation procedure.

CAUSE/RESOLUTION

The SSL Security Certificate on the server is not trusted or does not match according to the .Net validation procedures. 

NOTE: For AmeriCommerce developers, this can be due to the URL not matching your Self Signed Security certificate from IIS.  For example, if your local path is https://secure.localhost.com/store/ws/AmeriCommerceDb.asmx but the SSL is issued to https://yourbox.yourdomain.com/store/ws/AmeriCommerceDb.asmx then the certificate will not pass validation.

COMMON STACK TRACE

  at System.Net.Security.SslState.StartSendAuthResetSignal(ProtocolToken message, AsyncProtocolRequest asyncRequest, Exception exception)
   at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)
   at System.Net.TlsStream.CallProcessAuthentication(Object state)
   at System.Threading.ExecutionContext.runTryCode(Object userData)
   at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Net.TlsStream.ProcessAuthentication(LazyAsyncResult result)
   at System.Net.TlsStream.Write(Byte[] buffer, Int32 offset, Int32 size)
   at System.Net.PooledStream.Write(Byte[] buffer, Int32 offset, Int32 size)
   at System.Net.ConnectStream.WriteHeaders(Boolean async)

 

ERROR:  InvalidOperationExeption was unhandled There is an error in XML document (47, -847). {"'.', hexadecimal value 0x00, is an invalid character. Line 47, position -847."} The data is {System.Collections.ListDictionaryInternal}

CAUSE/RESOLUTION

There is typically XML in one of the columns of your customer/order/product record.  This really only happens when you have implemented a custom form that saves it's values in XML onto one of these records.  Since the web service is also XML you end up with XML within XML and the Microsoft deserializer cannot work out the differences to reconstruct the data.

To fix, you should remove the XML data on the records.  An alternative to custom forms is our newer feature "Custom Fields" where you can add questions and answers to the different items in the system.

COMMON STACK TRACE

at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
  at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle)
   at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
   at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)

 

Have more questions? Submit a request

Comments