I have written a WCF Rest Service that uses XmlSerializer.
I have also implemented IXmlSerializable on the type I am accepting as a service parameter.
The serialization works great.
However the help files that WCF generates by default do not work. when i navigate to : myservice/help i only see this:
Could not generate schema document.
So is it possible to control what gets generated ? Perhaps there is something I'm missing to make the help files generate correctly.
I do not know how to control help files generation. Most likely, there is no way. But you can disable default help files generation in configs and map to /help paths your custom logic. It may use some reflection or be hard-coded, but you will get what you want - control over help pages generation
Related
As logmeinrescue doesn't support batch users creation using a simple csv upload or similar and instead offers the ability to create user accounts using http post and get or by using soap I thought I would look into this.
Unfortunately following the code example in this link I have been unable to work out how to utilize the SOAP aspect of the code as I have never had previous experience using it.
So far I have written a fairly basic program that reads in the csv with all the user account data needed for creation and would loop through and assign the values needed.
If anyone could assist it would be greatly appreciated, I have tried to look up some documentation in regards to c# and soap but I was unable to find something that really helped me with configuring for logmein.
The c# example at the bottom of documentation you link to looks helpful but flawed. APISoapClient does not have a CookieContainer property so I would try it without the line of code that tries to set it. Later in the code there is a call to sAPI.createUsers but the example has not defined sAPI, I think they meant to re-use proxy.
To get started the easy way, right-click your project References and select Add Service Reference. Enter their endpoint and click GO:
https://secure.logmeinrescue.com/api/API.asmx
If you change the namespace from Service1 to match the example (APIServiceReference) your code will look like the example. From then on you can perform API operations basically just like you were dealing with classes, the SOAP mess is abstracted away for you.
I am C#.NET developer. I am writing a application which can call web service dynamically. I got one web service that is written in Java. This web service returns only web method name in WSDL file but doesn't returns their input/output parameters details. They keep all details in another XSD link. That xsd link present in WSDL file. I want to know that how I can read that XSD file and how we can read Web Method name and their input and output parameters.
I am looking help on priority.
this is sample link: http://www.java-tutorial.ch/api-doc/ArticleService.html#src.N10068
Thanks in advance.
Rajeev
XSD files are valid XML which means you can parse it with classes from the System.Xml or System.Xml.Linq namespaces. I'm assuming when you say you're dynamically calling the web service that you can't rely on a static WSDL reference in Visual Studio
Assuming you are using Visual Studio and are looking to generate proxy classes to consume the web service you need to add a web reference to the WSDL. You can find instructions on how to do this at microsoft.
This process will generate the classes required to interact with the webservice, including all the methods and properties.
This isn't the only way to generate the proxy classes, but IMHO it's the easiest.
Here is a working example of what you can end up with:
I develop against an ERP system called Netsuite. They provide a WSDL at https://webservices.netsuite.com/wsdl/v2013_2_0/netsuite.wsdl.
Following the instructions in the link above I show the following:
I can now call the class like any other. In order to view the classes now available,
view the reference in the Object Browser. The image below shows all the classes, each one of course you can click into to see what properties are available.
I want to create a wsdl by using 3 xsd-files. How do you that?
I tried this in the command prompt:
wsdl.exe /language:cs /parameters: c:\myService\Contract\HeaderData.xsd c:\myService\Contract\MyData.xsd c:\myService\Contract\Messages.xsd /out: MyWsdl.wsdl
What do I wrong?
I believe that there's a misunderstanding here. Most likely the wsdl.exe in your illustration refers to Microsoft's tool, which is described as:
The Web Services Description Language tool generates code for XML Web services and XML Web service clients from WSDL contract files, XSD schemas, and .discomap discovery documents.
From what you seem to imply by asking the output to be a WSDL file, I can safely assume that you really try to create a WSDL file starting from XSD files. Below I am trying to explain why you cannot do that that easy, and what options you have.
The diagram below shows you the model behind the WSDL 1.1 specification.
Your XSDs fit exactly, and only under types. It WSDL terms, types represent your type system used to describe the parts that make up messages, which are then used to describe input/output and faults of operations organized as ports (abstract interfaces) bound to application/transport protocols, and ultimately made (physically) accessible as services at one or more network endpoints.
To generate WSDL(s) out of XSD(s), you realized by now that you need to provide some more data to a tool that would automatically generate a WSDL for you. For example, what operations you want to describe in your WSDL? For each one of them, what's the input, most likely the output and maybe one or more faults? How would you group them (portType = interface)? What binding do you want to use: HTTP, SOAP? What version of SOAP? SOAP over: HTTP, MQ? SOAPAction? How many WSDL files: 1, or maybe 3?
Some tools may ask you a series of questions (data entry/wizards) along the above lines and then create the WSDL(s) for you. Others, use predefined patterns in the implementation of XSD schema constructs (for example, IFX has a certain way to define Request/Response elements) so based on those assumptions a specialized tool such as QTAssistant (I am associated with it) would ask you less questions, while still creating the WSDLs.
I remember one or two online tools that were able to allow the user to upload XSD files and then create WSDL after prompting you a couple of questions, but I can't seem to find them anymore... kind of like this one...
From my understanding, you don't go xsd->wsdl, but I could be wrong.
Generating a WSDL from an XSD file might help clear it up for you though.
You cannot auto-generate a WSDL from an XSD in this manner. In order to create the WSDL, you need to start with a new WSDL and import this XSD.
The XSD defines the types of data that are available for services. Some XSD is usually embedded in a WSDL, some are imported specifically.
An alternate way is to use the XSD in C# to generate a service, and then extract the concrete WSDL from that service, but this is not preferred as many teams prefer contract first web services.
Is it possible to generate wsdl with use of SvcUtil or any other tool. I know I can view wsdl in browser while running the service but I need to have one wsdl file that doesn't have xsd:import directive but rather specifies all the information in this file.
If it's a one off you could manually construct the single WSDL file. But that's no fun. :)
Another way is to create an endpoint behavior. See Improving WCF Interoperability: Flattening your WSDL for the full details.
I'm new to REST and this sounds like it should be pretty simple. In a .NET app, I can create a reference to a WCF service and the contracts for all the available types will be generated for me.
Now I'm trying to consume a REST service in a Windows Phone 7 app. While I can make my call and get back the proper response, is there a simple way to create the classes that each object would be deserialized to?
I'm using RestSharp to manage my calls. In some examples I've seen, user's have created their own classes, and generated the xml manually. I would like to avoid this if at all possible.
many thanks!
Assuming your response is XML, you can save the xml into a file, then call xsd.exe on it to generate a schema. Call xsd.exe on the schema and it will generate a c# class file you can seriazlize and deserialize to from the xml. Here's the documeantion on how XSD.exe works:
http://msdn.microsoft.com/en-us/library/x6c1kb0s(v=VS.100).aspx
You have to generate the classes that your response data will map to (or use a dynamic deserialization scheme if you're on .NET 4) since REST does not include a schema definition system the way SOAP does. In RestSharp, there's a T4 helper to make generating the C# classes easier. It gets you about 80% of the way there. If you need any help with it, post to the RestSharp Google Group.