How to expose Red5's SharedObjects through SOAP

℡╲_俬逩灬. 提交于 2019-12-13 03:44:21

问题


Edit: Obviously my first question was not really easy to understand, I hope the answer is usefull :)

I have tried installing Axis2 on the Red5 server and everything went ok, I accessed the Red5 app properties from a custom Web Service using Red5's RTMPClient and exposed them through Axis2.

The problem is that doing it that way I have a 2 levels server and I don't really have direct access from the webservice to the sharedobjects, etc... What I would like to do is to be able to access some Red5 apps functions directly through the SOAP service class.

I suppose I will have to create the SOAP server on my own (maybe using Axis's SimpleHTTPServer or SimpleAxis2Server??)

Any ideas??

I hope I explained myself... And thanks in advance


回答1:


Resolved!!! Instead of using Axis2, I have used JAX-WS which is what I really needed.

I have created a class to use as WebService and expose my SharedObjects

package my.package;
import javax.jws.WebService;
@WebService
public class Red5WS{
    MyApplication app = null;
    public Game(){
        /* Needed but it can be empty */
    }
    public Game(MyApplication app){
        this.app = app;
    }
    public String getAttribute(String SOname, String attrName){
        ISharedObject so = app.getSharedObject(this.app.getScope(), SOname,true);
        return so.getAttribute(attrName);
    }
}

Then I added a call to Endpoint.publish() on MyApplications appStart function to run the WebService as soon as the application is run. I pass this as a parameter to the Red5WS constructor to be able to access applications scope from the web service:

package my.package;
import javax.xml.ws.Endpoint;
import org.red5.server.adapter.ApplicationAdapter;
public class MyApplication extends ApplicationAdapter{
    @Override
    public boolean appStart (IScope app){
        Endpoint.publish(
            "http://localhost:8080/WebService/red5ws",
            new Red5WS(this));
        }
        return super.appStart();
    }
}

After compiling the Red5 app it's a must to use the wsgen to create the needed WS classes.

wsgen –cp . my.package.Red5WS

Once restarted the Red5 app you should be able to acces web service's WSDL file through:

http://localhost:8080/WebService/red5ws?WSDL


来源:https://stackoverflow.com/questions/1017706/how-to-expose-red5s-sharedobjects-through-soap

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!