Pergunta


I've followed the following steps to build a WebService in SharePoint:

  1. Created a new project using WSPBuilder.
  2. Added a 'WebService' (Add a new web service to the layouts folder)
  3. Do a WSBBuilder "Deploy"
  4. The WebService is accessible via http://server/_layouts/MyWebService.asmx

Is this correct ? Or should I follow the steps described at MSDN to create my own .wsdl / .disco files and deploy them to /_vti_bin to make my WebService accessible via http://server/_vti_bin/MyWebService.asmx ?
(Note : the manual steps from MSDN can be automated using SPDev.


I also found this blog : http://jamestsai.net/Blog/post/Where-do-you-deploy-custom-SharePoint-web-service-files-to-%28asmx-discoaspx-and-wsdlaspx%29.aspx which describes the difference between _layouts and _vti_bin.


Question
What's the best way to follow ?
And how can this be automated via the build in VS2008 or during deployment from the WSP ?

Foi útil?

Solução 2

the article you reference at the end of your question really answers it: custom web services should be placed in _vti_bin.

i usually start by adding them to _LAYOUTS but thats only to be able to define my discovery files etc (as described in the MSDN specification you mention).


I've created a simple commandline tool which generates *wsdl.aspx and *disco.aspx SharePoint compatible files from the WebService assembly (dll) in the project.


Tool can be found at http://wsdlgenerator.codeplex.com .

When using this in the build from your SharePoint WebServices project like this:

Add the following line to the "Post Build" event:

"$(ProjectDir)Tools\WSDLGenerator.exe" --input "$(TargetPath)" --outputfolder "$(ProjectDir)12\ISAPI" --spwsdl --spdisco

The wsdl and disco files are automatically created and placed in the ISAPI folder.

Outras dicas

the article you reference at the end of your question really answers it: custom web services should be placed in _vti_bin.

i usually start by adding them to _LAYOUTS but thats only to be able to define my discovery files etc (as described in the MSDN specification you mention).

_vti_bin is a virtual directory mapped to the 12/ISAPI folder, so you can deploy to that using element in your solution manifest. See an example here

Licenciado em: CC-BY-SA com atribuição
Não afiliado a sharepoint.stackexchange
scroll top