Where to put a configuration file for an Axis2 web service? - web-services

I'd like to have my Axis2 Web Service read from a configuration file, whose name is sent as a parameter to the service.
Where is the best place to put this file? And How to best access it? Examples welcome.
I've checked the current directory is the Apache/Tomcat/bin file, I could put it in the parent directory, or put it into a Apache/Tomcat/conf, although this looks like it's more reserved for apache configuration itself.

You don't want to load a configuration file on each request, which means configuration needs to be loaded ideally on startup.
In my experience that leaves you with two choices:
Embedded Spring container
JNDI
The former approach is described in the Axis2 documentation, the latter approach depends on the appserver/container you're using.
An example if JNDI configuration for jetty is here:

Related

dropwizard and jetty-config files

Where do I have to put jetty specific configurations in dropwizard, such as
jetty-context.xml
jetty-env.xml
...
?
I do not have a src/main/webapp/WEB-INF directory, so what do I do?
You don't.
Dropwizard encapsulates most of the jetty configurations on its YAML configuration file. Reference
For others (context etc.) dropwizard has its own way of handling them programmatically. I highly suggest going through dropwizard's Getting started document as well as the user manual.

Can I generate a wsdl file without binding and service information?

I came across an issue where a customer is able to open a SAP wsdl using net-beans as well as in .Net but not in soap UI.
When i checked the wsdl i found that service as well as binding tags are not defined or no such tags included. wsdl ends with port-type information.
In soap UI i got an error like no content in the file and when i try to open it in eclipse i am able to open it using web explorer window, but service as well binding information fields are empty. I could see ws-policy elements in customers wsdl.
How he might have produced a wsdl without binding and service information ?
What would be the reason he is telling it is working in .Net?
I am not sure about .Net tools.
Is there any web service client tool which can open the operations without endpoint /service information and send request/response ?..
please help
thank you for your time.
I only know a bit about the first question, can't help you with the other ones...
You can request two "flavors" of WSDL from a NW/ABAP system. This is related to the fact that the implementation (programming) of the service is usually performed on a different system and by different people than the configuration of the service.
After the service (or rather a service definition) has been implemented, you can get what's called a "design-time WSDL document". This document does not include the endpoint information - it cannot, because that would require technical information about the target system landscape and its configuration that is simply not available yet.
From the service definition, an administrator can create a configuration. This includes the binding information as well as stuff like base URL, security settings, transport layer settings and so on. With this configuration, you can generate a second WSDL document that contains the actual endpoint configuration.

Migrate files from one esb to other

I have created few proxies, sequences and endpoints in wso2 esb in my system. I want to transfer these proxies, sequences and endpoints to another esb hosted at server. How to do this successfully?
Looking forward to your answers. Thanks in advance.
Lets say you have your first ESB located at ESB01_HOME directory and it contains all your defined proxy services, endpoints and other configurations. Now you took another fresh copy of the WSO2 ESB and extract that to a folder called ESB02_HOME.
You can copy the configuration files which were stored in ESB01_HOME/repository/deployment/server/synapse-configs/default (entire folder) in to the same directory in the ESB02 (ESB02_HOME/repository/deployment/server/synapse-configs/default). Now you can start the ESB02 and you can observe that all the configurations are installed in the ESB02.
If you are starting both the servers (ESB01 and ESB02), then you need to change the Offset parameter of the ESB02 carbon.xml configuration file which is located in the (ESB02_HOME/repository/conf/carbon.xml)
If you are copying the configurations from an older version of WSO2 ESB (3.x.x) then these configurations are located at ESB01_HOME/repository/conf/synapse-configs folder.
If both are in a clustered setup you can use deployment synchronizer/registry based synchronizer..If both are separate instances, copy the synapse-config folder(inside that, you can find proxy/seq/endpoint folders) to another home directpry
you can use the checkin-client tool inside the GREG.
With this tool you can move information from registry in ESB1 to registry in ESB2. information like dynamic sequences and endpoints for example.

What does wsimport do with jax-ws-catalog.xml?

All of the documentation I've found online about wsimport seems to be a little vague about one aspect of using a catalog file (jax-ws-catalog.xml). My question is:
When I generate a web service client using wsimport and the -catalog option, does wsimport only use my catalog during build time in order to find the WSDL it's using to create the web service? Or does it also somehow bundle the catalog into the generated web service so that the catalog can be used to locate resources during run time?
I'm guessing that wsimport only uses the catalog file to resolve resources during build time, and that if I want to use a catalog file to resolve resources at run time, that I have to bundle jax-ws-catalog.xml with my web client, but again, the documentation I've found so far seems a bit unclear, I'd prefer to hear this confirmed explicitly by someone who knows better.
UPDATE: I'm using a Maven plugin to generate my web service classes (http://mojo.codehaus.org/jaxws-maven-plugin/wsimport-mojo.html).
Let me know if anything in this question is unclear and I'll edit to add more information.
#dbisdorf --> yes , when you use -catalog option the with *catalog.xml file , that file is copied over to the WEB-INF or META-INF dir of the Java EE project. This will be used to lookup refernece # Runtine .If you don't wish to use it you should specify genRuntimeCatalog=false.
This is clearly documented in the following link : http://docs.oracle.com/cd/E13222_01/wls/docs103/webserv_adv/xml.html

webservice source in web.xml

How I can get my web service client (in a web application) uses the web.xml file to get the source of the wsdl?
I am using netbeans 6.9 and tomcat, and so far we have in our web application a web services references with the url of the wsdl.
I do not recommend to store such resources in web.xml, because they can be changed in future. For e.g. if the web service which is deployed in http://theaddress:8080/webapp?wsdl will be migrated to some other server and URL will change. Then you have to modify your application in which case it is not very efficient way.
I would suggest JNDI to store resource like this. Read how to do this in Tomcat, it is not hard to set up.
The alternative is to use .properties files, but I'd rather choose JNDI over .properties.
If it must be the web.xml, you can configure a context parameter(like any other) like:
<context-param>
<param-name>webservice.Location</param-name>
<param-value>http://theaddress:8080/webapp?wsdl</param-value>
</context-param>
After configuring as above (the Webservice.Location) is an arbitrary variable name you can change to suit your needs. If you're not using any add-on web application layers like JSF or Struts etc, you can now reference this variable(from the HttpServletRequest object) like so in a servlet
String webServiceAddr = request.getServletContext().getInitParameter("webservice.Location"); //getServletContext() will give you an instance to a ServletContext object which basically is a representation of your entire web application deployment environment including configuration files.
The variable webServiceAddr will now contain the configured value
I advise though you externalise such a config to a standard .properties file as it's a little bit risky having a deployer mucking about with other configurations in your web.xml while trying to set it up. It's also best practice in configuration management for applications. A small tutorial on properties files here