如何通过 SOAP 公开 Red5 的 SharedObjects

发布于 2024-07-24 22:39:09 字数 357 浏览 4 评论 0原文

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

我已经尝试在Red5服务器上安装Axis2并且一切正常,我使用Red5的RTMPClient从自定义Web服务访问了Red5应用程序属性并且通过 Axis2 暴露它们。

问题是,这样做我有一个 2 级服务器,并且我实际上无法直接从 Web 服务访问共享对象等...我想做的是能够访问一些 Red5 应用程序功能直接通过 SOAP 服务类。

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

有什么想法吗?

我希望我能解释一下自己......并提前致谢

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

巷雨优美回忆 2024-07-31 22:39:09

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

我创建了一个类用作 WebService 并公开我的 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 服务访问应用程序范围:

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 类。

wsgen –cp . my.package.Red5WS

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

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

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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文