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.
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 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/
Can I write a web service that implements the same methods and returns the same custom objects using both C#/WCF and also Java Web Services? And if so, can I then access the web services using a single web reference but with different addresses?
I'm asking because I have to host a web service that has a GetCitations and GetTerms method for publically exposing our database content. We are on IIS, so I was going to do it with WCF. However, other partners in the project also have to host an equivalent service and they are all Java based.
We are then building a software app that needs to connect to any number of these services (as defined at runtime by a user). I am expecting that we can have one set of classes to connect to these services (but with different endpoitn addresses), but am not sure whether I'm right in expecting this to work.
Is this possible?
And what considerations/restrictions are there?
Thanks.
It shouldn't be a problem, if you make sure that both services have equivalent wsdl files and you use http/soap binding.
I am not sure about using the binary (net.tcp) one with WCF, though. It might be a problem.
One way to do it is to use JAX-WS (Java 6) to expose a method as a web service.
The JAX-WS stack allows for automatically generating the correct WSDL at runtime.
The .NET team can then take that WSDL, and use standard tools to create a mock implementation of that WSDL. This mock implementation is then used as the actual .NET implementation, and you then use standard tools to generate the WSDL for that web service.
You now have to web services with the same semantics each with their own WSDL.
Both Java and .NET can implement a SOAP compliant web service, so the answer is yes, you can write a .NET and a Java webservice that implement the same WSDL.
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 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.