I've been passed a WSDL from a third party. Their web service is PHP on Apache.
I can call its methods from within XMLSpy and Validwsdl.com. But cannot get my C#/Visual Studio project to build/validate the WSDL. When I add it to my project - it shows all of the methods and seems fine but won't build.
I've tried add web ref, add service ref, I've tried command line WSDL.exe. Nothing works. Should I be having to hack at their WSDL document? Do I need extra libraries/includes?
I don't understand why it's not working.
The WSDL is :-
http://www.gesundsolutions.com/epp/application/heiq.wsdl
Any Ideas?
Have you used the "Add Web Reference" from the menu in VS?
A simple and quick tutorial that shows you what is needed for communicating with a web service from elsewhere is this post on op0.com. Check it to find out what you're possibly missing.
Yes, just the WSDL is enough if you know the location of the web service. No, you should never change the WSDL, as that is the calling convention.
Related
I'm writing asp.net/c# project and need to call web services which other client provide. I've found that most people right click "service reference" to add url and use it. The thing is, I got .wsdl file only, is there any way to use it directly?
I've tried the solutions in here and they didn't work.
Thank you for answering.
This is going to be a bit long so please bear with me.
I have been beating my head against this issue for quite some time. I am not very experienced in web services from a client and am having real issues setting this up. What I have is a web service from a third part hosted on a site. The service is a WSDL service written in JAVA. I am trying to connect to it from y .NET solution and consume the web services provided. One of the requirements from the vendor is to "set the Headers parameter to 'XXXX' and the value to 'YYYY'"
I am having some serious issues doing this. My first attempt was to simply add the web service as a web reference in Visual Studio (2012). There were no methods exposed by the service to set the header so I simply called a function to see what happened. I received an exception "No SOAP Headers specified".
Next I attempted to create a manual proxy using SVCUTIL.exe. I think there may be something wrong with the web services because I receive errors "Cannot import wsdl:binding": "Detail: The required WSDL extension element 'binding' from namespace 'http://schemas.xmlsoap.org/wsdl/http/' was not handled."
However, the class and config files are still created. Anyways, I imported the class into my web app and updated my web.config with the necessary settings from the proxy config. I declare an instance of the needed class and this is where things go south for this attempt. When declaring an instance of the class I receive the error "could not find default end point element that references contract "ContractName" in the ServiceModel client configuration. This might be because no endpoint element matching this contract could be found in the client element". I am wondering if perhaps there is a problem with the services or they simply weren't designed for .NET. The other obvious option is I am doing something wrong. I would be happy to post the config file and such if you would like to see it (I just felt I had loaded this post enough as it is).
What I am really looking for is instructions (a tutorial would be awesome) on how to add a web service as a reference within Visual Studio c# application but being able to set the headers from within the code.
I am sorry for the length of this post.
Thank you for your help.
It took a good bit of trial and error, but I was finally able to host my WCF Service in IIS.
I can browse to the WSDL no problem, and see all of the different methods/attributes.
Now what? I need to use my service inside of another Web App. How do I do that?
I was able to use svcutil.exe to generate the *.cs and output.config files, add that to my web app, and add a reference to System.ServiceModel That worked fine.
BUT, I need to figure out how to use my service hosted in IIS.
In my web app I've added a web reference to the WSDL, but I can't figure out how to expose the methods/attributes.
I'm not ruling out the possibility that there's a better way to do this...so I'm open to suggestions.
Can anyone point me in the right direction?
Right click on the client project and click "Add Service Reference". Then put in the address of your WCF service and it will create the proxies and plumbing for you.
You can add Service Reference to your service. By doing this you don't need the svcutil.
Or you can use the .cs that svcutil generated for you.
http://msdn.microsoft.com/en-us/library/ms730144.aspx
Simply you have to use the class on your .cs file. Istantiate it and call wcf methods...
I am attempting to connect to the Taleo API from my solution in Visual Studio. The Enterprise API (not to be confused with the Taleo Business Edition API) is a SOAP-based Web Service with a number of WSDL endpoints.
I can successfully query the API in SoapUI, however, I am not having luck when attempting to add a Service Reference in Visual Studio.
Here's what I've tried:
Added a reference to the WSDL (Note the Operations that appear). So far so good...
Visual Studio successfully generates the necessary classes, however, the methods circled above are nowhere to be found. I've searched the API for hours and even ran a few searches in Reflector... they are truly MIA.
A few observations:
I can see the methods when viewing the raw WSDL XML in a browser (if you need a sample, I can post it)
I can query the three methods just fine in SoapUI
It's my understanding that the methods only support HTTP POST, so perhaps Visual Studio is performing a GET and the service is rejecting it? (I've FIDDLED this, and all I see is a 200 response)
I am behind a Proxy (although, I was able to connect in SoapUI without having to configure a proxy)
At this point, I'm considering writing my own SOAP client to perform the queries using an HttpWebRequest, but I thought I would try and figure out what's wrong before diving too deep into that.
Any idea what I'm doing wrong here?
I was also having trouble with the API. When I tried adding the service reference as described by the OP, I received a series of errors in the Error List including the following:
Error: Member BusinessGoal.Items of type System.Object[] hides base
class member BaseMultilingualEntity.Items of type
multilingualStringField[]. Use XmlElementAttribute or
XmlAttributeAttribute to specify a new name.
I was able to use the older Web Reference mechanism to generate the proxy classes. You can find this under Add Service Reference → Advanced → Add Web Reference. This will generate a Reference.cs file that contains the proxy class code for the service. You will need to have Show All Files selected in Visual Studio to see this file buried under the generated Web Reference. (You can also use the WSDL.exe command line tool included with Visual Studio to generate the Reference.cs file)
Using this approach, my proxy class included the methods that were missing, but I still needed to manually edit the Reference.cs file to replace all "[][]" with "[]" as many of the generated types were erroneously created as jagged arrays.
I was unable to add a reference to the Taleo API either through the "Add Service Reference" wizard, or though the legacy "Web Reference" method. I ended up writing my own SOAP client using a HttpWebRequest to get and post the XML directly.
We've requested a company to write a webservice that we can use to get some information.They have sent us WSDL and XSD files. Could you please tell me how I can use these files to query data?
I can do it easily if I have a link to a webservice. I just provide the link and Visual Studio generates web reference for me. After that I can use that reference just like a normal class. In this case I have no link. Just above mentioned files. Thank you.
You can create a proxy (add service reference in visual studio) from a wsdl file. You can read about svcutil at http://msdn.microsoft.com/en-us/library/aa347733.aspx, but VS2010 allow you to put a wsdl file on adress when adding service reference.
VS2010 can't create a web service reference from some WSDLs. Have
to write custom wrapper for those. OR edit your WSDL in a way so
VS can consume it. For example it may be ok for you to remove web
service method references for the methods that you are not planning to
use if those references create trouble for you.
Unless you're stuck with .NET 2.0, you should not use ASMX web service technology.
You should use "Add Service Reference" and point it to the WSDL on disk. It will create a set of "proxy" classes with methods that you can call just as though it were a "normal" class.
See "How to Consume a Web Service" for a walkthrough with example.
Use WSDL.EXE utility to generate a Web Service proxy from WSDL.
e.g.
wsdl /language:CS /n:"Microsoft.SqlServer.ReportingServices2010" http://<Server
Name>/reportserver/reportservice2010.asmx?wsdl
check this for Creating and Consuming .NET Web Services in 5 Easy Steps Article and then Creating the Web Service Proxy
Ref:
WSDL and consume web service
consume non .NET webservice through WSDL file
How to use a WSDL