Return Multiple Objects As JSON From Asp.net Webservice?

May 30, 2012

I have the following code to return a one-object JSON array,

Imports System.ServiceModel
Imports System.ServiceModel.Activation
Imports System.ServiceModel.Web

[code]....

The returned data is :

{id:1,Text:"TText test"}

How to make it returns :

[{id:1,Text:"Text 1"},{id:2,Text:"Text 2"}]

View 2 Replies


ADVERTISEMENT

Asmx Asp.net Webservice Return Multiple Classes Wsdl?

Aug 18, 2011

We are developing a webservice for a client. We are not supose to throw SoapExceptions, so instead, we catch every exception server side, and return a custom Exception class.

Public Class Order
...
End Class

[Code]....

The problem now is, that since my webmethod is returning the type [Object]. The wdsl that is generated does not contain the order, or the exception.

I can change the [Object] to [Order] Or [MyException], but only one of them is generated in the wsdl.

I want both the MyException type and the Order type in my wsdl, but i just cant get it working.

View 2 Replies

Translate PHP Json Webservice Request TO .Net Json Webservice Request?

Jun 13, 2011

I have to send a request to Webservice and I have a working PHP solution, that I have to translate in VB.net

Here's the code working in PHP

//fill in the details of the contacts.userId is obtained from loginResult.
$contactData = array('lastname'=>'Valiant', 'assigned_user_id'=>$userId);
//encode the object in JSON format to communicate with the server.

[code]....

Naturally I imported a reference to a Json library and Imported (Imports Newtonsoft.Json)?

View 1 Replies

.net - Passing Data To ASP.NET Webservice Using JSON?

Jun 22, 2010

I have successfully returned data from a ASP.Net webservice in JSON format (using a service method that required no parameters) but have struggled with making a webservice call that requires a parameter.

Webservice:

[Code]...

View 1 Replies

Send JSON As Response From A WebService In .NET?

Jun 20, 2012

I'm building a Web Service in VB.NET and I want to answer using JSON.
Currently my answers looks like this

{"myVar1" : "From moscow", "myVar2" : "With love"}

I would like to be able to use " (and CarriageReturn), and have the reponse like this :

{"myVar1" : "From moscow", "myVar2" : "With love"}

How can I avoid this transcoding of the " in " ?

Here is my interface definition :

<OperationContract()>
<WebGet(UriTemplate:="/TemplateGet?ID={id}",
ResponseFormat:=WebMessageFormat.Json,

[Code]....

View 1 Replies

Updating Webservice With Objects When App Exits?

Jun 13, 2011

Im working on a silverlight application where a user can create, edit, delete objects. The changes they make are placed in a queue which is processed every 4 minutes. When it is processed, the updates are sent over an async web method call to be saved in a sql database, one at a time. When the first update finishes, the next starts.Im having a problem when a user makes a change and then exits the browser app before the 4 minute timer has expired.Currently the changes are getting lost.Ive built on what the guy working on this before me has done, and explored the Dispose and Finalize methods, trying to start the update process when the factory is being shut down, but that isnt working due to the async nature of the web service calls. I get errors saying needed objects have already been disposed of.

View 1 Replies

Return More Than A Single Value From A WebService?

Dec 23, 2009

I have to return a lot of values back to my windows application from my webService. But how would I return more than just a single string/int/boolean from my WebService to myApplication. How would I return a collection, keyValuePair, or even better, a DataSet? Or is this just imposible?

View 4 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

Parsing JSON Data Into List Of Objects?

Aug 17, 2011

I'm new at JSON and i am currently struggling with a problem parsing JSON data in a list of objects.The data that i am trying to parse is generated by the facebook graph api, and looks like this :

{
"100001621071794": {
"id": "100001621071794",
"name": "TEST1",[code].....

I know that this is not an array, because it is missing '[' and ']'. But when i replace the '{' and '}' with '[' and ']' i'm getting an error because of an invlaid matrix.

View 1 Replies

How To Return Base64Binary From A Webservice Request

Dec 7, 2010

How would I return a base64Binary type back from a VB.net web service request? I would like to return the base64Binary of a PDF document from the binary datatype from SQL Server 2008. Is base64Binary the same as Byte? Do I have to convert the Byte to Base64 then to String?

View 1 Replies

Javascript - Return JSON From ASP.NET .asmx?

Nov 5, 2009

I have the following test method:Imports System.Web

Imports System.Web.Services
Imports System.Web.Services.Protocols
<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<System.Web.Script.Services.ScriptService()> _

[Code]...

Even with the ResponseFormat attribute added the response is still being returned as XML rather than JSON.

View 6 Replies

Servers Return All The Responses In JSON

Feb 16, 2011

I've got a small utility I use to communicate with Yahoo's APIs. Their servers return all the responses in JSON. Is there an easy way to parse this into its base form when you don't necessarily know what will be in the response?

[Code]...

View 1 Replies

SQL Query Two Tables At Once And Loop Result As JSON Objects

Dec 16, 2011

I have a MySQL database with a table called "Locations" which looks a bit like this

id | name | other parameters
1 | shop1 | blah
2 | shop2 | blah

[Code]....

This works, but it is inefficient calling the database through the loop, how do I avoid this?

View 6 Replies

Webservice Donot Return Current Windows User Name?

Feb 5, 2011

This is the function that I use in web service for getting current windows user.

<WebMethod()> _
Function User() As String
Dim p() As String = Split(My.User.Name, "")

[code].....

View 7 Replies

Class Definition To Return Nested JSON Structure Without WCF?

Dec 10, 2011

I'm trying to return code like this (can be found here):

{"hotspots": [{
"id": "test_1",
"anchor": { "geolocation": { "lat": 52.3729, "lon": 4.93 } },

[code].....

View 2 Replies

Pass / Submit The Data To The WebService And Return Back The Results

Jul 9, 2011

Trying to find some code to assist with accessing a web service. I am a newbie when it comes to web services and don't quite get the whole how to submit the request and then read the results. I know from searches that people request a copy of the WSDL file so I have attached (SystemManagementService.wsdl)

[Code]...

View 4 Replies

WebService - Retrieving Multiple Values Into DataGrid?

Mar 7, 2009

Finally got to the point of having a work webservice using php and nusoap. I can retrieve values and send. Now what I want to do retrieve multiple values into a data grid, I think. What I want to do is retrieve various messages specific to that user. At the moment I retrieve values individually but as there may be more than one result I assume the datagrid may be the way forward. Now the question is how can I retrieve this information. Currently my data returns in the following format.
name.Text = returnData.name

View 4 Replies

C# - Return Value Of "count" Property In JSON Object

May 24, 2012

I have a json object from the facebook api

"comments": {
"count": 2
},
"updated_time": "2012-05-24T02:46:36+0000"

The entire json object is a dynamic object.

I can easily read the value of the updated_time with:

post.updated_time

However this returns the count of items in the collection, not the value of the "count" property in the json object.

post.comments.count

Is it possible to get the value of post.comments.count without it using the "count" keyword?

I should note that the JSON is much larger than this. If there are actually comments there is another collection of the actual comments so something like post.count(0) would not work in that case.

View 2 Replies

Select Multiple Objects Like Checking Multiple Checkboxes?

Nov 24, 2010

Is there a tool in the toolbox that i can use that replaces checkboxes. i have limited amount of space and checkboxes just keep taking up room. I need the user to select multiple objects like checking multiple checkboxes.

View 5 Replies

VS 2008 Return Multiple Table Rows To Multiple Text Boxes

Feb 27, 2011

visual basic 2008 express
access 2007 db

I am attempting to fill a form with multiple rows from an access table based off of a parameterized query. My query works fine but I don't want to return one row at a time, I want to return all rows that match my query in multiple text boxes. I know that I can use a datagrid view to accomplish this, but I would prefer the look of a textboxes on a form. I have read through many books and searched the internet forums but think I may just not know what to search for as nothing has worked yet. Can anyone point me in the right direction. So far I have tried setting the text box value to the row().item(), creating a different dataset for each row, and even setting variables for the results of the query to then be passed to the text boxes. Since none of this work, I don't really have any starting code to post. If I could just get a starting point I could work from there, so don't feel the need to code anything for me, just set me in the right direction.

View 3 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

How To Read Two XML Files And Return List (of Objects)

Jun 20, 2011

I have two xml files. I have to read them and return as a List( Of object). Here is my function.
Public Function GetData(ByVal name As String, ByVal city As String) As List(Of Object)
'Return Nothing
End Function

View 1 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

LINQ Objects - Group All The MyObjects Together That Share The Same Value And Then Return That Value?

Nov 16, 2010

I am having trouble following some of the examples at MSDN for LINQ.Basically I have a List Of MyObject. MyObject has a property called Value which is an integer.I want to group all the MyObjects together that share the same Value and then return that Value where the count of the group is greater than 5.I have tried the following,

dim foak = From o as MyObject in MyObjectList _
Group o By o.Value into Count _
WHERE Count > 5 _
Select o.Value

View 2 Replies

Convert JSON String To JSON Object?

Jan 18, 2012

I have a JSON response from a web service that I need to be converted to an object then to an array. My response is similar to the one below:

{"status":{"error":"NO","code":"200","description":"none","message":"Request ok"},"geolocation":{"lat":"38.89515","lng":"-77.0310"},"stations":[{"country":"United States","regPrice":"0.00","midPrice":"0.00","prePrice":"0.00","streetAddress":"1401, I St[code]....

I am doing this is VB.NET within a console for now. Basically I am trying to create a simple way to test my API calls and output the information. What I am trying to accomplish is having to loop through the JSON array and list the stations.

View 3 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

Using JSON.NET To Parse JSON Generated Through PHP?

Mar 2, 2010

I'm sure this has been asked before but I'm not finding quite the information I'm needing so I thought I'd post this.

I've written a PHP script that returns a simple JSON object that looks like this:

{"status":"success","level":"admin"}

I'm doing a standard web request that submits the required data to the script over the internet and that's working fine.

Now, I want to use JSON.NET to pull out the individual variables so I can know what the values of "status" and "level" are. The problem is, I have no idea where to start.

I'm doing this in VB.NET (on the .NET Compact Framework).

View 1 Replies

Get Information From Multiple Objects?

Nov 3, 2009

I want to know how to get information/text form other objects to a textbox.

View 10 Replies







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