This content has been marked as final. Show 7 replies
It'll depend upon exactly what you want to do; "Web Service" isn't very explicit. You might find that some of the API's you are used to using in J2SE are missing in the MHP and OCAP specifications.
Generally, if you are looking for tutorials or source code, then Steve's web site is the best place to start:
simply I need to execute HTTP get and post methods. For instance, I have a server and there is servlet running on it. How can I execute HTTP get method?
Yet I don't know whether it is appropriate to use return channel for this purpose. If yes, how do I specify URL of the servlet?
I have tried to use Jakarta HttpClient. I created simple Xlet, that only created new HttpClient in its start method. It was compiled without errors, but I got NoClassDefFoundError: org/apache/commons/httpclient/HttpClient when running it in XletView. Is it because XletView does not support Jakarta HttpClient or Xlets in common does not?
Thanks for reply.
It's perfectly to use the return channel to communicate with a remote server - that's what it's there for! The URL you need will depend upon what is it you want to do. Remember that your application is going to be launched by the middleware of the STB from a carousel that it has received from a broadcast. There is no concept of a "default" page that your user is looking at to start with.
Also, You've got to be a bit careful when taking code from other sources to use in MHP because of the way the platform is profiled. It's a while since I've looked, but http://www.mhp.org/ probably tells you what the platform has available.
I was able to hard-code web service calling using HttpURLConnection class and sending soap messages via http connection. This worked correctly, nevertheless I don't find it as somehow sophisticated solution.
Therefore I tried to use Axis to run web services on the server directly, without the need to hard-code soap messages.
In this case, however, I got following error:
I got this error while I tried to run my Xlet in Xletview as well as in Mimundo application. Compilation of this Xlet succeeded without errors. When I tried to call the web services in the same manner in console application, no error occurred during its run.
Libraries for axis were added as external and were copied into Xletview directory.
Do you have any idea why I got this error and/or ideas how to use some web service framework when programming Xlet?
OK. I solved previous problem. It was enough to copy unpacked jars into the directory, where also compiled xlet is stored. But afterwards I got
ExceptionInInitializerError caused by org.apache.commons.discovery.DiscoveryException: No implementation defined for org.apache.commons.logging.LogFactory
during runtime of xlet.
I was able to solve it in such way, that I copied axis jars into java ext directory. This solution would be fine, but there is conflict when running other applications using axis, which find these jar duplicitly. Therefore these applications throw error.
Does anyone have some idea how to solve it?
I'm working in something similar, i would like to use, in my MHP Application, some web services that are running in a external server.
Could you give me information about how you did it?
Thank you very much.
Best regards from Valladolid, Spain
One question, to use the return chanel do you have only to use Java API's like java.sql, java.net etc without worring?
Or do I have to handle with a specific return chanel API?