Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Content Management (Extended ECM)
API, SDK, REST and Web Services
Anyone consuming Web Services from within an OScript module?
John Underhill
I'm looking to robustly access a .Net web service from my OScript module. I have implemented it using the Socket class, but it's not nice - too much possibility of a thread hanging. Also Socket.Read produced a "thread released" error when it got to EOF, so I had to implement a nasty StreamUntil.Is there a nice way of using web services without invoking an external java class to do it for you? Frame single = $Kernel.Mutex.New( "MODULE::_Get" ) if ( single ) Socket sock = Socket.Create() sock.pStreaming = TRUE if ( Socket.Connect( sock, "localhost", 80 ) ) if ( Socket.Write( sock, cmd ) ) Socket.Flush( sock ) String res = Str.ValueToString(Socket.StreamUntil( sock,"" )) Socket.Close( sock ) Echo(res) else Echo("Socket Write failed") end else Echo("Could not get socket") end else Echo("Socket in use") end
Find more posts tagged with
Comments
Hans Stoop
Message from Hans Stoop <
hstoop@opentext.com
> via eLink
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">eLink
HI John,
What do you mean by"external java class"?
My proposal would be to implement it in a Java object that will run in the Livelink server and is called from OScript.
Hans
From:
eLink Discussion: Development Discussion [mailto:development@elinkkc.opentext.com]
Sent:
Monday, December 14, 2009 4:04 PM
To:
eLink Recipient
Subject:
Anyone consuming Web Services from within an OScript module?
Anyone consuming Web Services from within an OScript module?
Posted by
j.underhill@logica.com
(Underhill, John) on 2009/12/14 10:00
I'm looking to robustly access a .Net web service from my OScript module. I have implemented it using the Socket class, but it's not nice - too much possibility of a thread hanging. Also Socket.Read produced a "thread released" error when it got to EOF, so I had to implement a nasty StreamUntil.
Is there a nice way of using web services without invoking an external java class to do it for you?
@ @ Frame single = $Kernel.Mutex.New( "MODULE::_Get" )
@ @ if ( single )
@ @ @ @ Socket sock = Socket.Create()
@ @ @ @ sock.pStreaming = TRUE@ @
@ @ @ @ if ( Socket.Connect( sock, "localhost", 80 ) )
@ @ @ @ @ @ if ( Socket.Write( sock, cmd ) )
@ @ @ @ @ @ @ @ Socket.Flush( sock )
@ @ @ @ @ @ @ @ String res = Str.ValueToString(Socket.StreamUntil( sock,"</string>" ))
@ @ @ @ @ @ @ @ Socket.Close( sock )
@ @ @ @ @ @ @ @ Echo(res)
@ @ @ @ @ @ else
@ @ @ @ @ @ @ @ Echo("Socket Write failed")
@ @ @ @ @ @ end
@ @ @ @ else
@ @ @ @ @ @ Echo("Could not get socket")@ @
@ @ @ @ end
@ @ else
@ @ @ @ Echo("Socket in use")@ @ @ @
@ @ end
John Underhill
Yes, I meant without writing a JavaObject I would have to invoke from OScript - I was hoping there was a clean way to do it without leaving OScript.
John Underhill
For a non-java person, what's involved? Any documentation I can use?
Appu_Nair
I am not aware of any official documentation other than a module that Rolf Poser produced.In that Rolf shows you how to call a static hava method.When we devloped a web service consumer we went along the same lines using a mutex to singleton the socket call.We implemeted a relay.Oscriot calls a URl to aspx page.It calls a sap web service .We parse the html that we are looking for.I recently documented this for another person trying to get java called form oscript
https://knowledge.opentext.com/knowledge/llisapi.dll?func=ll&objId=17019239&objAction=downloadSee
if that s of any use.
Hans Stoop
Message from Hans Stoop <
hstoop@opentext.com
> via eLink
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">eLink
In the builder help there is some doucmentation on JavaObject.
Searching for JavaObject on th eKC will also show some discussions on the subject.
Hans
From:
eLink Discussion: Development Discussion [mailto:development@elinkkc.opentext.com]
Sent:
Monday, December 14, 2009 6:33 PM
To:
eLink Recipient
Subject:
I am not aware of any official documentation other than a module that Rolf...
I am not aware of any official documentation other than a module that Rolf...
Posted by
anair@alitek.com
(Nair, Appu) on 2009/12/14 12:23
In reply to:
For a non-java person, what's involved? Any documentation I can use?
Posted by
j.underhill@logica.com
(Underhill, John) on 2009/12/14 11:28
I am not aware of any official documentation other than a module that Rolf Poser produced.In that Rolf shows you how to call a static hava method.When we devloped a web service consumer we went along the same lines using a mutex to singleton the socket call.We implemeted a relay.Oscriot calls a URl to aspx page.It calls a sap web service .We parse the html that we are looking for.
I recently documented this for another person trying to get java called form oscript
https://knowledge.opentext.com/knowledge/llisapi.dll?func=ll&objId=17019239&objAction=download
See if that s of any use.
John Underhill
I might stick with the socket call for now. Fortunately I have control over the web service code too, so hopefully the relay idea won't be needed. It works if nothing goes wrong - it just dies badly.The JavaObject usage looks straight forward - i just don't have the java to call. One for the future maybe. Thanks all.
Greg_Griffiths_(ggriffiths_-_(deleted))
I came across the following a while ago which may be of interest -
http://ednortonengineeringsociety.blogspot.com/2009/08/creating-restful-web-services-with.html