473,405 Members | 2,261 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,405 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 2124

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
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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.