473,769 Members | 1,637 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Passing interface as parameter in web service???

hi all

is there a way to pass an interface as input parameter for a web method?
since interface is not serializable, does that mean it's impossible to do
that?

Kevin

Nov 23 '05 #1
6 5535
Kevin Yu wrote:
hi all

is there a way to pass an interface as input parameter for a web method?
since interface is not serializable, does that mean it's impossible to do
that?

Kevin


In the sense that WSDL defines an interface, and that a web method can
be designed to use that interface on the fly ( I know because I've built
such a thing )...yes.
Nov 23 '05 #2
Kevin Yu wrote:
hi all

is there a way to pass an interface as input parameter for a web method?
since interface is not serializable, does that mean it's impossible to do
that?

Kevin


In the sense that WSDL defines an interface, and that a web method can
be designed to use that interface on the fly ( I know because I've built
such a thing )...yes.
Nov 23 '05 #3
How?

please show some code sample.

Kevin

<ja*****@texeme .com> wrote in message
news:F9******** ************@sp eakeasy.net...
Kevin Yu wrote:
hi all

is there a way to pass an interface as input parameter for a web method?
since interface is not serializable, does that mean it's impossible to do that?

Kevin


In the sense that WSDL defines an interface, and that a web method can
be designed to use that interface on the fly ( I know because I've built
such a thing )...yes.

Nov 23 '05 #4
How?

please show some code sample.

Kevin

<ja*****@texeme .com> wrote in message
news:F9******** ************@sp eakeasy.net...
Kevin Yu wrote:
hi all

is there a way to pass an interface as input parameter for a web method?
since interface is not serializable, does that mean it's impossible to do that?

Kevin


In the sense that WSDL defines an interface, and that a web method can
be designed to use that interface on the fly ( I know because I've built
such a thing )...yes.

Nov 23 '05 #5
Kevin Yu wrote:
How?

please show some code sample.
This code will generate the web services interface from a WSDL
dynamically. This code requires the ThinkTecture 1.5 libraries (
available free at thinktecture.co m ).
public static void WInvoke(
string WDSL,
string TypeName,
string Method,
ArrayList MethodParameter s

)
{
string result = string.Empty;
DynamicWebServi ceProxy ws = new DynamicWebServi ceProxy();
ws.Wsdl = WDSL;
//"http://localhost/EHLO/Service1.asmx?W SDL";
ws.TypeName = TypeName;
ws.MethodName = Method;

Type[] types = ws.ProxyAssembl y.GetTypes();
int mko = 0;

MethodInfo[] mi = types[0].GetMethods(Bin dingFlags.Publi c |
BindingFlags.In stance |
BindingFlags.De claredOnly);

ParameterInfo[] pt = null;

foreach ( MethodInfo m in mi)
if(m.Name.Equal s(Method))
pt = m.GetParameters ();

foreach(object o in MethodParameter s){
object mo;

if (!pt[mko++].ParameterType. ToString().Equa ls("System.Int3 2"))
mo = ((methodParams) o).paramvalue.T oString();
else
mo = Convert.ToInt32 (((methodParams )o).paramvalue. ToString());

//Debug.WriteLine (types[tko++].ToString());
ws.AddParameter (mo);
}

// get all types of the dynamic assembly
//Type[] types = ws.ProxyAssembl y.GetTypes();
// get a certain type by name - watch out for fully qualified name
//Type t = ws.ProxyAssembl y.GetType(ns + "Order");
//...

//Then create an instance of the type by using reflection.

//object result = Activator.Creat eInstance(t);

try
{

ws.InvokeCall() ;

}
catch ( Exception e)
{
Debug.WriteLine (e.ToString());
}
finally
{
//Debug.WriteLine (result);
}
}

public static void WInvoke(
string WDSL,
string TypeName,
string Method,
ArrayList MethodParameter s

)
{
string result = string.Empty;
DynamicWebServi ceProxy ws = new DynamicWebServi ceProxy();
ws.Wsdl = WDSL;
//"http://localhost/EHLO/Service1.asmx?W SDL";
ws.TypeName = TypeName;
ws.MethodName = Method;

Type[] types = ws.ProxyAssembl y.GetTypes();
int mko = 0;

MethodInfo[] mi = types[0].GetMethods(Bin dingFlags.Publi c |
BindingFlags.In stance |
BindingFlags.De claredOnly);

ParameterInfo[] pt = null;

foreach ( MethodInfo m in mi)
if(m.Name.Equal s(Method))
pt = m.GetParameters ();

foreach(object o in MethodParameter s){
object mo;

if (!pt[mko++].ParameterType. ToString().Equa ls("System.Int3 2"))
mo = ((methodParams) o).paramvalue.T oString();
else
mo = Convert.ToInt32 (((methodParams )o).paramvalue. ToString());

//Debug.WriteLine (types[tko++].ToString());
ws.AddParameter (mo);
}

// get all types of the dynamic assembly
//Type[] types = ws.ProxyAssembl y.GetTypes();
// get a certain type by name - watch out for fully qualified name
//Type t = ws.ProxyAssembl y.GetType(ns + "Order");
//...

//Then create an instance of the type by using reflection.

//object result = Activator.Creat eInstance(t);

try
{

ws.InvokeCall() ;

}
catch ( Exception e)
{
Debug.WriteLine (e.ToString());
}
finally
{
//Debug.WriteLine (result);
}
}


Kevin

<ja*****@texeme .com> wrote in message
news:F9******** ************@sp eakeasy.net...
Kevin Yu wrote:
hi all

is there a way to pass an interface as input parameter for a web method?
since interface is not serializable, does that mean it's impossible to
do
that?

Kevin


In the sense that WSDL defines an interface, and that a web method can
be designed to use that interface on the fly ( I know because I've built
such a thing )...yes.


Nov 23 '05 #6
Kevin Yu wrote:
How?

please show some code sample.
This code will generate the web services interface from a WSDL
dynamically. This code requires the ThinkTecture 1.5 libraries (
available free at thinktecture.co m ).
public static void WInvoke(
string WDSL,
string TypeName,
string Method,
ArrayList MethodParameter s

)
{
string result = string.Empty;
DynamicWebServi ceProxy ws = new DynamicWebServi ceProxy();
ws.Wsdl = WDSL;
//"http://localhost/EHLO/Service1.asmx?W SDL";
ws.TypeName = TypeName;
ws.MethodName = Method;

Type[] types = ws.ProxyAssembl y.GetTypes();
int mko = 0;

MethodInfo[] mi = types[0].GetMethods(Bin dingFlags.Publi c |
BindingFlags.In stance |
BindingFlags.De claredOnly);

ParameterInfo[] pt = null;

foreach ( MethodInfo m in mi)
if(m.Name.Equal s(Method))
pt = m.GetParameters ();

foreach(object o in MethodParameter s){
object mo;

if (!pt[mko++].ParameterType. ToString().Equa ls("System.Int3 2"))
mo = ((methodParams) o).paramvalue.T oString();
else
mo = Convert.ToInt32 (((methodParams )o).paramvalue. ToString());

//Debug.WriteLine (types[tko++].ToString());
ws.AddParameter (mo);
}

// get all types of the dynamic assembly
//Type[] types = ws.ProxyAssembl y.GetTypes();
// get a certain type by name - watch out for fully qualified name
//Type t = ws.ProxyAssembl y.GetType(ns + "Order");
//...

//Then create an instance of the type by using reflection.

//object result = Activator.Creat eInstance(t);

try
{

ws.InvokeCall() ;

}
catch ( Exception e)
{
Debug.WriteLine (e.ToString());
}
finally
{
//Debug.WriteLine (result);
}
}

public static void WInvoke(
string WDSL,
string TypeName,
string Method,
ArrayList MethodParameter s

)
{
string result = string.Empty;
DynamicWebServi ceProxy ws = new DynamicWebServi ceProxy();
ws.Wsdl = WDSL;
//"http://localhost/EHLO/Service1.asmx?W SDL";
ws.TypeName = TypeName;
ws.MethodName = Method;

Type[] types = ws.ProxyAssembl y.GetTypes();
int mko = 0;

MethodInfo[] mi = types[0].GetMethods(Bin dingFlags.Publi c |
BindingFlags.In stance |
BindingFlags.De claredOnly);

ParameterInfo[] pt = null;

foreach ( MethodInfo m in mi)
if(m.Name.Equal s(Method))
pt = m.GetParameters ();

foreach(object o in MethodParameter s){
object mo;

if (!pt[mko++].ParameterType. ToString().Equa ls("System.Int3 2"))
mo = ((methodParams) o).paramvalue.T oString();
else
mo = Convert.ToInt32 (((methodParams )o).paramvalue. ToString());

//Debug.WriteLine (types[tko++].ToString());
ws.AddParameter (mo);
}

// get all types of the dynamic assembly
//Type[] types = ws.ProxyAssembl y.GetTypes();
// get a certain type by name - watch out for fully qualified name
//Type t = ws.ProxyAssembl y.GetType(ns + "Order");
//...

//Then create an instance of the type by using reflection.

//object result = Activator.Creat eInstance(t);

try
{

ws.InvokeCall() ;

}
catch ( Exception e)
{
Debug.WriteLine (e.ToString());
}
finally
{
//Debug.WriteLine (result);
}
}


Kevin

<ja*****@texeme .com> wrote in message
news:F9******** ************@sp eakeasy.net...
Kevin Yu wrote:
hi all

is there a way to pass an interface as input parameter for a web method?
since interface is not serializable, does that mean it's impossible to
do
that?

Kevin


In the sense that WSDL defines an interface, and that a web method can
be designed to use that interface on the fly ( I know because I've built
such a thing )...yes.


Nov 23 '05 #7

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

Similar topics

6
16281
by: wiredless | last post by:
What is the advantage of passing an interface type? according to UML (visio) when i reverse engineer existing code to a UML diagram I get the error "UMLE00046: sample : - An interface cannot be used as the type of a parameter." for this code:
8
2118
by: Dennis Myrén | last post by:
I have these tiny classes, implementing an interface through which their method Render ( CosWriter writer ) ; is called. Given a specific context, there are potentially a lot of such objects, each requiring a call to that method to fulfill their purpose. There could be 200, there could be more than 1000. That is a lot of references passed around. It feels heavy. Let us say i changed the signature of the interface method to:
0
310
by: Kevin Yu | last post by:
hi all is there a way to pass an interface as input parameter for a web method? since interface is not serializable, does that mean it's impossible to do that? Kevin
12
3026
by: scottt | last post by:
hi, I am having a little problem passing in reference of my calling class (in my ..exe)into a DLL. Both programs are C# and what I am trying to do is pass a reference to my one class into a DLL function. When I try and compile the DLL I get "The type or namespace name "MyForm" could not be found. I think I have to reference the class but since the DLL needs to be built before the EXE it looks like I have a chicken and egg type problem....
9
3803
by: Greger | last post by:
Hi, I am building an architecture that passes my custom objects to and from webservices. (Our internal architecture requires me to use webservices to any suggestion to use other remoting techniques are not feasible) The question is; Given that I have a Person object with a private set for id. What is the recommended approac in passing that object to the web service
10
3933
by: amazon | last post by:
Our vender provided us a web service: 1xyztest.xsd file... ------------------------------------ postEvent PostEventRequest ------------------------------------- authetication authentication eventname string source string ID string
0
1255
by: amazon | last post by:
I have web service that acceping following parameters.. postev.PostEvent(authentication as ws.authentication, name as string,id as string, exdate as date, parameter() as ws.nameparametervaluepair (I need help in passing this)) Postev.postEvent(auth(), "Test", "1234567", tdt, parameter()) For the first parameter authentication I have: Private Function auth() As ws.Authentication
10
13054
by: Janus | last post by:
Hi, Is there a way to pass arguments to the callback function used inside an addEventListener? I see that I can only list the name of the callback function. For eg, I use this: var boldLink=document.getElementById('cmtbold');
3
5048
by: cmrhema | last post by:
Hi, Kindly excuse if I am posting in the wrong place. I am using Visual Studio 2008, .net framework 3.5, asp.net , c# and sql server 2005. I am supposed to pass stored procedures from client to wcf service. The WCF service should execute the stored procedure and return the result.
0
9589
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...
1
9994
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9863
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
7408
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
6673
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
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3958
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
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.