|
You can get more control over SOAP messages by creating a SoapExtension. You have the ability to view what's on the wire, do your things at 4 different stages... before and after serializing and deserializing. See MSDN for more details on soap extensions.
|
|
|
|
|
Hi
There are number of ways. First you try to explore 'SoapHttpClienProtocal' class of 'System.Web.Services.Protocols' assembly. Web service proxy class is derived from this class only. This will be useful only if you familiar in WSDL and Serialization. So first you learn WSDL (Web Service Description Language) it contains information about the webservices, parameterlist for each method in the service and class defination.It is an XML file. so we can deserialize into a class object and we can read it. Once we knows method and parameter then we can Invoke it using our proxy class derived from ‘SoapHttpClietProtocal’ class or 'HttpClientRequest',but the latter one is not advisable.
Still you feel you are not able to solve this let me take time and develop a sample application for you. Ok
Feel free to contact me
M.Sendilkumar
Senior Software Engineer
TVS Infotech Ltd
Chennai,India.
|
|
|
|
|
I can dynamic invoke web services using that code:
This is synchronization invoke
/// <param name="url" />WebService'shttp
/// <param name="namespace" />WebService'namespace
/// <param name="classname" />WebService'classname which want to invoke
/// <param name="methodname" />
/// <param name="args" />paraneters
/// <returns>result
/// object obj = InvokeWebservice("http://localhost/GSP_WorkflowWebservice/common.asmx","Genersoft.Platform.Service.Workflow","Common","GetToolType",new object[]{"1"});
///
///
private object InvokeWebservice(string url, string @namespace, string classname, string methodname, object[] args)
{
try
{
System.Net.WebClient wc = new System.Net.WebClient();
System.IO.Stream stream = wc.OpenRead(url+"?WSDL");
System.Web.Services.Description.ServiceDescription sd = System.Web.Services.Description.ServiceDescription.Read(stream);
System.Web.Services.Description.ServiceDescriptionImporter sdi = new System.Web.Services.Description.ServiceDescriptionImporter();
sdi.AddServiceDescription(sd,"","");
System.CodeDom.CodeNamespace cn = new System.CodeDom.CodeNamespace(@namespace);
System.CodeDom.CodeCompileUnit ccu = new System.CodeDom.CodeCompileUnit();
ccu.Namespaces.Add(cn);
sdi.Import(cn,ccu);
Microsoft.CSharp.CSharpCodeProvider csc = new Microsoft.CSharp.CSharpCodeProvider();
System.CodeDom.Compiler.ICodeCompiler icc = csc.CreateCompiler();
System.CodeDom.Compiler.CompilerParameters cplist = new System.CodeDom.Compiler.CompilerParameters();
cplist.GenerateExecutable = false;
cplist.GenerateInMemory = true;
cplist.ReferencedAssemblies.Add("System.dll");
cplist.ReferencedAssemblies.Add("System.XML.dll");
cplist.ReferencedAssemblies.Add("System.Web.Services.dll");
cplist.ReferencedAssemblies.Add("System.Data.dll");
System.CodeDom.Compiler.CompilerResults cr = icc.CompileAssemblyFromDom(cplist, ccu);
if(true == cr.Errors.HasErrors)
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
foreach(System.CodeDom.Compiler.CompilerError ce in cr.Errors)
{
sb.Append(ce.ToString());
sb.Append(System.Environment.NewLine);
}
throw new Exception(sb.ToString());
}
System.Reflection.Assembly assembly = cr.CompiledAssembly;
Type t = assembly.GetType(@namespace+"."+classname,true,true);
object obj = Activator.CreateInstance(t);
System.Reflection.MethodInfo mi = t.GetMethod(methodname);
return mi.Invoke(obj,args);
}
catch(Exception ex)
{
throw new Exception(ex.InnerException.Message,new Exception(ex.InnerException.StackTrace));
}
}
I want to asynchronous invoke web services,because the web services are dynamic,and are more than one ,I write a callback , that call back can't deal with all web services.So I want to send soap message myself.If you can resolve my question,give me a letter,thanks.
My question is that:
I know the wsdl of the web services,I want to dynamic asynchronous invoke web services,I use proxy class , the callback function I can't use it to deal with all web services callback.
|
|
|
|
|
hi,
I have tried to import gdi32.dll into my c# project, and also I'm using its CreatePen function.
the declaration is :
private static extern IntPtr CreatePen(int Pen, int nWidth, int Color);
now the problem is, I don't know how to convert the C# color to the value that is suitable for CreatePen use. The MSDN tell us to use RGB marco, but I can't use this marco, so I tried to use Color.ToArgb(), but still not correct.
could anyone help ? Thank you
|
|
|
|
|
Why exactly do you choose to import GDI32.dll into your project? That's a little strange when you have a full managed way of doing that.
Just use the System.Drawing namespace: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdrawing.asp
To create a Color do this:
Color c = Color.FromArgb(....);
To create a Pen do this:
Pen p = new Pen(c);
Do drawing in the Paint event or override OnPaint() method of the control. Use the Graphics object to do all your tasks.
|
|
|
|
|
yes, I know this we can do it inside OnPaint() events,
but for convenience, using window GDI is faster and more smooth than using C# only. Actually, I want to draw some dash rectangles over some objects, so using gdi32.dll, we dont' need to re-paint all pictures..
the problem of getting the color int value to CreatePen is quite strange, is it also depends on what value of drawmode I set inside SetROP2() ??
|
|
|
|
|
azusakt wrote:
but for convenience, using window GDI is faster and more smooth than using C# only.
P/Invoking .DLL's is convenient? Since when? Actually, you won't get any performance increase at all since you have to marshal all kinds of stuff back and forth to unmanaged code, thereby killing any performance gain and even, possibly, slowing the drawing down.
Also, your just recreating the code in the System.Drawing namespace. It's a .NET Class Library wrapped around the GDI32.DLL, among a couple others. So why are you re-inventing the wheel?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
No, I mean the convenience is we can draw some thing over the screen and we're no need to repaint all objects in our OnPaint Event. like XOR drawing.
actually, I need to draw some rectangles over some painted thumbnails and need to repaint every times when the mouse drag and move, but System.Drawing namespace seems have no XOR drawing, if I use Drawing namespace, yes, it can be done, but need to refresh every time.
but anyway, my question is not discussing for why need to use gdi32.dll, is how can I convert the C# color value to the vaule used in CreatePen ?
Thanks for help
|
|
|
|
|
The CreatePen function takes a COLORREF value. You can use simple bit shifts to put one together inside a UINT32. The COLORREF in hexadecimal form looks like this:
0x00bbggrr
All you need to do is something like this:
UInt32 myColor = (unsigned blue value 00-FF) << 16 + (unsigned green value 00-FF) << 8 + (unsigned red value 00-FF)
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hey all! I am working on a project to take a Bill Acceptor and hook it up to a Parallel port. The system will have windows 2000 or 98.
The Bill acceptor sends pulses to pin 12. Every pulse represents $.25 . All I want to do is when I put a 1 dollar or 10 , 20 ...etc.. It will display the integer value on the screen using a label in Visual C#.. Can any one lead me in the right direction??
Thanks
Moz
|
|
|
|
|
There's a couple of projects on the site that use inpout.dll, which should help you do what you want.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Thanks for the Help!!
I am going to check into that also.. But now I found out the bill acceptor has a serial mode.. So I'm trying to learn how to read the data coming in now..
This is all new to me! Some how I have to create a listener so that at any given time I can insert a Bill into the acceptor and it will credit my game while the game is running...
(geesh what fun)
MOZ
|
|
|
|
|
My project had the option of using the serial port, I found the parallel port easier to deal with.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Also, check out the NTPort library. I used that one, it's really good. It comes with good C# examples also.
If you want to use .net 2.0 there is a SerialPort class in the System.IO.
/\ |_ E X E GG
|
|
|
|
|
Hey Thanks for the Help!!
I am going to check into that.. But now I found out the bill acceptor has a serial mode.. So I'm trying to learn how to read the data coming in now..
This is all new to me! Some how I have to create a listener so that at any given time I can insert a Bill into the acceptor and it will credit my game while the game is running...
(What fun huh?) lol
MOZ
|
|
|
|
|
as I understand it, Events are "syntactic sugar" around delegates, not (much) more.
Where comes the "soft requirement" from that an events args should be (object sender, EventArgs e) ? Doesn't make much sense to me.
It does make sense to include the sender - but why not inside the EventArgs? And a base class that provides no common functionality, and does not serve as an identification tag (like an exception class would do)?
we are here to help each other get through this thing, whatever it is Vonnegut jr.
sighist Fold With Us! || Agile Programming | doxygen
|
|
|
|
|
the "event" keyword is not exactly extra. if u want intellisense and designer to work properly you have to have it in.
method(object sender, args e) is just the standard, u can do whatever u want for a method signiture.
|
|
|
|
|
peterchen wrote:
It does make sense to include the sender - but why not inside the EventArgs?
An interesting idea. I have always used the "sender, args" signature pattern. But, I don't see how making a slightly smarter EventArgs would complicate things.
However, I'd wager that most people will state that they tend toward the “advised“ approach because it is the common pattern used in the framework.
Hey don't worry, I can handle it. I took something. I can see things no one else can see. Why are you dressed like that?
- Jack Burton
|
|
|
|
|
There isn't anything that REALLY REQUIRES that you have a delegate signature of (object sender, EventArgs e) within your program, except where the definer of the delegate says 'this is my signature'. In fact you could have a solution like such:
public event MyEventHandler MyEvent;
public delegate void MyEventHandler(MyEventArgs e);
In this case, the users of your object subscribing to that event would create the type of signature you mention.
But I would imagine at the philosophical level: who the sender is, is not really an argument to the event but an external value. The arguments to a mouse event would contain mouse-specific arguments and knowing that it was sent by a listbox is not a relevant argument. Thus it is an external parameter to the event arguments.
This signature left intentionally blank
|
|
|
|
|
Does C# offer single cast delegates in any way, or is there a "standard" solution for implementing them? (I guess a wrapper around a delegate can pretty much do that, but maybe I'm missing something else)
we are here to help each other get through this thing, whatever it is Vonnegut jr.
sighist Fold With Us! || Agile Programming | doxygen
|
|
|
|
|
peterchen,
Have you considered exposing the delegate as a property? By doing this you could leverage the idea that there is only one method to which delegate will refer. Granted, I've never done this myself but a rough idea would be......
namespace peterchen
{
public delegate void PeterChensHandler(......)
public class EventSource
{
private PeterChensHandler _pcHandler;
public PeterChensHandler TheDelegate
{
get{.....}
set{.....}
}
...................
...................
}
public class EventSink
{
...................
...................
...................
void DoSomethig(...)
{
if( m_EventSource.TheDelegate != null)
{
m_EventSource.TheDelegate(....)
}
}
}
}
</code>
Like I said, this is just a rough idea that I'd have to develop a bit more.
Hey don't worry, I can handle it. I took something. I can see things no one else can see. Why are you dressed like that?
- Jack Burton
|
|
|
|
|
Tried that, but this doesn't disable "+=" - Syntax. I could reject any delegate with more than one binding at runtime, but that's not really a nice solution.
I thought of wrapping the delegate in a class to enforce this contraint, but (short of generics) I'd have to write a separate class for each delegate, which is a pain.
maybe I should rather use an Interface for the sink - but that's inconvenient for the client of the class, as many of the methods/callbacks can go by defaults.
we are here to help each other get through this thing, whatever it is Vonnegut jr.
sighist Fold With Us! || Agile Programming | doxygen
|
|
|
|
|
My situation is i'm trying to do some stuff with overriding WndProc but don't know what cases to be checking for cause i don't know what number goes with what message... Is their some magical list of them somewhere?
|
|
|
|
|
Ugh nvm googeling brought me back here
this article has a pretty good list heh.
http://www.codeproject.com/csharp/IMessageFilterArticle.asp
|
|
|
|
|
The constants for the Windows messages are defined in the C++ header files (*.h). They're normally installed with Visual Studio .NET. Just search for files with the name *.H and containing the text of the message your looking for, for example: WM_HSCROLL or WM_MOUSEDOWN. I doubt you'll find a site with all of the constants because there are thousands of them...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|