Difference between revisions of "C Sharp client - OpenKM 5.1"
From OpenKM Documentation
m (moved C Sharp client 5.1 to C Sharp client - OpenKM 5.1) |
|||
(9 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
.Net framework comes with wsdl.exe utility ( possible it's not in your default path) | .Net framework comes with wsdl.exe utility ( possible it's not in your default path) | ||
+ | == Create separated webservice == | ||
wsdl.exe http://localhost:8080/OpenKM/OKMAuth?wsdl /out:OKMAuthService.cs | wsdl.exe http://localhost:8080/OpenKM/OKMAuth?wsdl /out:OKMAuthService.cs | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== Create all webservices in one library package == | == Create all webservices in one library package == | ||
Line 25: | Line 9: | ||
<wsdlParameters xmlns="http://microsoft.com/webReference/"> | <wsdlParameters xmlns="http://microsoft.com/webReference/"> | ||
<nologo>true</nologo> | <nologo>true</nologo> | ||
− | parsableerrors>true</parsableerrors> | + | <parsableerrors>true</parsableerrors> |
<sharetypes>true</sharetypes> | <sharetypes>true</sharetypes> | ||
<documents> | <documents> | ||
<document>http://localhost:8080/OpenKM/OKMAuth?wsdl</document> | <document>http://localhost:8080/OpenKM/OKMAuth?wsdl</document> | ||
+ | <document>http://localhost:8080/OpenKM/OKMBookmark?wsdl</document> | ||
<document>http://localhost:8080/OpenKM/OKMDocument?wsdl</document> | <document>http://localhost:8080/OpenKM/OKMDocument?wsdl</document> | ||
<document>http://localhost:8080/OpenKM/OKMFolder?wsdl</document> | <document>http://localhost:8080/OpenKM/OKMFolder?wsdl</document> | ||
<document>http://localhost:8080/OpenKM/OKMMail?wsdl</document> | <document>http://localhost:8080/OpenKM/OKMMail?wsdl</document> | ||
+ | <document>http://localhost:8080/OpenKM/OKMNote?wsdl</document> | ||
+ | <document>http://localhost:8080/OpenKM/OKMNotification?wsdl</document> | ||
+ | <document>http://localhost:8080/OpenKM/OKMProperty?wsdl</document> | ||
+ | <document>http://localhost:8080/OpenKM/OKMPropertyGroup?wsdl</document> | ||
<document>http://localhost:8080/OpenKM/OKMRepository?wsdl</document> | <document>http://localhost:8080/OpenKM/OKMRepository?wsdl</document> | ||
− | <document>http://localhost:8080/OpenKM/ | + | <document>http://localhost:8080/OpenKM/OKMSearch?wsdl</document> |
+ | <document>http://localhost:8080/OpenKM/OKMWorkflow?wsdl</document> | ||
</documents> | </documents> | ||
<webReferenceOptions> | <webReferenceOptions> | ||
Line 41: | Line 31: | ||
</webReferenceOptions> | </webReferenceOptions> | ||
</wsdlParameters> | </wsdlParameters> | ||
+ | |||
</source> | </source> | ||
Line 46: | Line 37: | ||
wsdl.exe /par:openkm.wsdl /out:OKMWebservice.cs /n:OpenKM.ws | wsdl.exe /par:openkm.wsdl /out:OKMWebservice.cs /n:OpenKM.ws | ||
− | That will generate a OKMWebservice.cs with namespace OpenKM.ws. For more information about wsdl.exe | + | 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 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 | ||
+ | |||
+ | <source lang="csharp"> | ||
+ | public OKMAuthService() { | ||
+ | this.Url = http://127.0.0.1:8080/OpenKM/OKMAuth; | ||
+ | } | ||
+ | </source> | ||
+ | |||
+ | change to (or create another method with this parameter): | ||
+ | <source lang="csharp"> | ||
+ | public OKMAuthService(String host) { | ||
+ | this.Url = host+"/OKMAuth"; | ||
+ | } | ||
+ | </source> | ||
[[Category: Webservices Guide]] | [[Category: Webservices Guide]] | ||
− |
Latest revision as of 18:34, 1 December 2012
.Net framework comes with wsdl.exe utility ( possible it's not in your default path)
Create separated webservice
wsdl.exe http://localhost:8080/OpenKM/OKMAuth?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/OKMAuth?wsdl</document>
<document>http://localhost:8080/OpenKM/OKMBookmark?wsdl</document>
<document>http://localhost:8080/OpenKM/OKMDocument?wsdl</document>
<document>http://localhost:8080/OpenKM/OKMFolder?wsdl</document>
<document>http://localhost:8080/OpenKM/OKMMail?wsdl</document>
<document>http://localhost:8080/OpenKM/OKMNote?wsdl</document>
<document>http://localhost:8080/OpenKM/OKMNotification?wsdl</document>
<document>http://localhost:8080/OpenKM/OKMProperty?wsdl</document>
<document>http://localhost:8080/OpenKM/OKMPropertyGroup?wsdl</document>
<document>http://localhost:8080/OpenKM/OKMRepository?wsdl</document>
<document>http://localhost:8080/OpenKM/OKMSearch?wsdl</document>
<document>http://localhost:8080/OpenKM/OKMWorkflow?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/OKMAuth;
}
change to (or create another method with this parameter):
public OKMAuthService(String host) {
this.Url = host+"/OKMAuth";
}