function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
CatamaransCatamarans 

Visual Web Developer Question

I have two questions regarding very simple WSDL web service development:
 
1. Has anyone used Visual Web Developer (baby Visual Studio) to deploy and test simple web services...any experiences to share or things to avoid?
 
 
2. After saving the WSDL.wsdl to my local desktop I am having problems adding it as a web reference....
I tried right clicking on the solution explorer and selecting 'add reference' but it does not show up in the 'browse' area.....  Do I need to add a 'web reference' instead....
 
Any feedback appreciated
Jason
SuperfellSuperfell
I haven't used visual web developer, but have used the c# express product without problems.

Use Add Web Reference, and give the filename of the wsdl you saved.
CatamaransCatamarans

Thanks, Simon.

I happened to watch this starter breeze presentation of a recent workshop on the API. It  was good except that you could not actually see the code samples described by the instructor.

She said there was a bug in Visual Studio relating to keywords such as 'events' and 'case'. If I heard correctly these need to be 'escaped' etc.

But, do you know if the same holds true for the 'ight' versions of visual studio...any further comments?

Cheers
Jason

CatamaransCatamarans

Surely I should be able to 'select' the wsdl from my drive.....it is not showing up when I navigate to my desktop?

Thanks
Jason

SuperfellSuperfell
Do "add web reference" and type in the filename of the wsdl (e.g. c:\enterprise.wsdl), there's no browse button.

The problems with case and event apply to VB.NET only, and i think they're addressed in .NET 2.0, not 100% sure.
CatamaransCatamarans
Ok, I got it in and it shows up in my solution explorer as:
 
sforce/
           wsdl.discomap
          
 
 
CatamaransCatamarans
Ok, I got it in and it shows up in my solution explorer as:
 
sforce/
           wsdl.discomap
         
 
 
CatamaransCatamarans
Ok, I got it in and it shows up in my solution explorer as:
 
sforce/
           wsdl.discomap
           wsdl.wsdl
 
I also added:
 

using sforce;

To the top of my Default.aspx.cs page. Is this correct?

But I get compile errors when executing:

Compiler Error Message: CS0246: The type or namespace name 'sfdc' could not be found (are you missing a using directive or an assembly reference?)

Source Error:

Line 28:         sfdc.SessionHeaderValue = new SessionHeader();
Line 29:         sfdc.SessionHeaderValue.sessionId = lr.sessionId;
Line 30:         sfdc.GetUserInfoResult userInfo = lr.userInfo;
Line 31:     } 
Line 32: 

SuperfellSuperfell
If you called the web reference sforce, then it should be sforce.GetUserInfoResult etc, not sfdc.GetUserInfoResult.
CatamaransCatamarans
That did it..thanks.
 
Could I follow this up with a really stupid question?
 
I am now simply concerned with displaying some of the results.
 
However, even though I add a textbox on the aspx page and renamed the ID to eg: myTextBox,
 
I cannot seem to 'access' the object.
 
I want to place some data from the call in there...would you be able to furnish a very simple example of how to eg put the Session ID in there?
 
Thanks
Jason
 
SuperfellSuperfell
myTextBox.Text = loginResult.sessionId;

makesure you have the runat='server' attribute in your new textbox.
CatamaransCatamarans

Hmm...now I pick up this error:

Compiler Error Message: CS0234: The type or namespace name 'loginResult' does not exist in the namespace 'sforce' (are you missing an assembly reference?)

Source Error:

Line 29:         sfdc.SessionHeaderValue.sessionId = lr.sessionId;
Line 30:         sforce.GetUserInfoResult userInfo = lr.userInfo;
Line 31:         myTextBox.Text = sforce.loginResult.sessionId;
Line 32:     }
Line 33: 

I also tried it without the 'sforce' and get this:

Compiler Error Message: CS0103: The name 'loginResult' does not exist in the current context

Source Error:

Line 29:         sfdc.SessionHeaderValue.sessionId = lr.sessionId;
Line 30:         sforce.GetUserInfoResult userInfo = lr.userInfo;
Line 31:         myTextBox.Text = loginResult.sessionId;
Line 32:     }
Line 33:

 

SuperfellSuperfell
substitute loginResult with whatever variable name you chose to store the loginResult in, in this case lr.

You would probably benefit from a good .NET introductary book.