Web Service on OpenShift

好久不见. 提交于 2019-12-24 17:25:38

问题


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.

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>

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.


回答1:


I managed to solve this:

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:

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>


来源:https://stackoverflow.com/questions/24316703/web-service-on-openshift

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