如何通过SOAP公开Red5的SharedObjects [英] How to expose Red5's SharedObjects through SOAP

查看:77
本文介绍了如何通过SOAP公开Red5的SharedObjects的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

显然我的第一个问题不是很容易理解,我希望答案是有用的:)

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

我尝试在Red5服务器上安装Axis2,然后一切正常,我使用Red5的RTMPClient从自定义Web服务访问Red5应用程序属性,并通过Axis2公开了它们.

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.

问题在于这样做的方式是我有一个两级服务器,实际上我没有从Web服务到共享库等的直接访问权限.我想做的就是能够访问一些Red5应用程序直接通过SOAP服务类运行.

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.

我想我必须自己创建SOAP服务器(也许使用Axis的SimpleHTTPServer或SimpleAxis2Server?)

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

任何想法?

我希望我能自我解释...并预先感谢

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

推荐答案

已解决!!! 我没有使用Axis2,而是使用了我真正需要的JAX-WS.

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

我创建了一个用作WebService的类并公开了我的SharedObjects

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);
    }
}

然后,我在MyApplications appStart函数上添加了对Endpoint.publish()的调用,以在应用程序运行后立即运行WebService.我将此作为参数传递给Red5WS构造函数,以便能够从Web服务访问应用程序范围:

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();
    }
}

编译Red5应用程序后,必须使用wsgen创建所需的WS类.

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

wsgen –cp . my.package.Red5WS

重新启动Red5应用程序后,您应该能够通过以下方式访问Web服务的WSDL文件:

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

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

这篇关于如何通过SOAP公开Red5的SharedObjects的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆