link problem in a C++ web service client

M

Mike Woinoski

(I'm new to VS, so please forgive me if this is a faq.) I'm writing some Java
web services and need to test them with C++ clients. I can use either a Windows
Form application or an MFC application. I used VS.NET 2003 to create a C# client
that successfully processes SOAP messages to and from the Java service. However,
I'm having problems with the C++ client.

I created a new solution and a new project with File > New > Visual C++ Projects
Windows Forms Application. Under the project's References, I created a web
reference to the service WSDL and named the reference donow11service, exactly as
I did with the C# client. VS gave the following warning when creating the proxy:

Creating web service proxy file for donow11service ...
Writing file 'donow11service.h'.
donow11service.h
LINK : warning LNK4243: DLL containing objects compiled with /clr is not
linked with /NOENTRY; image may not run correctly

I added the following code in the submitButton_Click method:

donow11service::RainOrderService * proxy =
new donow11service::RainOrderService();

When I build the project, I get the following messages:

Linking...
stdafx.obj : warning LNK4227: metadata operation warning (00131189) :
Inconsistent parameter information in duplicated methods (methods:
orderRecording; type: __boxed_System_Boolean): (0x08000008).
stdafx.obj : error LNK2022: metadata operation failed (80131195) : Custom
attributes are not consistent: (0x0c000007).
LINK : fatal error LNK1255: link failed because of metadata errors

If I comment out the line that creates the proxy, the application runs. Why are
there errors in stdafx.obj? Is there a linker option I need to set somewhere?
Any help would be much appreciated.

Thanks,
Mike
 
M

Mike Woinoski

Marcus,

Marcus said:
Read this and let us know if you have further questions

[1] http://support.microsoft.com/kb/814472/en-us

It's not clear to me which portions of this article apply to my project (a
simple Windows Forms app), since the article seems to be targeted for developers
of mixed DLLs. However, I assume that you are implying that my link error occurs
because my project is mixing DLLs. If I interpret the article correctly, it
looks like steps to fix the the linker problem are:

1. "The first step to manual initialization is to make sure that you disable the
automatic initialization code"
2. "After you remove the explicit entry point, you must modify components that
consume the DLL for manual initialization"

I followed the steps under "Remove the Entry Point of the Managed DLL". After
that, it's not clear to me how to proceed, because I didn't add any code that
consumes a DLL for manual initialization (at least, not explicitly). I think
that, because I'm writing an application and not a DLL, the section that applies
to my project is "Users of Visual C++ .NET 2002", which says I need to include
_vcclrit.h in my project. However, adding _vcclrit.h in my Form.h or Form.cpp
just cause more compile or link errors. Without _vcclrit.h, the changes I made
to the project in the first step generate more errors than I had originally.

Remember I'm a Java developer, so don't be shy about explaining things in
monosyllables. ;-)

Thanks,
Mike
 
M

Marcus Heege

[1] http://support.microsoft.com/kb/814472/en-us
It's not clear to me which portions of this article apply to my project (a
simple Windows Forms app), since the article seems to be targeted for
developers of mixed DLLs. However, I assume that you are implying that my
link error occurs because my project is mixing DLLs. If I interpret the
article correctly, it looks like steps to fix the the linker problem are:

Indeed this article applies to DLLs only. But your linker error

should occur only if you compile DLLs.

To find something more about your problem. I have created a ASP.NET
WebService and a Managed C++ client, but I couldn't reproduce the problem.
My code seems to compile and link and execute without problems.

Here is what I have done:

1) Solution Explorer / Solution's context menu / Add project Console
Application (.NET)
Name: WFClient
2) Soltuion Exporer / WFClient's context menu / Add Web Reference
URL: ... url url
Button Add Reference
3) Add a button on your form and double click it to implement a handler.
4) Implement the handler to call your web service. For my web service this
was:

localhost::Service1 __gc* ws1 = new localhost::Service1;
String * str = ws1->HelloWorld();
MessageBox::Show(str);

Start and test your application.

Please try the same and let me know if this still causes the problems you
have.

Marcus
 
G

Guest

No Prob

Mike Woinoski said:
(I'm new to VS, so please forgive me if this is a faq.) I'm writing some Java
web services and need to test them with C++ clients. I can use either a Windows
Form application or an MFC application. I used VS.NET 2003 to create a C# client
that successfully processes SOAP messages to and from the Java service. However,
I'm having problems with the C++ client.

I created a new solution and a new project with File > New > Visual C++ Projects
reference to the service WSDL and named the reference donow11service, exactly as
I did with the C# client. VS gave the following warning when creating the proxy:

Creating web service proxy file for donow11service ...
Writing file 'donow11service.h'.
donow11service.h
LINK : warning LNK4243: DLL containing objects compiled with /clr is not
linked with /NOENTRY; image may not run correctly

I added the following code in the submitButton_Click method:

donow11service::RainOrderService * proxy =
new donow11service::RainOrderService();

When I build the project, I get the following messages:

Linking...
stdafx.obj : warning LNK4227: metadata operation warning (00131189) :
Inconsistent parameter information in duplicated methods (methods:
orderRecording; type: __boxed_System_Boolean): (0x08000008).
stdafx.obj : error LNK2022: metadata operation failed (80131195) : Custom
attributes are not consistent: (0x0c000007).
LINK : fatal error LNK1255: link failed because of metadata errors

If I comment out the line that creates the proxy, the application runs. Why are
there errors in stdafx.obj? Is there a linker option I need to set somewhere?
Any help would be much appreciated.

Thanks,
Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top