473,770 Members | 1,644 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(cus tomObject
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.Ser vices.Protocols .SoapException' occurred in
system.web.serv ices.dll

Additional information: System.Web.Serv ices.Protocols. SoapException: The
server didn't recognize the value in the header HTTP SOAPAction:
http://tempuri.org/setUser.
at
System.Web.Serv ices.Protocols. Soap11ServerPro tocolHelper.Rou teRequest()
at System.Web.Serv ices.Protocols. SoapServerProto col.Initialize( )
at System.Web.Serv ices.Protocols. ServerProtocolF actory.Create(T ype 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.W ebService
{
private System.Collecti ons.Hashtable users; //here I want to store
the objects

public Service1()
{
InitializaCompo nent();
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.Service 1 serv; //the web service
private User user; //a custom object from my class.
[...]

public Form1()
{
InitializeCompo nent();
serv = new webServ.Service 1(); // 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(te xtBox1.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(t his.textBox1.Te xt);
User u = new User(textBox1.T ext, 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("se tUser", new object[] { name, phone});

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

Regards,

Diego F.

Nov 16 '05 #1
0 2166

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

Similar topics

1
2314
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 is I cannot figure out how to pass value between smarty and PHP. Going from php to smarty I've tried this: {php} $smarty = new Smarty; $smarty->assign("x", 100);
5
4552
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 <stdio.h> int main (void)
0
250
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 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...
3
5265
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 controls, requiredfieldvalidator controls which validate the textboxes, and a linkbutton control that postbacks the web page. The problem is, when the user clicks on the linkbutton control on one user control, the requiredfieldvalidator gets...
3
1477
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 global.asax file. I am seeing articles that say line numbers are in the ..
7
1758
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
2454
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 everything I could think of. Here is my entire HTML code:
2
1636
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 SecondClass.Description. In a normal windows application: - if in the Main method I create 2 or more instances of FirstClass, they all
1
2673
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", "Joe@email.com", null, null, true, null, out status); if (user != null) { ProfileHelper profile =
0
9595
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9432
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10059
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9873
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7420
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6682
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5313
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3974
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3578
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.