C Sharp client - OpenKM 6.2

From OpenKM Documentation
Revision as of 11:25, 1 June 2012 by Jllort (talk | contribs) (Created page with '.Net framework comes with wsdl.exe utility ( possible it's not in your default path) == Create separated webservice == wsdl.exe http://localhost:8080/OpenKM/services/Auth?wsdl …')

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

.Net framework comes with wsdl.exe utility ( possible it's not in your default path)

Create separated webservice

wsdl.exe http://localhost:8080/OpenKM/services/Auth?wsdl /out:OKMAuthService.cs

Create all webservices in one library package

Create file called openkm.wsdl with contents:

<wsdlParameters xmlns="http://microsoft.com/webReference/">
	<nologo>true</nologo>
	<parsableerrors>true</parsableerrors>
	<sharetypes>true</sharetypes>
	<documents>
		<document>http://localhost:8080/OpenKM/services/Auth?wsdl</document>
		<document>http://localhost:8080/OpenKM/services/Bookmark?wsdl</document>
		<document>http://localhost:8080/OpenKM/services/Document?wsdl</document>
		<document>http://localhost:8080/OpenKM/services/Folder?wsdl</document>
		<document>http://localhost:8080/OpenKM/services/Mail?wsdl</document>
		<document>http://localhost:8080/OpenKM/services/Note?wsdl</document>
		<document>http://localhost:8080/OpenKM/services/Notification?wsdl</document>
		<document>http://localhost:8080/OpenKM/services/Property?wsdl</document>
		<document>http://localhost:8080/OpenKM/services/PropertyGroup?wsdl</document>
		<document>http://localhost:8080/OpenKM/services/Repository?wsdl</document>
		<document>http://localhost:8080/OpenKM/services/Search?wsdl</document>
		<document>http://localhost:8080/OpenKM/services/Workflow?wsdl</document> 
	</documents>
	<webReferenceOptions>
		<verbose>false</verbose>
		<codeGenerationOptions>properties newAsync enableDataBinding</codeGenerationOptions>
		<style>client</style>
	</webReferenceOptions>
</wsdlParameters>

Execute from windows terminal the command:

wsdl.exe /par:openkm.wsdl /out:OKMWebservice.cs /n:OpenKM.ws

If you need a class for VB.net you have to change the command to:

wsdl.exe /l:VB /par:openkm.wsdl /out:OKMWebservice.vb /n:OpenKM.ws

That will generate a OKMWebservice.cs or OKMWebservice.vb with namespace OpenKM.ws. For more information about wsdl.exe options refer to http://msdn.microsoft.com/en-us/library/7h3ystb6%28v=vs.80%29.aspx

Suggested changes in generated classes

Pay attention in public OKMAuthService class ( like others ), it'll be generated some OKMAuthService() constructor that you shouldlike to change to take advantatge of host variable

public OKMAuthService() {
    this.Url = http://127.0.0.1:8080/OpenKM/services/Auth;
}

change to (or create another method with this parameter):

 
public OKMAuthService(String host) {
    this.Url = host+"/OKMAuth";
}