Update Salesforce Web Reference - visual-studio-2010

So I've added a custom field to a Salesforce Object and need to update the Web Reference and proxy classes created from said web reference. What I'm doing is replacing the existing WSDL file in the Web Reference folder with the new Enterprise WSDL file. I then right-click the Web Reference instance (in this case, SFDC) and select "Update Web Reference" however nothing happens. In fact, the updated WSDL file reverts back to its original state and the proxy class file does change at all.
Am I missing a step here?

I actually accomplished this by deleting the web reference, than creating a new one, which added the new field.

Related

How to access web.config sections in a Web service called from another application?

I'm working on a Web service with Visual Studio, framework 4.7.1. One of its Web methods needs to call another Web service (provided by another company). It converts the parameters it receives (that are consistent with our main application's business logic) into values the other Web service can handle (according to it's own business logic). To do this, it relies heavily on data stored in the Web.config file.
I tested it directly (start the Web service and call the Web methods with automatically generated pages on a Web browser page) and everything worked fine.
Now, I need to build a test application (also in Visual Studio, framework 4.7.1) to call the same Web methods. On first testing it, I noticed that the Web service was trying to access the test application's config file instead of its own (as described in Can't read Web.config with ConfigurationManager.AppSettings ).
So I created an applicationSettings section in the Web.config and moved all the data from appSettings into it. It worked fine.
Now, however, I notice that the same thing happens with the custom sections. One of them looks like this:
<configSections>
<section name="jobTypeLists" type="AdelSoft_WS_FRA.JobTypesSection" />
</configSections>
<jobTypeLists>
<jobTypes>
<jobType codeCustomerType="A" codeJobType="JobForA" />
<jobType codeCustomerType="B" codeJobType="JobForB" />
</jobTypes>
</jobTypeLists>
I can see how such a structure could fit into its own .settings file, but I have another one that is much more complicated. (Like, the text nodes can have up to four ancestors.) To keep this short-ish, I'm not providing it now, but it can easily be arranged.
ConfigurationManager.GetSection("jobTypeLists") returns null when called from the test application. Same with WebConfigurationManager.GetSection("jobTypeLists").
I've also tried accessing the configuration file with ConfigurationManager.OpenExeConfiguration(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile), but I can't seem to find my sections in the Configuration object it returns.
I'm not sure it means anything, but the Configuration object's FilePath property contains "C:\Folder\InnerFolder\WebServiceFolder\web.config.config". Why this second ".config"? I tried passing the same string to ConfigurationManager.OpenExeConfiguration(), without the ".config" extension: it returned null. (As it should, I feel.)
The Configuration object has 10 section groups and 22 sections, which I can't make heads or tails from. Likewise, I can list them.
Actually, there are two ways for a Visual Studio project to reference a Web service: as a regular reference (like you would any other project) or as a Web reference.
I was using the former, and therein lay my mistake.
To reference the Web service, I started it, copied the URL from the browser window that it opened, and pasted it into the "URL" text box in the "Add a Web reference" window from my test application. From there on, it worked fine.
(By the way, I have kept the regular reference as well, because I'm using some constants from the Web service to handle return values.)

Compare what files when update the service reference

Say I updated one WCF service, so in the client side I can view the changes by click view history on the service reference node.
My question is if I wonder what are changed between the changesets, what files should I select?
I think that I can select reference.cs to make a comparison. But is it right? There are many other files such as xsd files.
Try to right-click the service reference and view it in object browser. You could see the generated proxy class.
If you want to compare the difference between the updated service reference and the old one, you could generate client proxy class via SVCUtil.exe tool and then check all generated files.
https://learn.microsoft.com/en-us/previous-versions/dotnet/netframework-3.5/aa347733(v=vs.90)
such as,
Svcutil.exe http://localhost:1300/mex /Directory:D:

Asp.Net Core MVC - Can I move Identity and DataAccess to class library

I have created an ASP.NET Core MVC Web application with Individual User Account authentication (Identity).
The template has created one Web project, with a whole bunch of folders, including a "Data" folder which has the migrations for the Identity schema, and ApplicationDbContext.
Now, I have some other projects alongside the web app which will need to consume the data. I don't want them to reference the web project for obvious reasons.
And ideally I don't want my web project to depend directly on EF.
Can I move the data access into a separate class library? And if so, how!?
Create a class library projects.
Move the content from corewebproject/data to class library projects.
Add following from nuget:
Entity Framework
AspNetCore.Identity
AspNetCore.Identity.EntityFramework
Microsoft.entityframeworkcore.SqlServer
Microsoft.entityframeworkcore.Tools
Microsoft.entityframeworkcore.Tools.Dotnet
Build class library projects.
Add as reference to your web project.
Change reference in startup contextdb file location.
If you want to change you sql server from localdb change defaultconnection in appsettings.
Add reference related files.
Build solutions.
Go to nuget package manager console and select your project.
Run next commands:
'Remove-Migration'. it will remove some file including snapmodel file
Add-Migrations "Name"
update database
Check you database: you can see upadated db with aspnetcore individual account related tables.
!!! Enjoy !!!!
Sure, check out the Dev branch on https://github.com/MachUpskillingFY17/JabbR-Core we just moved all data into a separate library including identity. Its still quite a work in progress, but it absolutely works.

Dynamically set URL of web service

Scenario: I'm running code on the client that connects to a server and uses a web service to retrieve data about a SharePoint list. I'm using the Visual Studio 2010 "service reference" to get a web service for my SP Site and get my data from the list. It works. Now how do I go about coding it such that when I want to move from Test to Production, my web service calls will still work? Note that the web service is a SharePoint web service, I did not write it. I am only using it. Is what I am suggesting possible? I do have the ability to ensure that the Site is the exact same (except for URLS) on both environments (e.g. backup the SP site and put it on production). Thanks for any suggestions.
Summary:
Basically I'm looking for the best way to go from test to production without re-compiling my code which consumes the SP web service. Also, as a side note, if anyone knows how similar the test/production sharepoint sites have to be, [in order for the web service to work on both without anything but the URL being changed].. that would be helpful info.
Solution
The project configuration file can be used to specify the web service location. The .svcdatamap and other files in the VS project are for design time use only, and the URL which is actually used to connect to the SharePoint web service is passed as an argument to the System.Data.Services.Client.DataServiceContext object. This is only tangentially related, but to create your own WCF web service see this link. BTW, the web service will work without recompilation anywhere the SharePoint List has the same List name and the column you're querying has the same name.
As far as I know, Visual Studio Tools for Office projects allow you to have an app.config file in your project. I'd expect that Visual Studio created the app.config file and added the necessary configuration settings related to the web service reference. In any case, you need to store the correct web service url somewhere - app.config, registry or even a database.
If you are not able to store the web service endpoint address information in the app.config file, there's a way to configure the proxy manually.
If it's a .asmx reference added as a legacy "Web Reference" in Visual Studio then all you need to do is set the Url property value of the proxy object before you call any web service methods. For example:
MyASMXWebService proxy = new MyASMXWebService();
proxy.Url = "web service url";
proxy.HelloWorld();
If it's a .svc WCF service reference then things get a bit more complicated. You'll need to create your web service endpoint programmatically. For example:
BasicHttpBinding binding = new BasicHttpBinding();
EndpointAddress endpoint = new EndpointAddress("web service url");
ChannelFactory<IMyWCFWebService> factory = new ChannelFactory<IMyWCFWebService>(binding, endpoint);
IMyWCFWebService proxy = factory.CreateChannel();
proxy.DoWork();
Since SharePoint services (SVC) do not provide a proxy, option 2 will not work. References to both locations must be included in your application and then use a parm to differentiate production from test. I believe 2013 will likely correct this bug.
You have to edit the URL in your project's web.config
Simple SharePoint example:
MyService.ListsSoapClient client = new MyService.ListsSoapClient();
client.Endpoint.Address = "site url"+"/_vti_bin/lists.asmx";

How can I get started using a WSDL file with Visual Studio it's in the root of the project instead of being hosted on the internet somewhere

I've been tasked when integrating a web form into Oracle CRM on Demand (Siebel) using web services. I've been given the WSDL, and some high level documentation from Oracle.
Well, I knew I was in trouble when I tried to add the WSDL as Web Reference and I was asked to enter an URL. I have the WSDL file in the root of the project, but I have no idea how to link to it.
So, I guess that means I need to learn up on web services using C# and Visual Studio. I have a Safari Books Online account, so I can look up most anything.
It's been a while, but I'm OK at the form part. I just need help connecting and using the web service.
Edit #1: Ok, to clarify my question: I am well aware on how to use web services in general. My specific question is how take this WSDL file and do something with it. If the WSDL was hosted somewhere else, I could just add it as a Web Reference. But, I have the file in the project itself and that is what I am having problems with.
The web reference asks for a URL but you can point it to a local file. Just paste the local file path of your WSDL in and it should work.
Further Clarification of Web Reference URL vs URL to access Web Service
Web Reference URL is used to generate and update wrapper classes for WSDL/Web Service. It is not the URL used at runtime to access Web Service.
URL property on generated wrapper classes is used to access actual web service at runtime.
Update:
It should add a path in the web.config or app.config/settings file (Depending on your project type) similiar to the following:
<setting name="Namespace_WebReferenceName" serializeAs="String">
<value>XXX</value>
</setting>
Which should map to a URL property in the generated web reference wrapper classes. You can modify the URL property programmatically to point wherever you want:
Dim shipService As ShipService = New ShipService() 'Initialize the service - where ShipService is the Generated WebReference Wrapper CLass
shipService.Url = ConfigurationSettings.AppSettings("FedExOnlineURL")

Resources