I've deployed a webservice to a Jboss instance running on Amazon EC2. The webservice works fine locally, but when I deploy on EC2, and go to the /jbossws/services page the Endpoint Address for the webservice is the private DNS of the ec2 instance (domU-X-X-X-X etc...), not the public dns (which I would like it to be).
I've tried loading the wsdl by changing the private hostname to the public IP; that works, but when I try to call any of the operations I get a HostNotFoundException, I'm guessing due to the fact that the generated wsdl has the stanza:
<service name='XXXService'>
<port binding='tns:XXXBinding' name='XXXPort'>
<soap:address location='http://domU-XX-XX-XX-XX-XX-XX.compute-1.internal:8080/xx/xx/xx'/>
</port>
</service>
where http://domU-XX-XX-XX-XX-XX-XX.compute-1.internal is the internal dns of the ec2 instance.
The wsdl is auto generated - Is there a JAXB annotation I can use so that I can force the generated wsdl to use the public dns of the EC2 instance?
Many thanks -
In JBoss 5.1.0 GA look at
jbossws.deployer/META-INF/jboss-beans.xml
and comment the following line
${jboss.bind.address}
it is 100% worked
or see the following
http://community.jboss.org/wiki/JBossWS-UserGuide
Related
So i am trying to deploy new version of SOAP service with different version.
In jboss-webservices.xml I have configured url to service as:
<context-root>/services/MyService</context/root>
<port-component>
<ejb-name>MyServiceEJB</ejb-name>
<port-component-uri>v1</port-component-uri>
...
</port-component>
When I try to deploy service v2 with <port-component-uri>v2</port-component-uri> it ends up with duplicate deployment error because of same context root.
So I tried it with <context-root>/services/MyService/v2</context-root> and <port-component-uri>/</port-conponent-uri>. This solution actually works. But the wsdl is at location : https://MyServer.com:8443/services/MyService/v2/?wsdl.
Is there any solution to be the wsdl at https://MyServer.com:8443/services/MyService/v2?wsdl ? Without the "/" before the "?wsdl".
Basically I want to have deployed both versions of application, where both has url https://MyServer.com:8443/services/MyService/v1 and second https://MyServer.com:8443/services/MyService/v2, but without touching the context-root element.
Thanks for any tips.
I am using WebSphere to publish my service as a web service using #WebService annotation in eclipse.
Details of the server :
Product name: WebSphere Application Server
Product Version: 17.0.0.2
Product edition: BASE_ILAN
While deploying the project on the server, the project started successfully and now I wanted to see the generated WSDL through admin console(as I do in Glassfish).But I am not finding any way to view the admin console or any directory which is having the generated WSDL(I am using mac os)
However, I can see(in eclipse) my service is deployed successfully, see attached image:
Thanks in advance.
As far as I know it's not available in the admin center however you can retrieve it from the service using a web browser.
Look in messages.log to find the context root of your webservices app, you'll see something like:
Web application available (default_host): http://localhost:29080/hello_jaxws/
Then to find the service you might need to know a bit about the service. If the name of the service isn't in an #WebService annotation, and the class isn't remapped in web.xml, then it's the name of the class + "Service". So in my case the name of the class is HelloService, so the url to my service is
http://localhost:29080/hello_jaxws/HelloServiceService
A browser should return
Hello! This is a CXF Web Service from that url.
Finally, add ?wsdl to it to get the wsdl
http://localhost:29080/hello_jaxws/HelloServiceService?wsdl
You can find it also when you navigate to {your service} -> Service providers -> {your service} -> WSDL document (from additional properties).
Look there for "soap:address" element, and copy the "location" value/address to your browser with anding "?wsdl" to the end of it.
Our application sends file attachment to a web service using SOAP. The service is running on Oracle Service Bus 11g. We are using Spring WS + SAAJ + MTOM on client to send the request.
The application works fine on local and tomcat server, however, when we move the application to weblogic 12c server (war deployed), we see the following error when we hit the service.
BEA-382120 Error: Mixing of XOP/MTOM and attachments is not allowed!
It seems when it is deployed on the WebLogic the message no longer has MTOM enabled.
========================
Some additional information that might be helpful:
Spring WS configuration, libs used:
spring-ws-1.5.8.jar
commons-httpclient-3.1.jar
Thanks in advance.
After more investigation, it seems that weblogic overrides some of the classes or somehow confuses the classpath. In our case it was Saaj implementation. We had to add the saaj-impl-1.3.20.jar into our class-path and it worked. We also upgraded to spring-ws 2.2.0 and set the mtom to enable on the marshaller from the xml file.
You can also add this jar in your setDomainEnv.cmd file of your weblogic folder
set EXT_PRE_CLASSPATH=%DOMAIN_HOME%\lib\saaj-impl-1.3.20.jar
I have one final hurdle to get over with the web services application I am working with; I need to be able to override the default settings used to set the schema location and soap address location in the generated WSDL file.
When I deploy the application (GlassFish v2.1 on Red Hat linux) it uses the local server name in the URLs but it needs to use the public domain name instead. I was able to save the WSDL file locally, change the URLs, make it public, generate a test application externally from the file, and lastly was able to successfully run a test.
I have now journeyed into the realm of JAX-WS custom bindings but I'm hoping that I either overlooked a simpler solution or the bindings are not as complicated as they look at first glance. The web service implementation is through a stateless EJB (e.g. MyWS.java below). The generated WSDL file would look like MyWSDL.wsdl (see below).
In the xsd:import tag I need to change schemaLocation to
http://test.mycompany.com/MyWSService/MyWS?xsd=1
instead of
http://local-server-name/MyWSService/MyWS?xsd=1
and in the soap:address tag I need to change location to be
http://test.mycompany.com/MyWSService/MyWS
instead of
http://local-server-name/MyWSService/MyWS.
MyWS.java
#WebService(name="MyWS",
portName="MyWSPort",
serviceName="MyWSService",
targetNamespace="http://test.mycompany.com/")
#Stateless()
public class MyWS {
#WebMethod(operationName="testLogin")
public String testLogin(#WebParam(name="username") String username,
#WebParam(name="password") String password) {
String retVal = "Test Failed.";
//do some stuff
return retVal;
}
...
}
MyWSDL.wsdl
<definitions targetNamespace="http://test.mycompany.com/" name="MyWSService">
<types>
<xsd:schema>
<xsd:import namespace="http://test.mycompany.com/" schemaLocation="http://local-server-name/MyWSService/MyWS?xsd=1"/>
</xsd:schema>
</types>
<service name="MyWSService">
<port name="MyWSPort" binding="tns:MyWSPortBinding">
<soap:address location="http://local-server-name/MyWSService/MyWS"/>
</port>
</service>
</definitions>
I was able to resolve the issue by changing the configuration of the GlassFish HTTP Service. I set the server's alias name to test.mycompany.com:80 for the HTTP listener being used for the web services application. Typically we have this kind of configuration in our web servers so initially I didn't even consider the application server configuration.
How are you generating the WSDL? Are you generating it by hand? Are you generating it using wsgen with the -wsdl option?
If you're deploying with JAX-WS you shouldn't actually have to do either of those things. Instead you should be able to go to...
<SERVER_URL>/<CONTEXT_LOCATION>/<SERVLET_URL>?wsdl
...and the JAX-WS servlet will automatically generate a wsdl on the fly with the correct location.
Does anyone know of a really simple way of publishing Java methods as web services? I don't really want the overhead of using Tomcat or Jetty or any of the other container frameworks.
Scenario: I've got a set of Java methods in a service type application that I want to access from other machines on the local LAN.
Well, Tomcat or Jetty may be overkill for publishing just some methods as a web service. But on the other hand its not too complicated and they do the job, so why not?
I had a similar problem not too long ago and used a Tomcat together with Axis2. Just download Tomcat, unpack it, deploy the Axis2 WAR. To publish a webservice, there are several aproaches, the one I took is probably one of the easiest:
Just build your application as usual and annotate the web service class and methods with the appropriate annotaions from javax.jws.*. Package everything into a jar. Create a service.xml in the META-INF directory of your jar file and put this into it:
<service name="name of the service" scope="<one of request, session or application>">
<description>
optional description of your service
</description>
<messageReceivers>
<messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only" class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" />
<messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out" class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
</messageReceivers>
<parameter name="ServiceClass" locked="false">put here the fully qualified name of your service class (e.g. x.y.z.FooService)</parameter>
</service>
Rename the .jar to .aar and put it into the /webapps/axis2/WEB-INF/services/ directory. Start tomcat and the service will be deployed. You can check if it is running by visiting the axis2 page (http://localhost:8080/axis2/). There you will see which services are deployed and which methods are exported. Also you can get the WSDL url there to connect to your service.
Read http://ws.apache.org/axis2/1_4_1/contents.html for more about using Axis2. The approach I described here is not found exactly like this in the docs, but it works very well.
Update: If you just want to provide web services and really don't need any of the other features of Tomcat (e.g. serving of plain old web pages, jsps or other stuff), you can also use the Axis2 standalone server. But except for the setup part it doesn't change anything I described.
I've written a slightly more detailed version of this, which can be found at: http://www.slashslash.de/lang/en/2008/10/java-webservices-mit-apache-tomcat-und-axis2/ (don't let the German in URL irritate you, it's written in English)
Web services depend on HTTP. You might not want tomcat or Jetty. In that case, you have to implement HTTP yourself.
Erhm. Why not just use RMI?
Jetty's pretty lightweight. Otherwise, I think XML-RPC is your only sensible option.
The simplier solution than the one that Simon has discribed, ist to use the tools that alrady do that. If you use eclipse you could use http://ws.apache.org/axis2/tools/1_2/eclipse/servicearchiver-plugin.html
to generate the aar file.