asp.net - Consuming a WSDL WebService from a DLL in C# using Visual Studio 2012 -


is there way make possible?

i have created simple wsdl web service 1 method, have tested , working.

now creating dll , i'm adding web reference, when try use on code following error:

the "name of webservice" not exist in current context

other weird thing looks web service files not loading , don't see else web service folder (announcement service)

enter image description here

checking on folder have 3 files: .wsdl file, reference.cs file , .map file

i don't see other .xsd , .disco files.

am doing wrong, or different add web service dll normal asp.net application ?

thank

as fyi finding question via google, did, page reference: https://www.sitepoint.com/net-web-services-5-steps/

you can skip part 1, since won’t need create web service. (they built method accepts string , inserts sql query , returns datatable – pretty common web service method)

part 2: create proxy class

  1. append ?wsdl web services url, i.e. http://localhost/suppliers.asmx?wsdl
  2. open notepad. put url step 1 on end:

    wsdl.exe /l:cs /n:wservice /out:getsuppliers.cs http://localhost/suppliers.asmx?wsdl

save file makews.bat. if ran it, use wsdl utility create proxy class (.cs) file. hold off now.

part 3: build our dll

  1. add following use csc utility single line in batch file create dll:

    csc /t:library /out:getsuppliers.dll getsuppliers.cs /reference:system.dll,system.data.dll,system.web.dll, system.web.services.dll,system.xml.dll /optimize

    now save , run makews.bat.

part 4: incorporate our dll our project uses web service

  1. add service reference url of web service.
  2. add dll project’s bin folder. add generic reference (not service reference) in project file.
  3. add “using wservice;” declaration @ top of class call web service, because namespace added /n:wservice wsdl utility (you can change if like, must done throughout).

  4. add line class: wservice mysvc = new wservice();

  5. you should able call on webmethod within idms web service: datatable dt = mysvc.getdatafromwebmethodx();

    where getdatafromwebmethodx() webmethod trying use.

part 5: useful information allow make calls web service asynchronously (code can proceed without having wait response, , perform callback function later), can at, isn’t required.

it seems there issue, according question comments, #4, can done independently of, , before, creating dll. if have problems referencing web service url using service references, has discoverable, , name can't conflict others in same environment/domain. question's author found, cannot have endpoint (address, port) defined in configurations conflicts site/web service in same domain. seems question resulted in answer more how set web service, on how perform process connect it, thought i'd post both aspects, since both important in order consume web service project , use it.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -