Difference between revisions of "C Sharp client - OpenKM 6.2"

From OpenKM Documentation
Jump to: navigation, search
(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 …')
 
 
(8 intermediate revisions by 2 users not shown)
Line 2: Line 2:
  
 
== Create separated webservice ==
 
== Create separated webservice ==
  wsdl.exe http://localhost:8080/OpenKM/services/Auth?wsdl /out:OKMAuthService.cs
+
  wsdl.exe http://localhost:8080/OpenKM/services/OKMAuth?wsdl /out:AuthService.cs
  
 
== Create all webservices in one library package ==
 
== Create all webservices in one library package ==
Line 12: Line 12:
 
<sharetypes>true</sharetypes>
 
<sharetypes>true</sharetypes>
 
<documents>
 
<documents>
<document>http://localhost:8080/OpenKM/services/Auth?wsdl</document>
+
<document>http://localhost:8080/OpenKM/services/OKMAuth?wsdl</document>
<document>http://localhost:8080/OpenKM/services/Bookmark?wsdl</document>
+
<document>http://localhost:8080/OpenKM/services/OKMBookmark?wsdl</document>
<document>http://localhost:8080/OpenKM/services/Document?wsdl</document>
+
<document>http://localhost:8080/OpenKM/services/OKMDocument?wsdl</document>
<document>http://localhost:8080/OpenKM/services/Folder?wsdl</document>
+
<document>http://localhost:8080/OpenKM/services/OKMFolder?wsdl</document>
<document>http://localhost:8080/OpenKM/services/Mail?wsdl</document>
+
<document>http://localhost:8080/OpenKM/services/OKMMail?wsdl</document>
<document>http://localhost:8080/OpenKM/services/Note?wsdl</document>
+
<document>http://localhost:8080/OpenKM/services/OKMNote?wsdl</document>
<document>http://localhost:8080/OpenKM/services/Notification?wsdl</document>
+
<document>http://localhost:8080/OpenKM/services/OKMNotification?wsdl</document>
<document>http://localhost:8080/OpenKM/services/Property?wsdl</document>
+
<document>http://localhost:8080/OpenKM/services/OKMPropertyGroup?wsdl</document>
<document>http://localhost:8080/OpenKM/services/PropertyGroup?wsdl</document>
+
<document>http://localhost:8080/OpenKM/services/OKMProperty?wsdl</document>
<document>http://localhost:8080/OpenKM/services/Repository?wsdl</document>
+
<document>http://localhost:8080/OpenKM/services/OKMRepository?wsdl</document>
<document>http://localhost:8080/OpenKM/services/Search?wsdl</document>
+
<document>http://localhost:8080/OpenKM/services/OKMSearch?wsdl</document>
<document>http://localhost:8080/OpenKM/services/Workflow?wsdl</document>  
+
<document>http://localhost:8080/OpenKM/services/OKMWorkflow?wsdl</document>
 +
<document>http://localhost:8080/OpenKM/services/OKMDashboard?wsdl</document>  
 
</documents>
 
</documents>
 
<webReferenceOptions>
 
<webReferenceOptions>
Line 35: Line 36:
  
 
Execute from windows terminal the command:
 
Execute from windows terminal the command:
  wsdl.exe /par:openkm.wsdl /out:OKMWebservice.cs /n:OpenKM.ws
+
  wsdl.exe /par:openkm.wsdl /out:Webservice.cs /n:OpenKM.ws
  
 
If you need a class for VB.net you have to change the command to:
 
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
+
  wsdl.exe /l:VB /par:openkm.wsdl /out:Webservice.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 http://msdn.microsoft.com/en-us/library/7h3ystb6%28v=vs.80%29.aspx]
+
That will generate a Webservice.cs or Webservice.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 http://msdn.microsoft.com/en-us/library/7h3ystb6%28v=vs.80%29.aspx]
  
 
== Suggested changes in generated classes ==
 
== 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
+
Pay attention in public AuthService class ( like others ), it'll be generated some AuthService() constructor that you shouldlike to change to take advantatge of host variable
  
 
<source lang="csharp">
 
<source lang="csharp">
public OKMAuthService() {
+
public AuthService() {
     this.Url = http://127.0.0.1:8080/OpenKM/services/Auth;
+
     this.Url = http://127.0.0.1:8080/OpenKM/services/OKMAuth;
 
}
 
}
 
</source>
 
</source>
Line 54: Line 55:
  
 
<source lang="csharp">  
 
<source lang="csharp">  
public OKMAuthService(String host) {
+
public AuthService(String host) {
     this.Url = host+"/OKMAuth";
+
     this.Url = host + "/OKMAuth";
 
}
 
}
 
</source>
 
</source>
  
 
[[Category: Webservices Guide]]
 
[[Category: Webservices Guide]]

Latest revision as of 18:48, 15 October 2013

.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/OKMAuth?wsdl /out:AuthService.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/OKMAuth?wsdl</document>
		<document>http://localhost:8080/OpenKM/services/OKMBookmark?wsdl</document>
		<document>http://localhost:8080/OpenKM/services/OKMDocument?wsdl</document>
		<document>http://localhost:8080/OpenKM/services/OKMFolder?wsdl</document>
		<document>http://localhost:8080/OpenKM/services/OKMMail?wsdl</document>
		<document>http://localhost:8080/OpenKM/services/OKMNote?wsdl</document>
		<document>http://localhost:8080/OpenKM/services/OKMNotification?wsdl</document>
		<document>http://localhost:8080/OpenKM/services/OKMPropertyGroup?wsdl</document>
		<document>http://localhost:8080/OpenKM/services/OKMProperty?wsdl</document>
		<document>http://localhost:8080/OpenKM/services/OKMRepository?wsdl</document>
		<document>http://localhost:8080/OpenKM/services/OKMSearch?wsdl</document>
		<document>http://localhost:8080/OpenKM/services/OKMWorkflow?wsdl</document> 
		<document>http://localhost:8080/OpenKM/services/OKMDashboard?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:Webservice.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:Webservice.vb /n:OpenKM.ws

That will generate a Webservice.cs or Webservice.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 AuthService class ( like others ), it'll be generated some AuthService() constructor that you shouldlike to change to take advantatge of host variable

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

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

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