Consuming An Array From A Webservice?

Mar 18, 2010

I am trying to consume an array of strings from a webservice that I wrote. I keep getting the error: "System.NullReferenceException: Object reference not set to an instance of an object."

I know I am doing some thing wrong at an extremely basic level, but it's not coming to me.

I have tried adding New but get the error that you can't declare arrays with New

Here is the dummed down webservice method:<WebMethod( _
Description:="Testing ")> _
Public Function TestArray(ByVal Address1 As String, ByVal zip As String) As String()
Dim strTest(4) As String
strTest(0) = "It's"
strTest(1) = "a"
strTest(2) = "great"
strTest(3) = "day"
Return strTest
End Function
<--Here is the call that generates the null reference error-->

Private Sub FindAddress()
Dim svc As ws.Service
Dim strAddresses() As String
strAddresses = svc.TestArray(txtAddress.Text, txtZip.Text)
End Sub

View 3 Replies


Similar Messages:

Exception In Consuming Webservice?

Sep 6, 2010

I'm developing a .NET application using .NET 3.5 .My application is using a JAVA

WebService (wsdl url)

When I run the application I want to consume the web service (wsdl file) written in XML. i either keep getting the Operation Time out Error or the following exception while debugging

Possible SOAP version mismatch: Envelope namespace

http://schemas.xmlsoap.org/wsdl/ was unexpected.

View 2 Replies

WCF / ASMX :: Consuming Freight Price Calculation Webservice?

Jul 13, 2010

how to consume a webservice from Brazilian Correios (kind of USA Fedex).

The Web Service address is [URL]

The instructions says that I need to use the method CalcPrecoPrazo and send those parameters listed below (I already filled the variables with the correct content to help you use that webservice).

Dim nCdEmpresa As String = ""
Dim sDsSenha As String = ""
Dim nCdServico As String = "41106"
Dim sCepOrigem As String = "87047130"
Dim sCepDestino As String = "80610320"
Dim nVIPeso As Decimal = 1
Dim nCDFormato As Integer = 1
Dim nVIComprimento As Decimal = 20
Dim nVIAltura As Decimal = 30
Dim nVILargura As Decimal = 30
Dim nVIDiametro As Decimal = 0
Dim sCdMaoPropria As String = "N"
Dim nVIValorDeclarado As Decimal = 0
Dim sCdAvisoRecebimento As String = "N"

The result will be send by the parameter RESULTADO.SERVICOS in a array format.

View 3 Replies

WCF / ASMX :: While Consuming Webservice Getting Error As "The Request Failed With HTTP Status 401: Unauthorized"

Jun 18, 2010

I am trying to consume a webservice. I added the web reference. But when i try to access the method, I am getting the error as:"The request failed with HTTP status 401: Unauthorized."The web service has username as "user1", password as "pass".I tried this:

Service1.TestPrcsService serv = new Service1.TestPrcsService();
serv.PreAuthenticate = true;
serv.Custom_methodname(true);

How to pass the username and password to access the method?

View 2 Replies

C# - Cannot Send Array Of ArrayList To WebService As Parameter

Mar 28, 2011

I have a array of ArrayList as shown below:ArrayList[] m;My web service method takes this type as parameter.How can I send it to web service?When I do so the Web Service changes my array of ArrayList to Object[][]!

View 1 Replies

WCF / ASMX :: Sending Array Of ArrayList Via WebService?

Mar 28, 2011

I have a webservice which has a Array of Arraylist argument as like as below code:

[code]....

Now I wanna know how can I send Arraylist Array to webservice, because when I want to call this function it wants object[][] data type.

View 1 Replies

C# - Trying To Create A WebService To Return A 3D Array To Populate Table With JavaScript?

Feb 4, 2010

I am trying to create a dynamic table that is being built based on the value of a search text box. The Table will have probably 6 columns of 20(max) rows.

My problem is I can't figure out how to return the data from the web-service to the JS function in a way that will allow me to extract the data that I need.

Here is the web-service method I have currently:

[code]....

View 1 Replies

Add Values To Array and Replace Preexisting Array Items With New Values without The Array Changing Size?

Aug 19, 2010

I need to know what would be the best choice of array to use given the following specifications. This array's size will be predermined upon the loading of the appication. All I want to do is be able to add values to this array and replace preexisting array items with new values without the array changing size. Someone suggested that I use a Dictionary Array Object? I would appreciate any suggestions.

View 3 Replies

Web Forms :: Getting An Array Of List From Database To Client Side(javascript Array)?

May 12, 2010

Iam getting an array of list from database to client side(javascript array). Now my aim to place those values in a div one by one and that div should attach to the textbox similar to Autocomplete extender.

View 4 Replies

Pass C# Array To Javascript Array?

Aug 12, 2010

how to pass a C# ASP.NET array to a Javascript array? Sample code will also be nice.

Let's say for simplicity that in my aspx.cs file I declare:

int [] numbers = new int[5];

now I want to pass "numbers" to the client side and use the data in the array within javascript. How would I do this?

View 4 Replies

Consuming A Web Service?

May 23, 2010

I have put a simple service on my site which requires the input of a string and it will return an array as its output.The service works fine on my PC; however, I have published the site online and the web services don't work?

View 9 Replies

Consuming RSS Feeds In ASP And C#?

Aug 2, 2010

I'm working on making a modification to a site built with ASP/C#, and one of the tasks was to add in the display of 2 RSS feeds - one from the site's internal blog, and the other from the site's Twitter account. However, I seem to continually get empty feeds from both, even though I've confirmed that I'm pointing to the correct URL of the feeds. My code is shown below.

private void GetTwitterRSS()
{
IEnumerable items = Cache["TwitterFeed"] as List<SyndicationItem>;

[code]...

View 1 Replies

Consuming WCF In Web Application?

Apr 14, 2010

My application is in asp.net 2.0. Is it possible to consume WCF service developed in asp.net 3.5? If possible, how can we consume wcf service in asp.net 2.0?

View 1 Replies

WCF / ASMX :: Consuming Web Service W/ WSE 2 -or- 3?

Jun 14, 2010

I'm taking over a project for a former co-worker. We're consuming a web service which requires authentication. The former co-worker was unable to call the service using WCF. I'm mostly unfamiliar with web services but was also unable to get it to authenticate.Upon speaking w/ the original developer, I was told that I'd have to build a project in VS 2005 in order to consume the service and that WSE 3 would have to be used, instead of WCF. He has some code that did indeed build and run on his PC, while he was here. I'm now unable to get it to build.

I'm running VS 2005 on XP and have WSE 3.0 installed and enabled on the project, which is a C# class library. I successfully made a Web Reference to the service and generated a proxy. In trying to test it, the first few lines of my code look like this:

[Code]....

...problem is, it says that the proxy that was generated does not have RequestSoapContext!

View 4 Replies

WCF / ASMX :: Consuming An XML Web Service?

Feb 23, 2011

I am trying to create a wrapper class for the MusicBrainz CD database using VB.NET. I have a test URL that produces an XML response:[URL]I need to get that response into an XMLDocument object in .NET. I have tried XMLDocument.Load, WebClient.DownloadString, and HttpWebRequest through a StreamReader. All produce: Unable to Connect To Remote Server. It is possible that my company firewall is the problem but I can access the URL just fine in a web browser.

View 2 Replies

WCF / ASMX :: Consuming A Php Web Service In .net?

Oct 4, 2010

Here's a simple question that Google isn't providing any good leads on:How I do consume this in VS 2008 or 2010?[URL]I have no control over it, I just have to consume it and use it. Adding it as a web reference in the project yields this error:[URL]was not recognized as a known document type.The error message from each known type may help you fix the problem:- Report from 'XML Schema' is 'The root element of a W3C XML Schema should be <schema> and its namespac"

View 6 Replies

C# - Consuming A Rest XML Web Service?

Jan 14, 2011

I'm trying to consume the following web service http://ipinfodb.com/ip_location_api.php
this web service returns an xml response, the code below gets the XML response, but somehow when phasing the values from the XML response it does not work.

What is wrong with my code?

using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.IO;
using System.Net;
using System.Xml;

namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
HttpWebRequest request = null;
HttpWebResponse response = null;
String Xml;
// Create the web request
request = WebRequest.Create("http://api.ipinfodb.com/v2/ip_query.php?key=<yourkey>&ip=74.125.45.100&timezone=true") as HttpWebRequest;
// Get response
using (response = request.GetResponse() as HttpWebResponse)
{
// Get the response stream
StreamReader reader = new StreamReader(response.GetResponseStream());
Xml = reader.ReadToEnd();
}
// Console xml output
Console.WriteLine(Xml); //see if we get the xml response, (YES we do)
Console.ReadLine();
string _currentField = "";
StringReader _sr = new StringReader(Xml);
XmlTextReader _xtr = new XmlTextReader(_sr);
_xtr.XmlResolver = null;
_xtr.WhitespaceHandling = WhitespaceHandling.None;
// get the root node
_xtr.Read();
if ((_xtr.NodeType == XmlNodeType.Element) && (_xtr.Name == "Response"))
{
while (_xtr.Read())
{
if ((_xtr.NodeType == XmlNodeType.Element) && (!_xtr.IsEmptyElement))
{
_currentField = _xtr.Name;
_xtr.Read();
if (_xtr.NodeType == XmlNodeType.Text)
{
switch (_currentField)
{
case "Status":
Console.WriteLine(_xtr.Value); //we print to console for testing purposes, normally assign it to a variable here!
break;
case "CountryCode":
Console.WriteLine(_xtr.Value);
break;
case "CountryName":
Console.WriteLine(_xtr.Value);
break;
case "RegionCode":
Console.WriteLine(_xtr.Value);
break;
case "RegionName":
Console.WriteLine(_xtr.Value);
break;
case "City":
Console.WriteLine(_xtr.Value);
break;
case "ZipPostalCode":
Console.WriteLine(_xtr.Value);
break;
case "Latitude":
Console.WriteLine(_xtr.Value);
break;
case "Longitude":
Console.WriteLine(_xtr.Value);
break;
case "Gmtoffset":
Console.WriteLine(_xtr.Value);
break;
case "Dstoffset":
Console.WriteLine(_xtr.Value);
break;
case "TimezoneName":
Console.WriteLine(_xtr.Value);
break;
case "Isdst":
Console.WriteLine(_xtr.Value);
break;
case "Ip":
Console.WriteLine(_xtr.Value);
break;
default:
// unknown field
throw new Exception("Unknown field in response.");
}
}
}
}
}
Console.ReadLine();
}
}
}
EDIT: this is the XML response returned
<?xml version="1.0" encoding="UTF-8" ?>
- <Response>
<Status>OK</Status>
<CountryCode>US</CountryCode>
<CountryName>United States</CountryName>
<RegionCode>06</RegionCode>
<RegionName>California</RegionName>
<City>Mountain View</City>
<ZipPostalCode>94043</ZipPostalCode>
<Latitude>37.4192</Latitude>
<Longitude>-122.057</Longitude>
<Gmtoffset>-28800</Gmtoffset>
<Dstoffset>0</Dstoffset>
<TimezoneName>America/Los_Angeles</TimezoneName>
<Isdst>0</Isdst>
<Ip>74.125.45.100</Ip>
</Response>

View 4 Replies

WCF / ASMX :: Consuming A PHP Service?

Aug 24, 2010

I'm working with an outside company to impletement their API into our program. Most of their member functions working pretty solid. I get to the one function where I have to pass an associated array to it and this is where it blows up. I create a hash table or namevaluecollection and of course I will get the error(The type System.Collections.Hashtable is not supported because it implements IDictionary.), which can't be serialized.


Is there an easy way to pass this associated array to them? I don't think their api is very flexible, but they seem to think so.

View 1 Replies

WCF / ASMX :: Consuming .net Webservices In Php?

Apr 5, 2010

I want to know can php client consume asp.net web services with

1: returning basic types int, string etc.

2: returning DataSets

View 5 Replies

Consuming A WSE-enabled Web Service In A 2.0 Web Site?

Jan 25, 2011

I'm trying to consume a WSE enabled Web Service from an ASP.NET Web Site.I've installed WSE 3.0, used the config tool to add WSE info to my web.config and then done an Add Web Reference.I believe that the problem may be that this is a Web SITE, not a Web APPLICATION. As such, the proxy class is generated at runtime, perhaps not adding the WSE magic.I can access the proxy class from metadata, and it's of typeSystem.Web.Services.Protocols.SoapHttpClientProtocol, which as far as I can tell doesn't have any WSE functionality.I realize that this is all old technology, but I don't get to decide what the servers run :(

View 1 Replies

WCF / ASMX :: Consuming Web Service Without Wsdl?

Nov 9, 2010

I need to access a web service. The WSDL is not available, even if I know everything about the service (url, method name and signature). I guess I could use HTTPRequest and HTTPResponse classes:HTTPResponse: should contains the XML Soap Response that I eventually parse.HTTPRequest: how to specify the service's and the method's parameters?

View 2 Replies

Consuming .NET Web Services With Complex Types In PHP

Mar 12, 2011

Can i consume .NET web service and use it complex types in PHP?
Example:

[WebMethod]
public DataSet GetData()
{
return new DataSet();
}

Can i consume this method and use DataSet class methods in PHP?

View 1 Replies

Web Forms :: Bandwidth Consuming JS Files?

Jul 26, 2010

What are WebResource.axd and ScriptResource.axd ? Because more than 40% of my bandwidth use by those script loading and it take a long time to load the web site.

View 9 Replies

Creating / Consuming Web Service For HTML?

Mar 2, 2011

i have a requirement to build some sort of services that can easily be called to a 3dr party API.

the call can be done through simple
1) HTML page
2) ASPX page
3) MOBILE device

should i create a separate web service project separately and create few methods [WebMethod] ?

also the method can be static?

/// <summary>
/// Summary description for signup_service
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]

[Code]....

View 1 Replies

WCF / ASMX :: Consuming Webservices With Https?

Aug 26, 2010

I wrote some webservices in my solution and it works fine when i consume it in my local machine... BUT when i deploy it in the public IP and using https. I'm not able to consume the webservices i got a "The provided URI scheme 'https' is invalid; expected 'http'. Parameter name: via" Error...

I tried to change my configuration in my web app from security mode="None" into security mode = "transport" and I got an error... (forgot to log the error)

Note* I'm using virtual IIS (this is where i test my project)

View 2 Replies







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