|
-
May 22nd, 2006, 04:27 PM
#1
[02/03] pre-processor directive
Is there a concept of a pre-processor directive in .NET?
any code samples
Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
save a blobFileStreamDataTable To Text Filemy blog
-
May 22nd, 2006, 06:41 PM
#2
Re: [02/03] pre-processor directive
It's called conditional compilation in VB.NET and it's done much the same way as it is in C:
VB Code:
#If DEBUG Then
MessageBox.Show("This is a Debug build.")
#Else
MessageBox.Show("This is a Release build.")
#End If
DEBUG is defined by default in a Debug build and TRACE is defined by default in both Debug and Release builds. You can define additional constants for a specific configuration in the Property Pages for the project under Configuration Properties -> Build.
-
May 23rd, 2006, 07:43 AM
#3
Re: [02/03] pre-processor directive
Hi Jim,
Here is my specific problem. I have a got a wsdl (a) for a webservice running on server1 and another wsdl (b) for a webservice running on server2.
I used the wsdl utility to convert both into vb files. Both webservices have the same input / output parameters.
Code:
<System.Web.Services.Protocols.SoapDocumentMethodAttribute("document/http://devlserver:CreateQLOpty", Use:=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle:=System.Web.Services.Protocols.SoapParameterStyle.Bare)> _
Public Function CreateQLOpty(<System.Xml.Serialization.XmlElementAttribute([Namespace]:="http://devlserver")> ByVal QL_spcTO_spcEMCOT_CreateQLOpty_Input As QL_spcTO_spcEMCOT_CreateQLOpty_Input) As <System.Xml.Serialization.XmlElementAttribute("QL_spcTO_spcEMCOT_CreateQLOpty_Output", [Namespace]:="http://devlserver")> QL_spcTO_spcEMCOT_CreateQLOpty_Output
Dim results() As Object = Me.Invoke("CreateQLOpty", New Object() {QL_spcTO_spcEMCOT_CreateQLOpty_Input})
Return CType(results(0),QL_spcTO_spcEMCOT_CreateQLOpty_Output)
End Function
I wish to change the http:// with variables. If I try changing the one inside the namespace, the vb file does not compile.
Any ideas?
Cheers,
Abhijit
Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
save a blobFileStreamDataTable To Text Filemy blog
-
May 23rd, 2006, 08:08 AM
#4
Re: [02/03] pre-processor directive
yes, when you declare your webservice object in the code where you are using it, the object will have a .url property, you can change this at runtime to whichever server you need.
VB Code:
Dim MyWebService as New WebServiceClassName
MyWebService.URL = "http://www.developmentserver.com/service.asmx"
'or
MyWebService.URL = "http://www.productionserver.com/service.asmx"
-
May 23rd, 2006, 08:23 AM
#5
Re: [02/03] pre-processor directive
I did try doing that Matt, but now the trouble seems to be namespaces. The compilation did take place, but it still makes a call to http://devlserver instead of http://sptserver
Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
save a blobFileStreamDataTable To Text Filemy blog
-
May 23rd, 2006, 08:25 AM
#6
Re: [02/03] pre-processor directive
I always set my namespaces to the production server even when in dev, and use the code I showed you to point myself between servers..
I am not an expert on webservices, I have just started using them, but I can tell you that I have gotten it working dev to production to dev using that code, and using the namespaces how I mentioned
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|