I'm customizing a shopping cart application in php. In this application, I have to integrate some parts with another C#.net application, so I'm using a webservice in a php shopping cart. In one method of the webservice, some values should pass as an associative array like this:
$proxy = new SoapClient('www.mywebservice.com?wsdl');
$associative_array= array(
'abc'=> 1,'def'=>0,'ghi'=>1,'jkl'=>0
);
$proxy->call($sessionId, 'methodname', array('somevalue', $associative_array));
In php its working fine... but the problem is that I'm struggling with C#.net, how can I pass an associative array with C#.net? I'm a php programmer, I think there's no associative array in C#.net and somebody said that C# Dictionary can be used instead of that, but that's not working with the webservice call.
C# code is:
Dictionary<string,string> map=new Dictionary<string,string>();
map.Add("abc","1");
map.Add("def","0");
object st = mgs.call(sessionid, "methodname", new object[] { "somevalue",map });
Can anybody give some advice???
C programming language is a machine-independent programming language that is mainly used to create many types of applications and operating systems such as Windows, and other complicated programs such as the Oracle database, Git, Python interpreter, and games and is considered a programming foundation in the process of ...
In the real sense it has no meaning or full form. It was developed by Dennis Ritchie and Ken Thompson at AT&T bell Lab. First, they used to call it as B language then later they made some improvement into it and renamed it as C and its superscript as C++ which was invented by Dr.
Compared to other languages—like Java, PHP, or C#—C is a relatively simple language to learn for anyone just starting to learn computer programming because of its limited number of keywords.
C is more difficult to learn than JavaScript, but it's a valuable skill to have because most programming languages are actually implemented in C. This is because C is a “machine-level” language. So learning it will teach you how a computer works and will actually make learning new languages in the future easier.
I think you want a Dictionary<string, int>
. But I could be wrong. You should see what the generated class is used when you call the web service.
To call the web service, right click the References folder of your project. Say Add Service Reference.
Put the WSDL url in there and let it generate the classes for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With