How to connect to the Taleo Enterprise Edition API in Visual Studio? - c#

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.

Related

Accessing a WSDL web service that requires a Header from a .Net solution client

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.

C# Getting XML SOAP response from autogenerated Reference.cs in Visual Studio

In visual studio 2008 using .net 3.5 i have consumed a WSDL which has automatically generated a Reference.cs.
This was done by right clicking on References in my project and selecting "Add Web Reference"
Using this i can post to the web service and get valid responses through my ref and out objects. postValues() is a void method.
webService.postValues(ref value1, ref value2, out value3);
Using WireShark i can see the the request and full soap response on my network.
What im trying to figure out is how can i capture this raw SOAP response in my code.
I would like to capture this for logging purposes and would rather not individually serialize each of the ref objects.
I cant see anyway to do this without modifying the automatically generated Reference.cs which id rather not do.
Any help would be appreciated.
Edit: There doesnt seem to be a way to do this that i can see. Can anyone else confirm or deny this?
EDIT. Ill bump this just one more time to see if anyone knows.
You have following options:
Enable tracing for your web service in config, and dump all information into file. If you are using WCF instead of legacy web services, see this question on how to enable tracing for WCF.
Implement your own SoapExtension and plug into message processing pipeline to intercept and dump incoming/outgoing soap messages. I think example in linked artice contain TraceExtension, which does exactly that.
Modify generated Reference.cs and dump passed objects, as you specified.

How to generate proxy class from WSDL in case of webservice

suppose when i have only wsdl file then how can i create proxy class just to call webservice various method. how webservice related all class and its property & method will be exposed in my c# apps. can anyone help guiding me. thanks
You would need to use the ServiceModel Metadata Utility Tool, or Visual Studio's Add Service Reference Dialog in order to generate a client proxy for the service with which you want to communicate. The generated proxy will provide classes that abstract the service contract, and you can program your client applications to interact with these classes.
There is an utility, it shipps with Visual Studio (since 2005, I think), called wsdl.exe
It's commandline, and can be used to generate proxy.
You can use WSDL.exe tool using command line.
i.e. WseWsdl3 WSDLPath /out:MyProxyClass.cs
if WseWsdl3.exe is unable to create the proxy class, there is still a way.
If you can run your service as a regular ASP.NET web application in IIS, it creates temporary ASP.NET files where the proxy class is nicely generated for you.
You can find it in folder:
C:\Windows\Microsoft.NET\Framework\vMAJOR.MINOR.BUILD\Temporary
ASP.NET Files\YOUR_WEB_APP.
There are some subfolders with random names, go to most recent one and look something like "App_WebReferences.XXXX.0.cs".

Consuming webservice having WSDL and XSD files

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

Calling PHP Webservice from C# using supplied WSDL

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.

Categories