I am creating a custom SOAP parser for a C# project.
I would like to import libxml2 (a pure c library) to my project. Is this doable?
Are there any C# alternatives in .NET? Is there a C# port of libxml2?
You can use standard XmlWriter and XmlReader from System.Xml namespace which internally use Microsoft Xml Parser which is pretty fast. You can even use DOM oriented acces with System.Xml.XmlDocument or System.Xml.Linq.XDocument. Even there is System.Runtime.Remoting.SoapServices class which help you with soap message.
If you want to consume some SOAP web service, than you can easily import it and visual studio will create strong typed object for you for free without any touch to the SOAP message. You can refer to: MSDN Consuming Web Services
You may have probably allready solved this but i will add this:
I was looking for the same thing and found out there is a nuGet package for libxml2
you might find this helpful.
Related
I often have to create a soap web service which needs to conform to certain documentation. In particular it is often some OTA flavour. (open travel alliance)
For example the service needs to receive OTA_HotelRateAmountNotifRQ and respond with a OTA_HotelRateAmountNotifRS. Generally the syntax of those messages can be downloaded as .xsd:
http://www.opentravel.org/2004A/OTA_HotelRateAmountNotifRQ.xsd
What I would like to do is simplify the process of creating such a service (right now I'm using XDocument and analyze/create the XML by hand).
So assuming I have access to particular XSD files, how can I automatically create corresponding code/classes, wrap them up in SOAP and use as a basis for a web service?
I hope the question makes some sense, any help would be appreciated.
You want to use the XSD to model your WSDL. Then import your WSDL into Visual Studio. This is called the top down or WSDL first approach.
If you dont have a decent WSDL editor such as Altova XML Spy or Liquid XML I would suggest you invest in one as it will make this rather easy.
See Walkthrough: Designing Application Systems by Using a Top-Down Approach for an example.
I want to make a call to a web service that is written in C#, through Visual C++ or C++ in Visual Studio 2010. I searched on web but was not able to find any point to point document. It would be a great help if you will tell me.
If you're prepared to go with managed C++ then you can use WCF.
However, if this isn't an option then your best bet is to go with a socket approach. You'll need some cross-language way to represent the data your sending from C++ to C# and back again. Google Protobuf will help here as there are frameworks for both languages, in addition to many others.
A web service uses something JSON or XML as an interface and is inherently language independent. You would have to look for libraries that can create requests to the web service. For example if your web service in C# uses SOAP (XML) which it would if you created the default web service in Visual Studio you could create your own request in XML in accordance to the specifications of SOAP:
http://www.w3.org/TR/2000/NOTE-SOAP-20000508/
or use one of the libraries mentioned in this question:
Generic WebService (SOAP) client library for C++
Have a look at Walkthrough: Accessing an XML Web Service Using C++.
I've a Web Application project that uses VB as programming language. I want to keep using this language due I've more experience and also it works better with IntelliSense.
Anyway, now I am using Open XML SDK 2.0 Productivity Tool for generate code for the generation of a OOXML document through a given template, and this tool only generates C# code.
With the aim to mix both languages in my project, I had followed this tuto but when I try to add a new C# class, the only language that appears in the list is Visual Basic as you can see in the attached screenshot.
Does anyone know how I can fix this?
Thank you very much
This is not possible; you cannot mix C# with VB.NET in the same project. When .NET compiles an assembly it can use only one compiler to do so.
What you can do, is have a solution with multiple projects (for instance one Web app and several class libraries), and then you can have each class library in the language of your choice.
As others have said in general you cannot do this. The one exception is a web site project.
There is a difference between a web site project and a web application. Mainly in the way they are compiled. A web site is what the tutorial you linked talks about (note the way they say to create it via new website rather than new project and choosing web app) whereas you say above that you have a web application.
You have the option of either changing to a web site or using supplemental projects as others have suggested.
Mixing languages is not what I would go for.
Add a new (DLL)project to your solution that uses C# and handles your XML.
Reference that C# project from your VB-app and call into it.
Clean and easy.
You need to install Visual Studio for c#. It looks your current installed language is vb.
Here is link for downloading vs:
http://www.microsoft.com/visualstudio/eng/downloads#d-2010-express
About using vb and c# code in same solution, its possible as long they are separated to different projects.
We need to parse out and display class documentation for certain classes from Xml documents produced during our build process (for our .Net assemblies) for certain web-service data contracts on a website?
We can use Linq2Xml and do it the hard way but I was wondering if someone's already done this?
I have been provided to a wsdl file by another business to build webservice so that the other business can connect to service I build using the provided wsdl and xsd files. I am dot net developer using wcf. I want to know where to start having the wsdl and xsd files in hand.
Thanks
Hopefully, the schemas and WSDL are .NET friendly. If you want to use WCF, you can generate your classes using SvcUtil.exe.
svcutil -noconfig -serializer:datacontractserializer -d:../
-namespace:*,MyCompany.Services.ServiceName wsdl.wsdl Messages.xsd Data.xsd
The bad news is that svcutil actually generates the client side proxy so you have to manually go and remove the client and channel classes.
For a full description of this approach see Schema-based Development with Windows Communication Foundation.
In the article, they also talk about a Visual Studio add-in, WSCF.blue, that allows you to do Data contract generation (among other contract first development tasks).
You can use the .net wsdl tool and xsd tool to auto generate your classes.
The quick and lazy way of doing it is simply to use add reference in VS (assuming .net3.5 +) or add web reference for .net 2; and allow VS to do the work.
http://www.eggheadcafe.com/tutorials/aspnet/a1647f10-9aa4-4b0c-bbd9-dfa51a9fab8e/adding-wcf-service-refere.aspx
As ( http://andrewtokeley.net/archive/2008/07/10/the-difference-between-ldquoadd-web-referencerdquo-and-ldquoadd-service-referencerdquo.aspx ) says its basically a wrapper for the functions the Tuzo and Ben added.
Makes life easier though and with the 'Add service wrapper' you can use the advanced settings to automatically generate ASync classes & Data Contracts.