I have a c++ application which checks the information about the printers in a given network. I need to store this information in database, using a webservice in another .net web application. But I m new to c++ and i have no idea how i can make a call to the webmethod in the webservice using c++. There is no add web reference option in the c++ application.
can anybody suggest me a good tutorial for this?
My application is a win32 console application.
Thanks,
Subrat
There is an MSDN article using Visual Studio 2005 named Walkthrough: Accessing an XML Web Service Using C++ and the CLR that should be similar to using Visual Studio 2008 C++.
You could use Axis from Apache to connect to web services.
Since you imply Windows, you might look at WinInet (look for it in msdn). WinInet is a very powerful and feature rich http client but also complicated to use, especially in asynchronous mode.
SOAP messages that are exchanged between client and server are basically XML documents and they are sent via HTTP (they are in the body of HTTP message). If you know the format of SOAP request and response you could use WinHttp API, or more general WinINet. Yet another solution is IXMLHTTPRequest. Be prepared to parse XMLs yourself, probably by using MSXML.
ATL Server is not available in VS2008 (it is released as community project so am not sure how keen Microsoft is to support this technology).
I used WinINet on WinCE to access Apache Axis2/C web service.
Look into gSoap - a great open-source, C/C++ library for accessing web services. I've used this extensively for accessing services written in .Net. Commercial and not-for-profit licenses available.
You just need the wsdl file/url and it will generate the client / server code for you. From the web site:
The gSOAP distribution package
includes two compiler tools to develop
your applications:
The 'wsdl2h' WSDL
parser. This tool converts WSDLs and
XSD files into annotated C/C++
definitions.
The 'soapcpp2' stub and
skeleton compiler. This tool generates
RPC code and XML serializers from the
annotated C/C++ definitions.
The 'wsdl2h' parser converts WSDL into
gSOAP header file specifications of
Web services. This specification gives
a C/C++ transparent view of the
server's functionality. The header
file is processed by 'soapcpp2' to
generate the source code stubs and
skeletons to invoke the service or
build a new service based on the WSDL.
Related
I am trying to create a Windows Store App that consumes a web service. Visual Studio denies to create service proxy methods with following warning in logs:
Custom tool warning: Contract ... is not compatible with Windows Store apps because it contains one or more operations with SOAP Encoding (use='encoded'). Only the non-encoded operations will be generated.
So the questions are:
Where can I find full list of Windows Store app limitations on web services consumption?
Are there any known workarounds (given I can't change the service)?
It seems you're pretty much screwed if you can't change the web service because of the way that any wrappers are most likely SOAP encoded, and also the SOAP Toolkit doesn't allow for much output customisation.
Perhaps writing a (possibly functionally duplicated) web.api based webservice is a better solution? See this link for an example
EDIT: In response to the first comment...
Yes and no; essentially create a REST (whether that be webapi, WCF etc is upto you) wrapper.
See these informative posts on creating a REST wrapper:
helpfull post number 1 and helpfull post number 2
You can create a NETStandard class library to reference the webservice, then reference this library to your web project.
I am a Java developer who has created a rather big Web service that works nice with Java clients or other tools (Soap UI).
One of our clients wants to write a .NET client for the web service and uses the "add service reference" feature of VS2010. According to the client this does not work since our WSDL and XSD files use "Forbidden XML constructs" as defined in this article:
The problem is that we have made heavy usage of xsd:attribute data in WSDL.
So the question is:
Is there a workaround to make .NET stub generation code compliant with WSDL/XSD files that contain xsd:attribute? Is there another .NET library for webservices that supports this feature?
Another question of mine would be why does Microsoft impose these limitations in the first place? Why xsd:attribute is a forbidden costruct in a web service??? Any clues on that?
Probably related: C#.NET Generating web service reference using WSDL (from XML schema) problem
If you have access to a machine with the .NET Framework on it why don't you use svcutil to generate a proxy/config settings for him and send it to him?
See www.svcutil.com for the list of switches and options that are available to you
I have found that if the customer cannot do it one way and you provide a documented (possibly automated) way of doing things then that will generally suffice.
I have tested the HelloWorld.wsdl supplied in the link with the .NET version of Remobjects (http://www.remobjects.com) and it seemed to work fine. I don't have an actual service to test this with but I would suggest that you (or the client :) ) download it and give it a try.
The .NET version can be found here:
http://www.remobjects.com/ro/net.aspx
Apparently the answer is that you should NOT use the modern way of generating stubs with svcutil.exe and instead use the legacy way with wsdl.exe
Creating stubs from the command line with wsdl.exe works fine. The resulting code works as expected and the .NET client connects to the Axis2 Web service.
I am new to server-client applications.
I am trying to build a prototype where a Java server communicates with a .net WPF client over http. The server and client currently communicate over a third-party messaging system(Tibco). I have done a bit of research and have decided on using SOAP and WCF. I have been trying to find tutorials on how to implement this but cant seem to find anything that fits my need. If anyone could point me to some resource that a newbie like me could use to come up to speed with implementing SOAP and WCF to existing system I'd really appreciate it. Also if anyone has any suggestion on any other protocol that could be used, feel free to recommend it.
We did this at work to support some 3rd party interop scenarios and our process looked like:
Generate a WSDL for our WCF service via the wsdl.exe tool (we defined a basic HTTP version of our services because of the lack of eventing in Java),
Used an apache CXF tool, wsdl2java, to generate Java classes for the WSDL,
Used the autogen'd client definition as a wrapper to perform calls on the server.
I'd imagine in your case you'd do the exact opposite, using java2ws.exe in the Apache CXF framework to create your WSDL, then using wsdl.exe in the .Net framework to generate your c# classes (or other CLI classes...), then consuming those classes to accomplish whatever it is you have a client do.
Here's the API page for the CXF Java->WSDL tool - http://cxf.apache.org/docs/java-to-ws.html
And for the WSDL.exe .Net tool - http://msdn.microsoft.com/en-us/library/7h3ystb6(v=vs.71).aspx
I have to consume a Java web service and want to do it using Microsoft Visual Web Developer in C#. I will be adding the endpoint of the web service as the web reference and hopefully go from there, however I am concerened if there will be any interoperability issues? Any help would be appreciated.
There won't be any interoperability issues if the Java web service respects the standards.
You should be able to generate a client from the WSDL and XSD that describe the service. This ought to be fairly routine.
I'm really confused about how to create a SOAP client in C# using .NET. I have found this page which looks really promising, but for the life of me I can't find Microsoft.Web.Services2. Also most information I find about SOAP with C#/.NET are about creating web services in ASP.NET and that's not what I want to do.
Basically what I want to do is implement a SOAP client in C# in a Windows Mobile application.
Download the old OpenNETCF.Web.Services2 source code (in the deprecated source downloads at the bottom of the page). Depending on your exact needs, this will probably provide the WSE classes you need.