No Class files being generated from Adding a Reference to Web Service - vb.net

I'm integrated our website with a 3rd party site and using their web service to authenticate. I'm using Visual Studio 2010 with Visual Basic and I'm able to use the URL they gave me to add a web reference using:
website -> add web reference -> URL -> Go -> add reference
However, after I do this there aren't any class files generated in my file structure to reference?
The files generated are:
.discomap
.disco
.wsdl
.xsd
.wsdl
.xsd
.xsd
I don't know if it is relevant, but the webservice was made using visual studio 2008.
Every tutorial I have read online has said that class files should be generated after the reference is successfully added. Am I just reading things wrong or is something else amuck?
Thanks!

I ended up having to generate the class file from the Visual Studio command line. The same link that I used to Add Web Reference was the link needed for the command line text.
This generated two files, a class file and an output.config file. I had to combine the output.config file with my web.config file and then the webservice was called correctly.

Related

Missing app.config file?

I just inherited a VB.Net application that gets a SQL connection string like this:
Dim m_GMSConnString As String = System.Configuration.ConfigurationSettings.AppSettings("connString")
But there's no app.config file in the solution/project. So where is it reading from?
EDIT: If this is a DLL project and the DLL is then referenced by a website project, will the DLL read from the web.config of the website project? That's the only explanation I can come up with.
EDIT: If this is a DLL project and the DLL is then referenced by a
website project, will the DLL read from the web.config of the website
project? That's the only explanation I can come up with.
From my experience (and it is confirmed here Why wont my application read my MyApplication.dll.config file?) answer is yes, the code will only read the app.config of the main project (or web.config in your case).
But the answer also provides link that show how to use multiple config file. I think you can tell your program to read some part from external file (your dll.config file in your case).
if I remember correct, there is a config file with the same name as the exe file but add the extention of .config, such as yourprog.exe.config

add more than one service reference for one application

I am unable to add more than one service reference to same class.
using testApp.ServiceReference1;
using testApp.ServiceReference2;
but ServiceReference2 cannot be used as namespace here
Is it possible or not??
Open the reference.cs file under the ServiceReference2 folder (Show All Files in visual studio). The namespace for the generated types will be in that file.

Include an XML file in the Project Build

I have written a small VB.NET simulation program that uses an XML file to configure the simulation. I want to include this file in the project build so that when the application is installed, there will be a default XML file in the required directory.
When I do the Project Publish (within VB 2010 Express), there is no option for including any extra data files in the process.
Is it possible to do this with VB 2010 Express ... or should I try some other project builder/installer.
Any pointers will be very much appreciated,
Regards,
Oliver
The option isn’t found in the publisher, it’s a property of the file itself: when you add a file to the project you can set its file properties in the property window (usually at the right-hand side of the screen, below the file browser).
There you can set its “Build Action” to “Content” and its “Copy to Output Directory” mode to “Copy if newer”.

troubles with generating a service reference

I have to build a .Net application that consumes a bunch of web service. This web service runs under weblogic. The WSDL of the web services mention a XSD file that describes the types.
When I try to add a "Service reference" with VS studio, I have some errors :
Warning 1 Custom tool warning: Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.XmlSerializerMessageContractImporter
Error: Schema with target namespace 'http://mycustomer/ws/types' could not be found.
XPath to Error Source: //wsdl:definitions[#targetNamespace='http://mycustomer/ws/wsdl']/wsdl:portType[#name='lbWebPT'] C:\Projects\mycustomerproject\Service References\ClientService\Reference.svcmap
X3 for the portType, Binding and port elements of the wsdl file.
I was guessing this was because of the missing types defined in the xsd file. To workaround this error, and also to avoid duplicate code, I run the following command on my xsd file (in a pre-build event command line) :
"%ProgramFiles%\Microsoft SDKs\Windows\v7.0A\bin\xsd.exe" "$(ProjectDir)xsdofmycustomer.xsd" /namespace:"MyCustomer.WebServices.Types" /c /o:"$(ProjectDir)."
this command successfully produces a code file with the types and with the correct namespace defined in the XmlRootAttribute.
this code has been put a dedicated VS project. The project where I'm trying to reference the service reference this project. However, the error is still occurring.
What can I do to solve my problem ?
PS: I was able to partially solve my problem using svcutil.exe pathtowsdl pathtoxsd, but I'd like to be able to maintain the reference in VS for ease of use.
thx
I'm not a fan of using project Service References because of the cruft the proxy generator inserts by default. But, if you really want to use Service References for your project then you need to merge the contents of the wsdl & xsd files into a single file. The Service Reference UI assumes all the data it needs to generate the proxy is in the file you give it. SvcUtil is more flexible as you found out. You should able to replace the wsdl:import element with a wsdl:types element that contains the xsd file contents (without the xml directive of course). Next, you enter the path to the file in the address textbox of the Add Service Reference dialog and you should be good to go with Visual Studio catered proxy goodness.

Visual Studio 2010 SharePoint Replaceable Parameter is not being replaced

I'm creating a custom WCF service for deployment inside SharePoint 2010 following the instructions on the SharePoint Bits Blog.
As step 3 says, I am building contents of my .SVC file. Note that this is a blank text file with a .SVC extension, and I have manually entered the text into this file.
<%# ServiceHost
Language="C#"
Factory="...(omited for length)..."
Service="Assembly.MyService, $SharePoint.Project.AssemblyFullName$" %>
The $SharePoint.Project.AssemblyFullName$ is a replaceable parameter that visual studio is supposed to replace with the strong name of the assembly built by my project when the solution is packaged.
The problem is that the replaceable parameter isn't getting replaced during the package step. My project also includes a visual web part (the .webpart file of which contains the same replaceable parameter) that is having its replaceable parameter replaced correctly.
how do I get the replaceable parameter in my .SVC file to replace during the package step?
Preferred option is to add a new PropertyGroup to the Project.csproj file manually in Notepad (aaargh), but then at least it works on a fresh checkout / other dev pc as well:
<PropertyGroup>
<TokenReplacementFileExtensions>svc</TokenReplacementFileExtensions>
</PropertyGroup>
Have you added .SVC file extension to this list:
Although tokens can theoretically be
used by any file that belongs to a
SharePoint project item included in
the package, by default, Visual Studio
searches for tokens only in package
files, manifest files, and files that
have the following extensions:
XML
ASCX
ASPX
Webpart
DWP
These extensions are defined by the
element in the
Microsoft.VisualStudio.SharePoint.targets
file, located in the …\\MSBuild\Microsoft\VisualStudio\v10.0\SharePointTools
folder.
You can, however, add additional file
extensions to the list. To do this,
add a
element to any PropertyGroup in the
SharePoint project file that is
defined before the of the
SharePoint targets file.