473,396 Members | 2,036 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

I'm going crazy with web services - PLEASE HELP!!

I've been days with that. I'm trying to work with web services sending and
returning objects, and the web service must store some objects.
- My first try (the most obvious in my opinion) was to use a class contained
in a extern dll so the web service and the application can use it and send
or return via web services: public customObject myWebMethod(customObject
obj); . I saw that web services can't deal with this cause the WS creates
another class with the same name, but it's not possible to cast from one to
another.

- Now I try to pass simple fields (strings for instance) and create the
objects in the web service and in the application. In the web service I have
a Hashtable where I want the objects to be stored. Is it possible? because I
get exceptions and I don't know why. The exception text is (it's translated
as my VS isn't in english):
------------------
'System.Web.Services.Protocols.SoapException' occurred in
system.web.services.dll

Additional information: System.Web.Services.Protocols.SoapException: The
server didn't recognize the value in the header HTTP SOAPAction:
http://tempuri.org/setUser.
at
System.Web.Services.Protocols.Soap11ServerProtocol Helper.RouteRequest()
at System.Web.Services.Protocols.SoapServerProtocol.I nitialize()
at System.Web.Services.Protocols.ServerProtocolFactor y.Create(Type type,
HttpContext context, HttpRequest request, HttpResponse response, Boolean&
abortProcessing)
---------------------

I have a basic test that doesn't work, but I put you here the code so you
can see if it's something wrong.

-------- The DLL has this simple class:

public class User
{
private string name;
private string phone;

public string Name
{
set { name = Name;}
get { return name;}
}
// the same with Phone

public User() {}
public User(string n, string p)
{
name = n;
phone = p;
}
}

---------- The Web Service has this:

public class Service1:System.Web.Services.WebService
{
private System.Collections.Hashtable users; //here I want to store
the objects

public Service1()
{
InitializaComponent();
users = new Hashtable();
}

// then the region generated by VS
// and here the web mehtods

[WebMethod]
public void setUser(string n, string p)
{
User u = new User(n,p);
users.Add(n,u); //add the new user to the HastTable with the name
as key
}

[WebMethod]
public string getPhone(string name)
{
User u = (User)users[name]; //get the object with the key
'name'
return u.Phone;
}

}

--------- And finally the application, that is a simple form that has a
couple of textboxes to insert name and phone, a listbox to show the results
and a couple of buttons to call the web methods. I put the important code

public class Form1: System.Windows.Forms.Form
{
// the visual components
private webServ.Service1 serv; //the web service
private User user; //a custom object from my class.
[...]

public Form1()
{
InitializeComponent();
serv = new webServ.Service1(); // call the web service
constructor
}
[...]

private void button1_Click(...)
{
// call the webmethod sendint the fields so the object is created in
the web service
serv.setUser(textBox1.Text, textBox2.Text);
}

private void button2_Click(...)
{
// call the second webmethod to get the Phone associated to the name
showed in the textBox
string phone = serv.getPhone(this.textBox1.Text);
User u = new User(textBox1.Text, phone); //create an object

//finally show the data in the listbox[...]
}
}

When the application crashes, it shows in the Reference.cs that:

public void setUser(string name, string phone){
this.Invoke("setUser", new object[] { name, phone});

-------------------------------
Please, I really need your help!

Regards,

Diego F.

Nov 16 '05 #1
0 2123

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Richard | last post by:
I need help. I have a smarty based program that I am modifying. I have a smarty template file that consists of smarty and HTML. I need to integrate some PHP database calls into it. My problem...
5
by: spoilsport | last post by:
Ive got to write a multi-function program and I'm plugging in the functions but I keep getting this error from line 40. Im new to this and cant find an answer anywhere. Sam #include...
0
by: Diego F. | last post by:
I've been days with that. I'm trying to work with web services sending and returning objects, and the web service must store some objects. - My first try (the most obvious in my opinion) was to use...
3
by: Navin | last post by:
Hello friends... On a single asp.net web page i have a single server-side form that contains a couple of user-controls. Each user control has its own functionality and contains server-side textbox...
3
by: Larry Tate | last post by:
I have had a monstrous time getting any good debugging info out of the .net platform. Using ... ..NET Framework 1.1 Windows 2K Server VB.NET <- is this the problem? error handling in the...
7
by: Miguel Dias Moura | last post by:
Hello, In an ASP.Net / VB web page I want to display an image which filename depends of a parameter on the URL. I have this:
11
by: shapper | last post by:
Hello, I am creating a centered web site with various div's inside the main (pBase) div. Somehow, I am getting a gap on the top of my browser window both in IE and Firefox. I tried...
2
by: BLUE | last post by:
FirstClass members: - static int counter; - SingletonClass sc = SingletonClass.Instance; Moreovere FirstClass uses a static class named SecondClass with a static property...
1
by: shapper | last post by:
Hello, On my CMS I am signed as administrator and I am creating a Membership user and its profile: MembershipCreateStatus status; MembershipUser user = Membership.CreateUser("Joe", "Pass",...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.