Sorry please find the correct client code which gives exception /////////////////////////////////////////////////////////// InstanceContext ct = new InstanceContext(new Program()); //generated proxy KineticServiceClient client = new KineticServiceClient(ct); Dictionary response = null; Dictionary> request = new Dictionary>(); List lst= new List(); lst.Add("hello"); lst.Add(23); /* Dictionary dict = new Dictionary(string,string>); dict.Add("1", "10"); dict.Add("2", "10"); dict.Add("3", "10"); lst.Add(dict); */ request.Add("test1",lst); client.Func(out response, request);
naeemnimi
Posts
-
WCF over TCPIP Serialization Exception while sending dictionary in a dictionary -
WCF over TCPIP Serialization Exception while sending dictionary in a dictionaryHi, I have created two programs to test WCF using TCPIP binding. One program is acting as a client and other is acting as a server. Server has one function which is something like /////////////////////////////////////////////////////////// public bool Func(out Dictionary > response,Dictionary > request) { return true; } /////////////////////////////////////////////////////////// The client on the other hand has following code for using this function /////////////////////////////////////////////////////////// InstanceContext ct = new InstanceContext(new Program()); //generated proxy KineticServiceClient client = new KineticServiceClient(ct); Dictionary> response = null; Dictionary> request = new Dictionary>(); List lst= new List(); lst.Add("hello"); lst.Add(23); /* Dictionary dict = new Dictionary(); dict.Add("1", "10"); dict.Add("2", "10"); dict.Add("3", "10"); lst.Add(dict); */ request.Add("test1",lst); client.Func(out response, request); //////////////////////////////////////////////////////////////////// Everything works fine until I uncomment above commented code in client program. Then I start getting following exception "There was an error while trying to serialize parameter Avanza.Kinetic.Terminal.Communication:request. The InnerException message was 'Type 'System.Collections.Generic.Dictionary`2[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' with data contract name 'ArrayOfKeyValueOfstringstring:http://schemas.microsoft.com/2003/10/Serialization/Arrays' is not expected. Add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.'. Please see InnerException for more details." I've got no idea why it is happening. Can any body help??
-
How To Get Local Printer statusHi All, I want to know how we can get the printer status/state whether it is out of paper, paper jammed etc.
-
Converting Bmp to monochrom BMPHi All, I have opened one bmp file and I want to save this bitmap as monochrom bitmap file. Please do note when the monochrom file is open using mspaint or any other tool and when you select save as it should automatically give monochrom bitmap format. Can anybody help me out here.
-
How to read a text file in VB 6Hello, Can any body tell me how to read a text file in visual basic 6.The file contains the data not more then 2k. Thanks in advance,
-
Using CDO in VC6 how to send emailHello, can body tell me how to send email in VC6 using CDO.
-
Sending email in VC++ 6.0Hello, Can somebody would tell me how to send email in C++ using smtp.
-
SMTP implementation in C++hello, Can somebody please tell how to send email in C++ using smtp. I wan't to make a function of this form. bool SendMail(string strFrom,string str strTo,string strMsg); But I don't know what to do??????????
-
CryptEncrypt and CryptDecrypt functions of CryptoApi problemsHello: I am having following error while using CryptEncrypt and CryptDecrypt for public private key pair of Windows CryptoApi .I am using windowsXP as OS. The code of the class I am using is given below. I am having problem while using Encrypt and Decrypt functions of the class. Can anybody would tell me where is the error and how to remove it or could make the code right where error occurs. Thanks, Naeem //////////////////////////////Header File///////////////////////// #define _WIN32_WINNT 0x0400 #include #include #include // Helper class definition to generate and export Public/Private keys // for Asymmetric encryption. The semantics for usage are: // Call AcquireContext with a container name, call // GenerateKeyPair next and then call ExportPublicKey or // ExportPrivateKey. class CryptoHelper { private: HCRYPTPROV m_hCryptProv; HCRYPTKEY m_hSessionKey; BYTE *m_pPublicKey; BYTE *m_pPrivateKey; BYTE *m_pEncSessionKey; DWORD dwPrivateKeyLen; DWORD dwPublicKeyLen; DWORD dwEncSessionKeyLen; public: HCRYPTKEY m_hCryptKey; CryptoHelper(); ~CryptoHelper(); HRESULT AcquireContext(LPCTSTR wszContainerName); HRESULT GenerateKeyPair(); HRESULT ExportPublicKey(BYTE **ppPublicKey, DWORD &cbKeySize);; HRESULT ExportPrivateKey(BYTE **ppPrivateKey, DWORD &cbKeySize); void Encrypt(char **Input,char **Output,DWORD &dwLen); void Decrypt(char **Input,char **Output,DWORD &dwLen); }; //////////////////////////////The CPP File///////////////////////// #include "CryptoHelper.h" #include //#include "Cspdk.h" // The RSA public-key key exchange algorithm #define ENCRYPT_ALGORITHM CALG_RSA_KEYX // The high order WORD 0x0200 (decimal 512) // determines the key length in bits. #define KEYLENGTH 0x02000000 #define SESS_KEYLENGTH 0x00800000 //128 Bit //-------------------------------------------------------------------- // The constructor initializes the member variables // to NULL. //-------------------------------------------------------------------- CryptoHelper::CryptoHelper() { m_hCryptProv = NULL; m_hCryptKey = NULL; m_hSessionKey = NULL; m_pPublicKey=NULL; m_pPrivateKey=NULL; m_pEncSessionKey=NULL; dwPrivateKeyLen=0; dwPublicKeyLen=0; dwEncSessionKeyLen=0; } //-----------------------------------------------