Receive JSON Array As Argument In Web Service?

Jul 6, 2010

I'm using a web service programmed in Visual Basic .NET 3.5 to receive a JSON Array sent from other application.

I'm sending a JSON string like this one:
[{"idRecoleccion":1,"PIN":"553648138"},{"idRecoleccion":2,"PIN":"553648138"}]
And I'm receiving the code in Visual Basic .NET as follows:

[code]...

View 1 Replies


ADVERTISEMENT

Constructing Function In SOAP Web Service To Receive An Array

Aug 4, 2011

I have a specific problem that I have not yet found an answer to. Basically I need to pass a list of numbers into a function do some math and return them. I can pass one number at a time without a problem, however when I want to pass in an array I start to have issues. My VB.net code looks like this...

[Code]...

View 1 Replies

Receive Command Line Argument?

Mar 25, 2009

I want to receive command line argument in my application like this.I have two different projects A and b when i execute A it should give an error message ( No Arguments ) but if i executes the project B ( it should pass a command line argument and the project A should start normally. the problem it that i can start application with arguments but i do not know how to receive arguments and execute different processes.

View 1 Replies

Convert JSON To Array OR JSON To XML?

Jul 17, 2011

How can I convert a JSON string to an array OR a JSON string to XML in VB.NET? I know how to do this in C#, as I have read dozens of articles on it, however, I am unable to figure out how to achieve the same result in VB.NET.

I'm using the System.Web.Script namespace via System.Web.Extensions.dll (from Microsoft).

I'm willing to use an additional DLL file if needed.

View 1 Replies

WCF Not Deserializing JSON / Parameters In Web Service Are Null

Jun 17, 2011

I am having the same issues as per this question: WCF not deserializing JSON input..I am at a loss and desperate for a solution. I have scoured the net for answers, but I have found only this question that matches my exact problem. My datacontract parameter is also nothing when the service starts.I have tried the points of the answer in the question above, but they provide me with no clues (The web service executes OK -I am not getting any exceptions - and I can't see what the deserializer is doing - or not doing as the case may be).I am using POST, due to the size of the nested JSON.If more detailed information is needed, I will provide it on request.[code]

View 2 Replies

Generic Mustinherit Class - Receive: "Type Argument BaseObject Is Declared 'MustInherit' ?

Aug 23, 2011

i have 2 mustinherit classes where one is a generic one:

'Visual Basic 2008 - .net 3.5 - Any CPU
Public MustInherit Class BaseObject

End Class

Public MustInherit Class BaseObjectList(Of T As {New, BaseObject})
Inherits List(Of T)
End Class[code]...........

i receive: "Type argument BaseObject is declared 'MustInherit' and does not satisfy the 'New' constraint for the type parameter"users would never enter data in the wrong form,files they choose to open would always exist and code would never have bugs.

View 1 Replies

Windows Service - Using Sockets To Send / Receive Data

Jul 27, 2009

I have written a windows service that uses sockets to send receive data, it works fine when the server has been running and all other services have started, but after a reboot it does not work. Now I know its probably dependant on another service and I know how to add dependencies, but how do I work out which services its dependent on?

View 1 Replies

Web Service To Deserilize JSON Http Request - Pass To Stored Procedure To Retrieve Data From SQL Server

Aug 23, 2011

I have a task to create a web service to receive client-side app's http request(with rpc={json data} in the end), deserilize it and put he parameter in stored Procedure in order to retrive data from sql server. the procedure query and client-side's app are already there and the return data to client-side app is JSON too

View 1 Replies

Asp.net - Serialize Array To Json?

Jun 23, 2011

I have the following code which serialize an array to json:

Dim col1 As New ArrayList
Dim col2 As New ArrayList
objJSONStringBuilder = New StringBuilder()
objSQLConnection = New SqlConnection(System.Configuration.ConfigurationManager.AppSettings("connString"))
objSQLCommand = New SqlCommand("select col1, col2 from table1", objSQLConnection)
objSQLCommand.Connection.Open()

[Code]...

View 2 Replies

Deserialize Json Array In .net?

Feb 1, 2011

I have a json array which is formatted as follows:

[Code]...

How can I deserialize this in such a way that I can have a list of objects indexed by property? Meaning, I want to be able to access the data like this: MyList(96).lastproperty or MyList(96).listofstuff.yetanother and have it return the proper datatype too? Is that even possible in vb.net?

View 2 Replies

Encode An Array To JSON?

Feb 23, 2009

I need to pass back a JSON result for a routine I am working with. How can I encode an Array I created to JSON? I am writing this in VB.net

View 4 Replies

Parsing A JSON Array?

May 6, 2011

I'm trying to parse this array using JSON.NET

[Code]...

View 1 Replies

Create JSON Array Using Program?

Mar 5, 2012

How to create this JSON array using vb.net array [code]...

View 1 Replies

Deserializing Json Array Into .net Class?

Feb 16, 2010

I'm having problems deserializing some json data, getting InvalidCastExceptions and the like.

Can anyone point me in the right direction?

Here's the json i'm wanting to deserialize;

[{"OrderId":0,"Name":"Summary","MaxLen":"200"},{"OrderId":1,"Name":"Details","MaxLen":"0"}]

Here's my code;

[Code]...

View 3 Replies

JavaScript Serialize Array To JSON?

Mar 28, 2011

I have "Form Designer" web application, in which I need to post the controls of the new form to an ASP.Net page to insert to DB, each time I create form control. I push it into two dimensional array, when user click save, this array will be serialized and sent to Server Page using Ajax.

Array string After Serialization Looks Like :
[
[

[code].....

View 2 Replies

Client Socket - Send Message Through Client Socket Receive Specified Argument Was Out Of Range Of Valid Values

Oct 15, 2011

Below is my code, but when i send the message thru client socket i receive Specified argument was out of the range of valid values. Parameter name: size

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim serverStream As NetworkStream = clientSocket.GetStream()
Dim outStream As Byte() = _
System.Text.Encoding.ASCII.GetBytes("0800822000000000000004000000000000000920092126012345001")

[CODE]...

View 1 Replies

Deserialize A Simple JSON Array To .NET Objects?

Feb 3, 2012

I am attempting to deserialize a simple JSON array to .NET objects using the JSON.NET library in visual basic.

For the life of me, I cannot figure out what I am doing wrong here. My JSON string deserializes into appropriate objects (9 in total), but none of the properties are populated.

My code:

Public Class result
Public Property id As Integer
Public Property vote_percentage As String

[Code]....

When using JSON.NET you have to have constructor methods (i.e. Sub New) in order for the properties to get set during the Deserialization call.

View 1 Replies

Passing A JSON Object As A Dictionary(Of String, Object) To WCF Web Service?

Sep 8, 2011

I'm trying to setup a WCF web service to be consumed by JavaScript using JSON and jQuery.I've noticed that you can send JSON without a DataContract if the service method parameters match the naming structure of the JSON object:

<ServiceContract(Namespace:="http://foo.com/bar")>
<AspNetCompatibilityRequirements(RequirementsMode:=AspNetCompatibilityRequirementsMode.Allowed)>

[code]....

View 1 Replies

Javascript - JSON Array Type Resolution In ASP.Net Webservices?

Jan 6, 2011

I have worked out how to pass my custom objects into ASP.Net json webservices. Works a charm. Problem I am having is passing in straight arrays of my custom objects or alternatively passing in arrays that are parameters of my custom objects. So for example...

Public Class WebService1
Inherits System.Web.Services.WebService
<WebMethod()> _

[code]....

Fails with error: The value "System.Collections.Generic.Dictionary`2[System.String,System.Object]" is not of type "WebApplication1.WebService1+Person" and cannot be used in this generic collection. Parameter name: value

So how do I explain to ASP.net that it is infact an array of Person? note: That changing the function to as List(of Person) or ArrayList does work but given that I implement my own custom collections this is not optimal for me.

UPDATE: Ok so what I have worked out so far is that this problem is definitely associated with how the JavascriptSerializer uses the SimpleTypeResolver to resolve types. Basically if I do something like this

Public Function AddPersonList(ByVal PersonList As String) As PersonList

I can recreate the error using the following code.

Dim PersonList As PersonList = jsonSerializer.Deserialize(Of PersonList)(PList)

However when I provide my own custom type resolver along the lines of

Dim jsonSerializer As New JavaScriptSerializer(New MyCustomTypeResolver)

I can successfully create an instance of my custom list.Now I have worked out how to provide my own custom convertor in the web.config file. Along the lines of this....

<system.web.extensions>
<scripting>
<webServices>

[code]....

PSS: I have tried to use the assembly fully qualified name as specified in the docs for the SimpleTypeResolver (SimpleTypeResolver MSDN) but this throws a "Operation is not valid due to the current state of the object." exception - which is an error caused when the TypeResolver cannot resolve the name?

My problem was never passing in a List(of Object) into my webservice (I simply posed the question as such to simplify it for stackoverflow). In such a case I would be willing to completely accept using a Generic List(of) but my problem was actually that one of my custom objects implemented a property with a strong typed List(of) so for example:

Customer {CustomerID AS Guid, FirstName AS String, LastName AS String, EmailAddresses AS EmailAddressList}

which now needs to be changed to

Customer {CustomerID AS Guid, FirstName AS String, LastName AS String, EmailAddresses AS List(Of EmailAddress)}

This is admittedly not the end of the world and is probably better in the webservice context (as you have suggested) but definitely a detriment when it comes to internal application usage of my Collection properties. What this means is that once I have this property I either need to cast it to my CustomCollectionList every time I want to use some advanced feature or I need to implement another property which exposes the CustomCollectionList.

View 5 Replies

Json - JavaScriptSerializer() Deserializing Dictionary Array Members

Dec 4, 2011

I am trying to deserialize a JSON string that looks like so: {'type':'clientlist','client_list':[]} I am using JavaScriptSerializer() to do it. For some reason the JavaScriptSerializer() is choking on the member 'client_list'. It doesn't give very good info. The error it gives is:

[Code]...

View 1 Replies

How To Pass Array As Argument

Mar 6, 2010

Does the following work in VB 2008 for passing an array to a function:
Public Function functionname(ByVal array1() As Short, ByVal array2() as Short) As Short
Also, can ByRef be used in place of ByVal?

View 2 Replies

Passing Array As Argument?

Feb 28, 2010

When I try to do the same in .net the "array argument" value of the second sub is either Nothing or I get an error saying "Value of type 'String' cannot be converted to'System.Array'."I've tried converting the array to a system.array but it will not hold all the Types of data it needs to hold. (I tried 3 days ago and don't remember what Types would cause an error. My 1st value is a string and the second is an integer and this caused some error.)

View 1 Replies

Make A MVC 2 Json Serializable Structure With Apropriate PK Array Keys?

Jan 1, 2010

I have a table with a Int PK column and a name. I want to load them into an object of some sort and return them using Json() ActionResult in MVC 2. I am having a hard time finding a built-in structure that is supported for serialization that keeps a simple key/value structure in tact.

Ultimately I would like to do something like:
Function JsonList() As ActionResult
Dim Things = New Dictionary(Of Integer, String)

[code].....

View 1 Replies

Twitter Json - Unable To Convert To Jobject Or Jarray Using Json.net / Javascriptserializer?

May 9, 2012

I am been stuck on this for 3 days now...I have been accessing the twitter api to pull a user_timeline for a list of users and the json that comes back is impossible to work with. I tried to deserialize it using javascriptserializer and get an error:invalid object passed in , ':' or '}'

Now this is frustrating since I expect the json being returned to be error free. Then I tried json.net and split the posts using string.split and tried to convert each post to Jobject or jarray. for Jarray I get

'unexpected end of content while loading jArray

[Code]...

Now I have formatted the code here and not pasted the whole file but it does look like valid json to me and I do not alter anything after receiving the stream from the twitter api. Can someone please point me in the right direction? I really need to get this stuff parsed?

View 1 Replies

JSON.NET Deserialize - Next JSON String - Returns Always An Empty Result

Feb 21, 2011

I'm strugling the whole day with the next JSON string

{
"0":{"link":"afbeeldingenplaatje1.jpg"},
"1":{"link":"afbeeldingenplaatje2.jpg"},
"2":{"link":"afbeeldingenplaatje3.jpg"}
}

How can i deserialize this? What's wrong with the next code (vb.net)

Public Class DataString
Private m_link As String
Public Property link() As String
Get

[CODE]...

It returns always an empty result.

View 1 Replies

Receiving Json And Send Back Json On Server-side?

Jul 28, 2011

how to receive and send back json. Hope someone can help me on this. I understand by examples.

On my clientside, I am sending a ajax json string "name":"theName" to the server side and would like the server side to return a string saying "welcome &name ".

Client-side code
<!DOCTYPE html>
<html>

[Code]....

View 2 Replies

Pass An Array Of Arrays As A Function Argument?

Nov 11, 2010

I have several parameters consisting of separate System.Byte() arrays. What I need is the syntax for a function declaration where the parameter is an array of arrays - I do not want to delve into System.Collections, and it's my preference not to CType each array into an Object and then back into a Byte().

Problem I'm having here is that:

Public Function MyFunc(arrayparam() As System.Byte) As System.Byte()

accepts a single-dimensional Array of individual Bytes.

Then Public Function MyFunc(arrayparam() As System.Byte()) As System.Byte()

View 12 Replies

Passing A Array As A Argument To A Javascript Function?

Apr 20, 2011

Im trying to pass a array as a argument to a Javascript function from code behind(vb.net)
Code im trying

[code].....

View 2 Replies

Deserializing JSON Into Byrefrence ParametrizedConstructor Object With Json?

Nov 12, 2010

Below is my JSON formated String

{"AliasName": "ysiCountryInfo", "DataClass": {"Description":"United States 111","Code":"usa","WriteOffTaxPointAdjustment":0,"IndexationRounding":6}}
I would like to deserialize object into below class

[code].....

View 1 Replies

Error: Expression Is Not An Array Or A Method And Cannot Have An Argument List

Aug 4, 2011

i have these 3 sets of code that are giving me INT() errors. Error: Expression is not an array or a method, and cannot have an argument list.

Code1:

Private Sub Form6_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim Browser As New WebBrowser

[code]....

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved