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 6 5510
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.
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.
How?
please show some code sample.
Kevin
<ja*****@texeme.com> wrote in message
news:F9********************@speakeasy.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.
How?
please show some code sample.
Kevin
<ja*****@texeme.com> wrote in message
news:F9********************@speakeasy.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.
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.com ).
public static void WInvoke(
string WDSL,
string TypeName,
string Method,
ArrayList MethodParameters
)
{
string result = string.Empty;
DynamicWebServiceProxy ws = new DynamicWebServiceProxy();
ws.Wsdl = WDSL;
//"http://localhost/EHLO/Service1.asmx?WSDL";
ws.TypeName = TypeName;
ws.MethodName = Method;
Type[] types = ws.ProxyAssembly.GetTypes();
int mko = 0;
MethodInfo[] mi = types[0].GetMethods(BindingFlags.Public |
BindingFlags.Instance |
BindingFlags.DeclaredOnly);
ParameterInfo[] pt = null;
foreach ( MethodInfo m in mi)
if(m.Name.Equals(Method))
pt = m.GetParameters();
foreach(object o in MethodParameters){
object mo;
if (!pt[mko++].ParameterType.ToString().Equals("System.Int32"))
mo = ((methodParams)o).paramvalue.ToString();
else
mo = Convert.ToInt32(((methodParams)o).paramvalue.ToStr ing());
//Debug.WriteLine(types[tko++].ToString());
ws.AddParameter(mo);
}
// get all types of the dynamic assembly
//Type[] types = ws.ProxyAssembly.GetTypes();
// get a certain type by name - watch out for fully qualified name
//Type t = ws.ProxyAssembly.GetType(ns + "Order");
//...
//Then create an instance of the type by using reflection.
//object result = Activator.CreateInstance(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 MethodParameters
)
{
string result = string.Empty;
DynamicWebServiceProxy ws = new DynamicWebServiceProxy();
ws.Wsdl = WDSL;
//"http://localhost/EHLO/Service1.asmx?WSDL";
ws.TypeName = TypeName;
ws.MethodName = Method;
Type[] types = ws.ProxyAssembly.GetTypes();
int mko = 0;
MethodInfo[] mi = types[0].GetMethods(BindingFlags.Public |
BindingFlags.Instance |
BindingFlags.DeclaredOnly);
ParameterInfo[] pt = null;
foreach ( MethodInfo m in mi)
if(m.Name.Equals(Method))
pt = m.GetParameters();
foreach(object o in MethodParameters){
object mo;
if (!pt[mko++].ParameterType.ToString().Equals("System.Int32"))
mo = ((methodParams)o).paramvalue.ToString();
else
mo = Convert.ToInt32(((methodParams)o).paramvalue.ToStr ing());
//Debug.WriteLine(types[tko++].ToString());
ws.AddParameter(mo);
}
// get all types of the dynamic assembly
//Type[] types = ws.ProxyAssembly.GetTypes();
// get a certain type by name - watch out for fully qualified name
//Type t = ws.ProxyAssembly.GetType(ns + "Order");
//...
//Then create an instance of the type by using reflection.
//object result = Activator.CreateInstance(t);
try
{
ws.InvokeCall();
}
catch ( Exception e)
{
Debug.WriteLine(e.ToString());
}
finally
{
//Debug.WriteLine(result);
}
} Kevin
<ja*****@texeme.com> wrote in message news:F9********************@speakeasy.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.
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.com ).
public static void WInvoke(
string WDSL,
string TypeName,
string Method,
ArrayList MethodParameters
)
{
string result = string.Empty;
DynamicWebServiceProxy ws = new DynamicWebServiceProxy();
ws.Wsdl = WDSL;
//"http://localhost/EHLO/Service1.asmx?WSDL";
ws.TypeName = TypeName;
ws.MethodName = Method;
Type[] types = ws.ProxyAssembly.GetTypes();
int mko = 0;
MethodInfo[] mi = types[0].GetMethods(BindingFlags.Public |
BindingFlags.Instance |
BindingFlags.DeclaredOnly);
ParameterInfo[] pt = null;
foreach ( MethodInfo m in mi)
if(m.Name.Equals(Method))
pt = m.GetParameters();
foreach(object o in MethodParameters){
object mo;
if (!pt[mko++].ParameterType.ToString().Equals("System.Int32"))
mo = ((methodParams)o).paramvalue.ToString();
else
mo = Convert.ToInt32(((methodParams)o).paramvalue.ToStr ing());
//Debug.WriteLine(types[tko++].ToString());
ws.AddParameter(mo);
}
// get all types of the dynamic assembly
//Type[] types = ws.ProxyAssembly.GetTypes();
// get a certain type by name - watch out for fully qualified name
//Type t = ws.ProxyAssembly.GetType(ns + "Order");
//...
//Then create an instance of the type by using reflection.
//object result = Activator.CreateInstance(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 MethodParameters
)
{
string result = string.Empty;
DynamicWebServiceProxy ws = new DynamicWebServiceProxy();
ws.Wsdl = WDSL;
//"http://localhost/EHLO/Service1.asmx?WSDL";
ws.TypeName = TypeName;
ws.MethodName = Method;
Type[] types = ws.ProxyAssembly.GetTypes();
int mko = 0;
MethodInfo[] mi = types[0].GetMethods(BindingFlags.Public |
BindingFlags.Instance |
BindingFlags.DeclaredOnly);
ParameterInfo[] pt = null;
foreach ( MethodInfo m in mi)
if(m.Name.Equals(Method))
pt = m.GetParameters();
foreach(object o in MethodParameters){
object mo;
if (!pt[mko++].ParameterType.ToString().Equals("System.Int32"))
mo = ((methodParams)o).paramvalue.ToString();
else
mo = Convert.ToInt32(((methodParams)o).paramvalue.ToStr ing());
//Debug.WriteLine(types[tko++].ToString());
ws.AddParameter(mo);
}
// get all types of the dynamic assembly
//Type[] types = ws.ProxyAssembly.GetTypes();
// get a certain type by name - watch out for fully qualified name
//Type t = ws.ProxyAssembly.GetType(ns + "Order");
//...
//Then create an instance of the type by using reflection.
//object result = Activator.CreateInstance(t);
try
{
ws.InvokeCall();
}
catch ( Exception e)
{
Debug.WriteLine(e.ToString());
}
finally
{
//Debug.WriteLine(result);
}
} Kevin
<ja*****@texeme.com> wrote in message news:F9********************@speakeasy.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. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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,...
|
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
|
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...
|
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...
|
by: amazon |
last post by:
Our vender provided us a web service:
1xyztest.xsd file...
------------------------------------
postEvent PostEventRequest
-------------------------------------
authetication authentication...
|
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...
|
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...
|
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...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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,...
|
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...
|
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...
|
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...
|
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...
| |