简体   繁体   中英

Using Web References in C# Code in Visual Studio 2008

In the beginning, I was trying to find any solution for my issue but I didn't find anything.

I am Dynamics NAV Developer so C# is not my "native" language ;)

I have to connect my Win Form Application with Microsoft Dynamics NAV so I want to use Web Reference (SOAP).

This application is created for Smart devices (Windows Mobile 5.0) in Visual Studio 2008.

I added the Web Reference by right-clicking on my solution and selecting "Add Web Reference". My reference is named as "WS", so In my code (button click function) I try to use this reference ie entering WS.Collectors webservice = WS.Collectors();

When I try to compile my project, I have the following error:

Error 1 The type or namespace name 'WS' could not be found (are you missing a using directive or an assembly reference?) (...)

I also tried to enter using WS.Collectors but it's not working.

How can I use my Web Reference in my C# Code and add some data to it?

Screenshot

Thanks in advance!

You need to add appconfig file where you specify your app setting

<?xml version="1.0" encoding="utf-8" ?>
 <configuration>
 <startup> 
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
 </startup>
 <appSettings>
 <add key="ServiceBaseUrl" value="http://yourserver" />
 <add key="ServicePort" value="yourportvalue"/>
 <add key="InstanceName" value="DynamicsNAV"/>
 <add key="ServiceType" value="Codeunit"/>
 <add key="ServiceName" value="Your Service Name" />
 <add key="CompanyName" value="your company name"/>
 <add key="ServiceBaseOther"  value="WS"/>
 <add key="UserName"  value="YourUsername"/>
 <add key="Password"  value="YourPassword"/>
 <add key="Domain"  value="Your Domain"/>
 <add key="TimeInterval"  value="60000"/>
 </appSettings>
</configuration> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM