473,548 Members | 2,633 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Making C# unsafe call from web service....

I'm calling the C++ function below from C#:

GENCLIENT_API int CleanseEx(char ncSystem, const char *strServer,
const char **pNames, const char **pInputData,
const char **pRules, char ***pOutputData) ;

I can call this function from a console application however when I attempt
to use the same code from within a web service I get the following error:

*************** *************** *************** ************
An unhandled exception of type 'System.Web.Ser vices.Protocols .SoapException'
occurred in system.web.serv ices.dll

Additional information: Server was unable to process request. --> Object
reference not set to an instance of an object.
*************** *************** *************** ************

I'm spinning my wheels trying to figure out if this is a pointer problem or
a code access securing problem, etc... Below are the variables and method
call from my C# application:

[DllImport(@"d:\ tempdlllocation \genclient.dll" ,
arSet.Ansi,
EntryPoint="Cle anseEx")]
private unsafe static extern int CleanseEx(char SystemId, string Server,
string[]Names, string[] InputData, string[] Rules, byte*** OutputData);

int retCode;
char _SystemId = 'G';
string _Server = "TestServer ";
string[] _Names = new string[100];
string[] _Rules = new string[100];
string[] outputData = new string[100];

....... the various arrays are populated with data values.

unsafe
{
byte ** pOutput = null;
retCode = CleanseEx(_Syst emId, _Server, _Names, _InputData, _Rules, &pOutput);
..... code fails on the call above when calling from web service.
}
.......

Any help or recommendations would be really appreciated.

Nov 23 '05 #1
0 2296

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

Similar topics

2
1902
by: Elidel | last post by:
Is the use of a COM object in a c# program considered 'unsafe' code ? Does the method that calls the COM object need the 'unsafe' keyword ? Is code that calls a COM object considered unmanaged? Is 'unsafe' code the same as unmanaged code ?
1
1766
by: Francois Vanderseypen | last post by:
Context: C# wrapper around Tivoli LDAP C library. I understand that something like "public static unsafe void init(void** LDAPObj)" has to do with a byref call. Question: How do I have to wrap or call this function?
1
2301
by: Adam Clauss | last post by:
I am using PInvoke to call a function from a native C library. As one of its parameters, it takes an array of strings in the form of char**. I put the call into an unsafe block and created my array with a char* type. However, the compiler complains that it cannot conver char* to char** when I try to make the call to the native function. ...
4
4309
by: CodeTyro | last post by:
My native language being C++, I've got a few questions that a couple of hours of searching on msdn didn't answer. First, when using unsafe code and pointers, what is the C# equivalent to the C++ "delete" command? I would like to keep my memoryspace clean, but I've been unable to find a way to do it thus far. Second, I'm using structs to...
0
1121
by: Robert Rae | last post by:
I'm calling the C++ function below from C#: GENCLIENT_API int CleanseEx(char ncSystem, const char *strServer, const char **pNames, const char **pInputData, const char **pRules, char ***pOutputData); I can call this function from a console application however when I attempt to use the same code from within a web service I get the following...
0
994
by: Robert Rae | last post by:
I'm calling the C++ function below from C#: GENCLIENT_API int CleanseEx(char ncSystem, const char *strServer, const char **pNames, const char **pInputData, const char **pRules, char ***pOutputData); I can call this function from a console application however when I attempt to use the same code from within a web service I get the following...
0
3605
by: Barb | last post by:
Hello, I have a (C#) web service being consumed by a high volume "asp classic" site. It worked perfectly until I tried consuming a second web service from the first web service. Both services are very high-performing on their own, make inexpensive database calls and use good caching to avoid excess database hits. However, when service 1...
3
2871
by: BlueTrin | last post by:
I am using a DLL written in C, it uses some pointers on functions, I have defined a wrapper around it in C# which uses some delegates: #region Delegates and Marshalling to call solvopt public delegate double funCallback(double x); public delegate double funcCallback(double x); public delegate void gradCallback(double x, double v); public...
10
2564
by: Sergei | last post by:
Can anyone explain why PostMessage to a Windows Form is considered unsafe and raises InvalidOperationException? I can get rid of that setting CheckForIllegalCrossThreadCalls to false and everything works just fine. Still I feel somewhat uncomfortable. Sergei
0
7707
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7951
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...
1
7466
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...
0
5082
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...
0
3495
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...
0
3475
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1926
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
1
1051
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
751
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...

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.