<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Content on Content Management &#187; Web Service</title>
	<atom:link href="http://contentoncontentmanagement.com/category/web-service/feed/" rel="self" type="application/rss+xml" />
	<link>http://contentoncontentmanagement.com</link>
	<description></description>
	<lastBuildDate>Tue, 03 Aug 2010 12:57:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<atom:link rel="next" href="http://contentoncontentmanagement.com/category/web-service/feed/?page=2" />

		<item>
		<title>.NET API For Stellent / Oracle Content Server</title>
		<link>http://contentoncontentmanagement.com/2007/09/net-api-for-stellent-oracle-content-server/</link>
		<comments>http://contentoncontentmanagement.com/2007/09/net-api-for-stellent-oracle-content-server/#comments</comments>
		<pubDate>Mon, 01 Oct 2007 03:37:21 +0000</pubDate>
		<dc:creator>David Roe</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Stellent]]></category>
		<category><![CDATA[Web Service]]></category>

		<guid isPermaLink="false">http://ContentOnContentManagement.com/2007/09/30/net-api-for-stellent-oracle-content-server/</guid>
		<description><![CDATA[Stellent / Oracle Content Sever has a wonderful component which allows you wrap a WSDL around any of the app&#8217;s services.  It&#8217;s pretty easy to use and has made Visual Studio(at least for me), my preferred IDE for writing ad-hoc &#8230; <a href="http://contentoncontentmanagement.com/2007/09/net-api-for-stellent-oracle-content-server/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Stellent / Oracle Content Sever has a wonderful component which allows you wrap a WSDL around any of the app&#8217;s services.  It&#8217;s pretty easy to use and has made Visual Studio(at least for me), my preferred IDE for writing ad-hoc and batch applications.  In fact I have to confess that I&#8217;ve found it much simpler to write simple batchloading programs in .NET rather then using Stellent&#8217;s own batchloading tool.</p>
<p>Despite my personal fandom of the WSDL component, it does have a couple drawbacks:</p>
<p>1.  Each web service is in it&#8217;s own namespace.  This makes it a bit of a pain when working with multi-step operations, for instance if you&#8217;re calling the DocInfo service with a WSDL it will return all custom metadata in an array of IdcProperty objects.  If you&#8217;re then planning on updating that item or checking in another related item, you&#8217;ll have to copy all your original IdcProperty objects over to new IdcProperty objects specific to the Checkin/Update service&#8217;s namespace.</p>
<p>2.  Aside from the seven or so pre-defined services, you have to define any additional WSDLS you wish to consume.  Not the end of the world, but it does make the development a little tricker when you need ensure your WSDL exists on each instance you connect to and that it&#8217;s defined to your specs.</p>
<p>There is an alternative; rather then using the WSDLs, you could just add IsSoap=1 to the end of any service call, which will then return you request in SOAP format.  Of course there&#8217;s no friendly WSDL to create all your proxy classes, leaving the SOAP parsing up to you.  In addition uploading files can also be pretty tricky as you essentially need to replicate a multi-part/form upload.</p>
<p>To make my life(and potentially yours) a little easier, I&#8217;ve been experimenting and ultimately developed a simple .NET API for the Stellent / Oracle Content Server.  Modeled after the Stellent&#8217;s Java-based idcserver package, the API can make IsSoap service calls to retrieve information, or just straight HTTP calls when downloading files.  In addition since all calls are made as multipart-form/data posts, one to many files may be uploaded and checked in.</p>
<p><span id="more-13"></span>The API has two public classes, the ServerBean which is the primary interface to the API and the ServerResultSet class which acts and behaves like a Stellent Resultset.  If you think you&#8217;ve seen those class names before, it&#8217;s because you have.  I tried to replicate the functionality of the Content Server&#8217;s idcserver package in .NET.</p>
<p>Here&#8217;s an example of a search results call using the API:</p>
<p><code>//create the object<br />
ServerBean sb = new ServerBean();<br />
//set the url to the content server<br />
sb.ContentServerURL = "http://localhost/stellent/idcplg";<br />
//set our credentials<br />
sb.ContentServerCredentials = new System.Net.NetworkCredential("sysadmin", "idc");<br />
//set the service<br />
sb.putLocal("IdcService", "GET_SEARCH_RESULTS");<br />
//pass in our query<br />
sb.putLocal("QueryText", "dDocTitle &lt;substring&gt; <substring></substring>`Test`");<br />
//execute the service<br />
sb.executeService();<br />
//get our search results<br />
ServerResultSet SearchResults = sb.getResultSet("SearchResults");<br />
if (SearchResults != null)<br />
{<br />
  //loop through the search results<br />
  for(SearchResults.first();SearchResults.isRowPresent();SearchResults.next()){<br />
  //write the content id<br />
  System.Diagnostics.Debug.WriteLine(SearchResults.getStringValue("dDocName"));<br />
  }<br />
}</code> </p>
<p>As you can see the syntax is extremely similar to the Content Server&#8217;s idcserver package.  Anyone familier with JSP development in the content server, should find it very familiar.</p>
<p>Uploading files is also very easy.  I&#8217;ve overriden the &#8220;putLocal&#8221; method so that it can accept a string or a FileInfo object as a value argument.<br />
<code><br />
//create the object<br />
ServerBean sb = new ServerBean();<br />
//set our url<br />
sb.ContentServerURL = "http://localhost/stellent/idcplg";<br />
//set our credentials<br />
sb.ContentServerCredentials = new System.Net.NetworkCredential("sysadmin", "idc");<br />
//service is a check in new<br />
sb.putLocal("IdcService", "CHECKIN_NEW");<br />
//set the title and required arguments<br />
sb.putLocal("dDocTitle", "NET TEST CHECKIN");<br />
sb.putLocal("dDocType", "Document");<br />
sb.putLocal("dDocAuthor", "sysadmin");<br />
sb.putLocal("dSecurityGroup", "Public");<br />
//create to fileinfo objects based on some local files<br />
System.IO.FileInfo File1 = new System.IO.FileInfo(@"C:\Test Spreadsheet.xls");<br />
System.IO.FileInfo File2 = new System.IO.FileInfo(@"C:\Test Text File.txt");<br />
//add the files<br />
sb.putLocal("primaryFile", File1);<br />
sb.putLocal("alternateFile", File2);<br />
//execute the service<br />
sb.executeService();<br />
//check our status<br />
Console.WriteLine(sb.getLocal("StatusMessage"));<br />
</code></p>
<p>Since we also need to download files or retrieve raw results like a dynamic conversion, the underlying executeServiceEx method which is called by the executeService method and also returns a raw stream from the Content Server&#8217;s response is a public method.  Calling executeServiceEx directly will skip the lines of code realted to parsing the server&#8217;s response.</p>
<p>In this example, we perform a dynamic conversion and write the raw HTML to the console window</p>
<p><code>//Create the object<br />
ServerBean sb = new ServerBean();<br />
//set the url<br />
sb.ContentServerURL = "http://localhost/stellent/idcplg";<br />
//set our credentials<br />
sb.ContentServerCredentials = new System.Net.NetworkCredential("sysadmin", "idc");<br />
//set the dynamic conversion<br />
sb.putLocal("IdcService", "GET_DYNAMIC_CONVERSION");<br />
//set our required parameters<br />
sb.putLocal("dDocName", "[Content ID]");<br />
sb.putLocal("RevisionSelectionMethod", "LatestReleased");<br />
//call executeServiceEx, which returns the raw stream<br />
Stream resultStream = sb.executeServiceEx();<br />
//create a reader<br />
System.IO.StreamReader reader = new System.IO.StreamReader(resultStream);<br />
//read the stream<br />
String resultString = reader.ReadToEnd();<br />
//write it to the console<br />
Console.Write(resultString);</code></p>
<p><code></code>That&#8217;s the basic gist on how to work with the API, I will be following up this post with one going through the actual code.  Like any of my code examples, the API is provided without support or warrenty, but I plan keeping the API as sort of a a personal ongoing project so you can expect future versions and enhancements.  If you have any questions or ideas please let me know.  I&#8217;m really looking for some feedback on this one, so comment away.</p>
<p>I&#8217;ve bundled the source as well as an installer package together and posted them for download <a rel="attachment wp-att-14" href="http://ContentOnContentManagement.com/2007/09/30/net-api-for-stellent-oracle-content-server/net-api-for-stellent-oracle-content-server/" title=".NET API For Stellent / Oracle Content Server">here</a><a href="http://contentoncontentmanagement.com/wp-content/uploads/2007/09/simple-net-content-server-api.zip">.</a>  Once installed the API will appear in your Visual Studio add references dialog as OUCSNET.</p>
<p><a href="http://ContentOnContentManagement.com/2007/09/30/net-api-for-stellent-oracle-content-server/net-api-for-stellent-oracle-content-server/" rel="attachment wp-att-14">.NET API For Stellent / Oracle Content Server</a></p>
]]></content:encoded>
			<wfw:commentRss>http://contentoncontentmanagement.com/2007/09/net-api-for-stellent-oracle-content-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

