Showing posts with label Visual Studio. Show all posts
Showing posts with label Visual Studio. Show all posts

Thursday, April 25, 2019

Visual Studio: fix the References in a web site solution or .NET project


A solution can have references to multiple sub-projects. If you make some code changes on a sub-project but the changes do not seem to take effects on the project, the reference may have been broken.

To check the references in the solution, right click on the Web Site on the Solution Explorer. Select Property Pages on the menu.

In the Property Pages dialogue, select References from the listed items. Check on the lists of the references and make sure the Version of all the sub-projects have the values of Auto Update. If it is a specific version number, your changes of the sub-project will have not effect. To change it to Auto Update, use the Remove button to remove the sub-project from the list and then use the Add button to add it back.

You may also be able to add or remove the References from the Solution Explorer for projects. Just expand the project and look for the References item.

Saturday, June 28, 2014

Create a SOAP client from a WSDL with Eclipse or Microsoft Visual Studio


Supposed we have the WSDL file of an existing web service from which we want to create a SOAP client for testing purpose, both Eclipse and Microsoft Visual Studio can help us build one quickly. The WSDL file can be on the web or on the local disk.

Its URLs could look like the following:
   file:///c://path/to/the-wsdl-file.wsdl
   http://www.example.com/path/to/the-wsdl-file.wsdl

Create a SOAP client in Java with Eclipse

  1. Create an empty Dynamic Web Project (New->Projects...->Web->Dynamic Web Project).
  2. Right click on the project and select New->Others.
  3. In the "Select a wizard" dialogue, select Web Service->Web Service Client, and click the "Next" button.
  4. Input the URL of the web service in the Service definition box.
  5. Drag the slider on the left to choose to generate a Test client. Click the "Next" button.
  6. Follow the prompts to create the client and start Tomcat.
  7. A web-based test client is generated and we can run a test with it.
An alternative way (if using Linux) is:
  1. Create an empty Java Project.
  2. Use wsimport to generate the library for the WSDL, e.g.: wsimport -keep -verbose -d /path/to/eclipse/workspace/project/src /path/to/wsdl-file
  3. Write the source code for the test client using the generated library.

Create a SOAP client in C# with Microsoft Visual Studio

  1. Click on menu File->New Project...
  2. In the "New Project" dialogue, choose the template C#->Test. Change Name/Location/Solution/Solution name as needed. Click the "OK" button.
  3. On the Solution Explorer panel, right click on the project's References and select Add Service References...
  4. Input the URL of the web service in the Address box and click the "GO" button. Change the Namespace as needed. Click on the "OK" button.
  5. The test client is generated and the file UnitTest1.cs file is opened for us to add our test cases.
  6. Use http://www.webservicex.net/stockquote.asmx?WSDL as an example, We can write something like the below in TestMethod1():
ServiceReference1.StockQuoteSoapClient client = new ServiceReference1.StockQuoteSoapClient("StockQuoteSoap");

String quote = client.GetQuote("AAPL"); 

Create a SOAP client in VB with Microsoft Visual Studio

  1. Click on menu File->New Project...
  2.  In the "New Project" dialogue, choose the template Visual Basic->Test. Change Name/Location/solution/solution name as needed. Click the "OK" button.
  3. On the Solution Explorer panel, right click on the project's name and select Add Service References...
  4. Input the URL of the web service in the Address box and click the "GO" button. Change the Namespace as needed. Click on the "OK" button.
  5. The test client is generated and the file UnitTest1.vb file is opened for us to add our test cases.
  6. Use http://www.webservicex.net/stockquote.asmx?WSDL as an example, We can write something like the below in TestMethod1():
Dim client As New ServiceReference1("StockQuoteSoap")
Dim quote As String

quote = client.GetQuote("AAPL")
 
Get This <