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.
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>
Related
How to expose wsdl behind firewall?
Mule generated WSDL has endpoints to server where it runs but exposing it outside requires change of this endpoint.
Current workaround what we use is to use SOAPUI to export internal service wsdl, edit it in text editor substitute all internal addresses for external analogs, pack this wsdl and send it to the external consumer.
Is there better way to do so? Maybe some parameter to some component which generates the WSDL which defines the server name for endpoints?
UPDATE based on comments:
This is not general question about WSDL. This is Mulesoft related question. Mule generates WSDL automatically. Here is part what I'm interested in:
<port binding="tns:Hello_Binding" name="Hello_Port">
<soap:address>
location="http://mule.server.internal.local/SayHello/" />
</port>
It is generate because Mule server is at internal box mule.server.internal.local
But when this server is exposed externally it is "hosted" on external site service.mycompany.com, so WSDL should say
<port binding="tns:Hello_Binding" name="Hello_Port">
<soap:address>
location="http://service.mycompany.com/SayHello/" />
</port>
but Mule does not know about it and so WSDL is invalid.
After creating wsdl file for my web service using java, in the wsdl file soap:address location is set to "REPLACE_WITH_ACTUAL_URL", how can I find the url to replace? ( I am using intellij 12 as IDE and JBOSS AS 4 as server)
If you developing this application then you can use localhost e.g.
<soap:address location="http://localhost:8080/TestWebService/HelloService"/>
where 8080 is JBoss's port
TestWebService is project you are developing
HelloService is wsdl file name or if you have changed mapping in web.xml then change this accordingly.
If you are going to deploy on server then change localhost to IP address of the server.
I'mm trying to proxy a service but somehow its not working the way other services did, what am I doing wrong?
This is the original service http://webservicesh.sc.gov.br/SEA/Materiais/Fardamento/WS_Materiais_v1.wsdl
What I did was:
<pattern:web-service-proxy name="BiometriaRH"
inboundAddress="http://LocalIP/services/BiometriaRH/WS_BiometriaRH_v1"
outboundAddress="http://webservicesh.sc.gov.br/SEA/RecursosHumanos/biometria/WS_BiometriaRH_v1.asmx"
wsdlFile="BiometriaRH.wsdl"/>
It does access the WSDL file but I can't load the service any place like soapUI or Eclipse...
Why do you configure wsdlFile="BiometriaRH.wsdl"? Did you manually customize it?
If not, and assuming a WSDL is served at this URL http://webservicesh.sc.gov.br/SEA/RecursosHumanos/biometria/WS_BiometriaRH_v1.asmx?wsdl , then you only need:
<pattern:web-service-proxy name="BiometriaRH"
inboundAddress="http://LocalIP/services/BiometriaRH/WS_BiometriaRH_v1"
outboundAddress="http://webservicesh.sc.gov.br/SEA/RecursosHumanos/biometria/WS_BiometriaRH_v1.asmx" />
I have a standalone spring / rabbit app with the following config:
<rabbit:template id="amqpTemplate" connection-factory="connectionFactory" reply-timeout="1000"/>
<rabbit:admin connection-factory="connectionFactory" />
<beans profile="cloud">
<cloud:rabbit-connection-factory id="connectionFactory"/>
</beans>
<beans profile="default">
<rabbit:connection-factory id="connectionFactory"/>
</beans>
I have a rabbit service bound to my app correctly.
When I directly put the following in the file it works ok:
<cloud:rabbit-connection-factory id="connectionFactory"/>
In trying the use the profiles the connection is refused. Any ideas as to why the profile isn't working? All the docs seems to suggest that the profile should be automagically activated.
The Spring auto-reconfiguration support only works when the application is pushed with the application type "Spring". When pushed as a Standalone app (or JavaWeb, or anything else besides Spring), then Spring auto-reconfiguration is not done.
If all you want to do is to activate the cloud profile in a stand-alone app, you can add -Dspring.profiles.active="cloud" to the command-line you specify when you push the app to CF.
If you need to do more complex configuration, another option would be to use Spring Java Configuration and the CloudFoundry Java Runtime API. In a #Bean method in a Spring #Configuration class, you can call the isCloudFoundry() method of the CloudEnvironment class (contained in the CF Runtime API) to detect whether the app is running on CloudFoundry or not. Based on this, you could instantiate the RabbitMQ beans appropriately.
I have a .war file which was created from a soapui mock service via the 'deployaswar' option and deployed to Tomcat 5.5. I can successfully view the WSDL in firefox but noticed the the schemaLocation attribute for my xsd import is invalid. Here is the current URL format:
http://localhost:8080/?WSDL&interface=UserServicePortBinding&part=User.xsd
It's missing the web application name in tomcat. I verified this by constructing the correct URL and viewing the xsd:
http://localhost:8080/wartest?WSDL&interface=UserServicePortBinding&part=User.xsd
I also noticed the other references in the xsd have the same issue. How can I correct this?
thanks.
I figured this out for myself. It was a matter of using "Deploy directory or WAR file located on server" to deploy the war and setting the context path to: /
That allowed everything to work correctly.