C# version of SUDS? - c#

I was using Python SUDS a couple of years ago to connect to a web service for smoke testing purposes. The Python scripts would use SUDS to connect to the WSDL file and send soap messages to the web service. Then SUDS would parse the returning XML. Is there a way or library that exists, that would do the same thing in C# (.NET)?
I have seen WCF but I'm not sure that if it is what I'm looking for.

Just adding a Web Reference to your web service in Visual Studio will create a proxy for you that does this.
Alternatively, you can use the WSDL.EXE tool that you get with Visual Studio to generate a proxy via a command line.
See also http://msdn.microsoft.com/en-us/library/ms155134.aspx.

I have seen that ServiceStack does that but it's a Service Framework so what I understand is that you also need to implement your service using ServiceStack.
http://www.servicestack.net/

Related

Getting a web service and using android to consume them?

I have been looking up on youtube regarding Web Services being consume using android. Most of the video are all 1 or 2 years old. Is this doing outdated? is there a better way to do this? currently i am in a company and i was assign to have a android version of their webservice.
I was told to create the service with sql using Visual studio.
Create the android UI and using the services to pull the data.
Am i doing it right?
What is the better or ideal way of going about this?
Should i add JavaScript or something like that?
I have been looking at RESTful , Soap , Json and Wcf. But what is the best way to go if i have to start everything from scratch?
-Programs/System that i am using.
Microsoft Visual Studio Express 2013 for Web
SQL server
IIS express
Android Studio
*I was told to only user framework 4.0 for Visual studio
You can use WCF (SOAP), WCF (RESTful) or WebApi to create a service, both has it's own advantages and disadvantages. You may want to take some time to look at your requirement and then decide what type of service you want to develop. SOAP uses a more complicated messaging pattern using XML, where as REST uses the standard HTTP protocol and methods to communicate and transfer data. But if you are planning consume this service across of variety of applications like mobile, web, desktop, client side script interaction etc, you may consider developing the service as a RESTful. More information on SOAP and RESTful and for detailed understanding you may refer to this link
Understanding SOAP and RESTful

Forbidden XML Schema constructs in WSDL of a web service

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.

how to consume a .net webservice from a C++ application?

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.

Developing .NET Web Service from WSDL file

What's the best practices for developing a web service with a WSDL as a start point?
Use SvcUtil to generate your service interface and then develop a service against that. Here is an example.
Your question is a little vaque, but developing web services with .net is quite easy.
Using visual studio, most of the things are generated for you. You can add methods as
[WebMethod]
public string hello(){
return "hello"
}
and luckily once you deploy it, the wsdl is generated for you.
If you are looking to download some entities from a wsdl, you can use the wsdl utility and invoke a wsdl to download the entity class.
Check out the WCF Developer Center on MSDN - it has tons of tutorials, article, screencasts that show you how to create a SOAP based web service, based on code or WSDL.
I found this question helpful when I had the same question in the past.
Create an ASMX web service from a WSDL file
The problem I had was that I was given a WSDL. I needed to create web service methods based on the contract that the WSDL provided.

C# axis2 client

i am new to c# language.i saw that you wrote the c# client application to the axis2 web service.i also want to know how i write C# client for the axis2 application
I believe that Axis exposes WSDL in the normal way, so you should be able to use "Add Web Reference" from Visual Studio, point it at the relevant Axis WSDL URL, and use the autogenerated client proxy.
I seem to remember there are some subtleties around using null vs empty arrays, but mostly it works fine - or did when I last tried several years ago, anyway.
For any new web service development, I suggest you use WCF instead of the old-style ASMX web services framework that you would get from using "Add Web Reference". Use "Add Service Reference" instead. ASMX is next to obsolete, in the sense that only critical security fixes are expected.
Many AXIS2 services are configured with WS-Security enabled, and WCF is the only practical way to handle those.

Categories

Resources