OpenShift上的Web服务 [英] Web Service on OpenShift

查看:127
本文介绍了OpenShift上的Web服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在OpenShift上部署了Web服务,方法是使用@WebService注释类,并使用@WebMethod注释公共方法.然后,将类部署到WildFly8容器中,然后服务器启动该服务.为了能够访问WSDL文件,我必须在WEB-INF文件夹中创建一个文件"jboss-web.xml"并更改上下文根.

I have deployed a web service on OpenShift by annotating a class with @WebService and a public method with @WebMethod. Then, I deployed the class in a WildFly8 container and the server started the service. In order to be able to access the WSDL file I had to create a file "jboss-web.xml" inside the WEB-INF folder and change the context-root.

现在,我可以访问WSDL文件,但不能访问服务本身.问题出在wsdl文件的这一行:

Now I am able to access the WSDL file, but not the service itself. The problem is in this line of the wsdl file:

<wsdl:service name="PlotterService">
    <wsdl:port binding="tns:PlotterServiceSoapBinding" name="PlotterPort">
      <soap:address location="http://127.8.173.1:8080/Plotter"/>
    </wsdl:port>
</wsdl:service>

地址位置设置为内部IP,应替换为我的应用程序的URL.我怎样才能做到这一点?我唯一可以修改的文件是我一开始注释的类.

The address location is set to an internal IP and should be replaced with the URL of my application. How can I do that? The only file I am able to modify is the class that I annotated at the beginning.

推荐答案

我设法解决了这个问题:

I managed to solve this:

Openshift默认没有设置Web服务,因此我们需要修改服务器配置.为此,请在编辑器中打开.openshift/config/standalone.xml(此文件可能被隐藏),并进行以下添加:

Openshift does not have Web services setup by default, so we need to modify the server configuration. To do this open .openshift/config/standalone.xml (this file may be hidden) in an editor and make the following additions:

如果未在元素下按以下方式配置webservices子系统,请复制以下内容并替换webservices子系统以启用和配置Web Services:

If the webservices subsystem is not configured as below under the element, copy the following and replace the webservices subsystem to enable and configure Web Services:

<subsystem xmlns="urn:jboss:domain:webservices:1.1">
    <modify-wsdl-address>true</modify-wsdl-address>
    <wsdl-host>${env.OPENSHIFT_APP_DNS}</wsdl-host>
    <wsdl-port>80</wsdl-port>
    <endpoint-config name="Standard-Endpoint-Config"/>
    <endpoint-config name="Recording-Endpoint-Config">
    <pre-handler-chain name="recording-handlers" protocol-bindings="##SOAP11_HTTP ##SOAP11_HTTP_MTOM ##SOAP12_HTTP ##SOAP12_HTTP_MTOM">
        <handler name="RecordingHandler" class="org.jboss.ws.common.invocation.RecordingServerHandler"/>
    </pre-handler-chain>
    </endpoint-config>
</subsystem>

这篇关于OpenShift上的Web服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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