Accessing Salesforce Webservice API using C# - c#

I havent worked with that Salesforce API before, so I am a bit stuck on how to connect to the salesforce service.
So far I understood that I have to generate a wsdl file for my account or rather the account of my customer (step 1). So far, so good.
But now the Quickstart (http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_quickstart_steps.htm) says something about "Import the WSDL File into your development platform" (step 2).
How do I import a wsdl file into Visual Studio 2008? I cant find the "Add Web Reference" option which is mentioned in the quickstart.
And if I only need to use the WSDL, what use has the Salesforce Dotnet API package which can be downloaded from the salesforce website
(http://wiki.developerforce.com/index.php/Salesforce_Dotnet_API)?
Are there any gotchas I should watch out for when developing applications that use the salesforce API?

If you follow the directions in Binz' answer, you should be able to add a web service reference using Visual Studio.
The "Salesforce Dotnet API package" on the wiki site is not required to access the SalesForce API, it's just a library that tries to abstract it.
As far as gotchas and other things to know, I would recommend that you read chapter 6 of the Force.com Cookbook. You have to sign up for a force.com developer account (free). Most of the things you'll need to be aware of are covered in this chapter. Here are a few of them:
logging in / logging out - session
management
query / queryMore pattern (needed if
you're going to pull large sets of
data from SalesForce)
how to construct a wrapper class -
there is some sample vb.net code you
can download as well
One other thing to note, if you're going to use SOQL to query your SalesForce data, and you need to filter on a SalesForce date field, you'll need to format the date string. Here's one way to do it:
public static string FormatDateForQuery(DateTime dateToFormat, bool includeTime)
{
if (includeTime)
{
return dateToFormat.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss+00:00");
}
else
{
return dateToFormat.ToUniversalTime().ToString("yyyy-MM-dd");
}
}

For Visual Studio 2008 you need to select 'Add Service Reference', then click the 'Advanced' button on the bottom left of the dialogue. There should then be a button on the bottom of that dialogue that says 'Add Web Reference'. You should be able to then select your wsdl file and a service client proxy will be auto genned for you by VS.

To create the WSDL file, go to (your name, top right), set up, develop > api > generate enterprise wsdl > generate. In Chrome, click save page as and put that file in the c drive. In Visual Studio, go to add service reference > advanced > add web reference. Point to the file you downloaded: file:///c:/wsdl.jsp.xml

There is a parsing issue when using .NET 2.0 with date time fields in salesforce, accessing through web services.
It seems to be a bug in .NET but there's another way to address it by manually editing the wsdl.
More information here:
http://community.salesforce.com/t5/NET-Development/Can-t-update-date-datetime-from-c-webservice-through-enterprise/m-p/96046

Related

Adyen web drop in error with the github project

I'm trying to implement an end-to-end proof-of-concept to Adyen's Web Drop-In with the .NET project here https://github.com/adyen-examples/adyen-dotnet-online-payments.
I've pulled the latest stable. I also set the following hard-coded from the values I got off my test Adyen account.
ADYEN_API_KEY
ADYEN_MERCHANT
ADYEN_CLIENT_KEY
When I start the server (dotnet run) and go to https://localhost:5001, Chrome changes it to not secure. I chose Drop-in and after clicking "Continue to Checkout", it fails with the error below:
Happy to help!
Please go to your ca-test environment.
Under your merchantAccount > Developers (in the left-tab-menu) > API credentials > Find your ws_00000 user. In the "Allowed origins"-section, you can add your allowed origins. In your case, add "https://localhost:5001" and you should be good to go!

How to connect QuickBooks Desktop using Web Connector?

I'm trying to develop a simple webform application to create/edit invoice from a .aspx page and want to sync QB Desktop & MS SQL database using web connector & .ASMX web service (2 way sync: QBD -> web app & web app > QBD).
Here is a what I did:
I've setup QB Desktop US version 19 (latest) and Web connector
Added an application via adding .QWC file (I'm using this default .qwc file without any changes, not sure even how can I make it!!)
Step 1 & 2, are done but looking for proper solution to start with the development part. I've referred some other StackOverflow questions and found this sample but not sure which project and version I've to choose from both of them. I'm finding some good sample applications which connects to QB Desktop & Web applications using Interop.QBFC13
I really don't have idea how web connector works and sync with my web app.
Thanks!
I'm using this default .qwc file without any changes, not sure even how can I make it!!
This ^^^ will not work. Ever. There is no "default" .QWC file -- it is specific to your application and if you're using someone else's it's guaranteed not to work.
Create your own .QWC file. Example template:
<?xml version="1.0"?>
<QBWCXML>
<AppName>QuickBooks Integrator</AppName>
<AppID></AppID>
<AppURL>https://example.com/quickbooks/server.php</AppURL>
<AppDescription></AppDescription>
<AppSupport>https://example.com/quickbooks/support.php</AppSupport>
<UserName>username</UserName>
<OwnerID>{90A44FB7-33D9-4815-AC85-AC86A7E7D1EB}</OwnerID>
<FileID>{57F3B9B6-86F1-4FCC-B1FF-967DE1813D20}</FileID>
<QBType>QBFS</QBType>
<Scheduler>
<RunEveryNMinutes>2</RunEveryNMinutes>
</Scheduler>
<IsReadOnly>false</IsReadOnly>
</QBWCXML>
Fields:
<AppName> This is displayed to the user in the Web Connector GUI
<AppID></AppID> Leave it blank
<AppSupport>...</AppSupport> Must contain a valid URL to a valid page which returns a 200 OK HTTP response when visited. Users who have technical problems will be directed here.
<AppURL>...</AppURL> Must contain a valid URL to your SOAP server, https://... if it's remote, http://localhost/... if it's local.
<UserName>...</UserName> This will match the username your SOAP server understands for authentication
<FileID>...</FileID> You can make this up as long as it follows the GUID format (uppercase HEX chars only!): {6904A826-7368-11DC-8317-F7AD55D89593}. It has something to do with DataExt elements; most simple integrations can just make this up.
<OwnerID>...</OwnerID> Same as above
<QBType>...</QBType> Specifies the type of Quickbooks you want to connect to with the web connector (ie “QBFS” or “QBPOS”)
<Scheduler>...</Scheduler> This is an optional element, use this to schedule the Web Connector to run every so often automatically
<IsReadOnly>...</IsReadOnly> Leave this set to false, setting it to true will not work.
Did you read the 100+ page PDF that documents exactly how the Web Connector works and what you need to implement? Link:
QuickBooks Web Connector Programmer's Guide PDF
What have you tried to implement so far?

BIM 360 REST Endpoints problems

we actually started with the BIM360 API at work. We implemented most of the enpoints that are provided by the API # https://developer.autodesk.com/en/docs/bim360/v1/reference/http/
At one point I have discovered some issues.
After succesfully creating a project with the API it needs to be activated. With first response which tells the project was created under an specific ID.
Taking this ID and creating a new Request I get the following response:
"{\"code\":1001,\"message\":\"You cannot change the status of a project that has no project admin.\"}"
OK no problem I think and create a new Request to patch the Project with an project admin. But there I get following message:
{\"code\":1004,\"message\":\"this project doesn't exist.\"}"
#https://developer.api.autodesk.com/hq/v1/accounts/:account_id/projects/:project_id/users
The things thats make me curious is that the Projects exist as Response from Get Project and is visible in the WEB Interface from Autodesk.
I tried to add an project admin with API again, but took a Project that was created from the Autodesk BIM 360 Webinterface. And it works, because it is activated automatically.
At this point I can't find a solution which it get working...
(Side note we using C#, the actual Autodesk API, RestSharp, Newton Json...)
Maybe someone else got it working?
Thanks for your time!
There is a tutorial:
https://developer.autodesk.com/en/docs/bim360/v1/tutorials/activate-service/
Could you try that?
We had a similar question before and verified it works:
Autodesk Forge BIM 360 API - Activating Service Types

Web API to insert records

I am working on Taleo web API. I have an XML file with several records that I will have to insert into the Taleo system using its web API.
I have got the Taleo API guide from http://tbe.taleo.net/products/TBE_API_Guide.pdf.
For the first time, I am working on web API so I don't know where to start. Although the guide shows some examples using SOAP, I don't know how to make this request and retrieve the response using C# or VB.NET. I googled it but didn't get much information about it. If you share your ideas, I would really appreciate it.
From the PDF, it appears the WSDL for the service is at: http://tbe.taleo.net/wsdl/WebAPI.wsdl. In your C#/VB project, use the "Add Service Reference" option on the context menu and supply that URI to the WSDL. That will generate a proxy and many ancillary classes on which you can call whatever methods you need - the SOAP details are under the covers. You'll instantiate an instance of WebAPIClient and should see all the relevant methods there.
For example, in C# after creating a new Service Reference with (uninspired) namespace name of ServiceReference2, I can code the following (though I have no idea what it does!):
var x = new ServiceReference2.WebAPIClient(); // I suspect there's an overload expecting credentials
ServiceReference2.AccountBean y = x.getAccountById("bar", 0);
Exception handling is left to the reader :)

Creating SOAP message body

I would like to know how to create SOAP message, body, and envelope in C#. Any help or links appreciated.
I need to send a SOAP attachment to a third party Web Service. I don't need WCF. I know how it works. My client needs SOAP with attachment.
Here's a really super-short intro how to do this:
1) Create a new project (any kind - console app, windows app, web app - whatever) - File > New > Project
2) In your Solution Explorer, right-click on References and choose Add Service Reference
3) In the dialog box that pops up, you need to enter two things:
your URL where the service lives (typically with a ?wsdl query string to grab the WSDL - the service description)
your namespace where the service classes will live - pick whatever suits you
Then click on Go - this will talk to that service and see what it has to offer
4) Now, that dialog box should update, and show you the service and its operations, as discovered by Visual Studio:
5) Click on OK and some code gets generated in the background
6) Now instantiate a client-side proxy in your code, and call a method on it:
That's all you have to do - everything else, all the messy details of creating a SOAP header and message body, can be happily left to the WCF runtime.
Now go learn WCF!
marc_s: learn SOAP with Attachments before recommending others to learn WCF. SwA is not supported by .Net so he's got to roll his own and that is the background for his question.
Check this link out http://www.xefteri.com/articles/show.cfm?id=15
It describes process for VS.NET, but in VS2010 it is same process. This was an easiest way.
However, if you can construct SOAP message (for example, if you read WSDL and can construct message without any issues or you used something like SOAP UI (http://www.soapui.org/) to generate few mock up messages and got an idea) then you can simply do POST to that URL like in this example http://www.808.dk/?code-csharp-httpwebrequest

Categories