I have a web service client (JAX-WS) and the stubs have been created using the wsimport tool.
Now once the client is packaged as an application, the location of the service (and only the location )changes.
Do I have to re run the whole ws-import tool once again to create new stubs for the new location.
Is it possible to move the WSDL location to a Config so that the application do not have to be built again! I am working with net beans 6.5.
I suppose DII is an option, but is there a solution to make the code independent of the WSDL location.
You may package the WSDL locally in your application (which is also reasonable for performance, since you're saving requests to the external file on runtime), see developing client application with locally packaged WSDL
Related
i have a legacy webspere soap web service provider to be migrated to tomcat.
soap service is using IBM native libraries, any suggestions? can i reuse the existing wsdl file from this project? and what is the best approach to achieve this? considering consumer should'nt make any code changes other than the service url.
One way to do this without changing anything would be to move your war file to Tomcat. Identify the native jars that are being used. Place these jars in tomcat's lib. This approach requires minimal code change.
WSDL files are not technology specific and you can reuse it. You can even re create the web service skeleton using the WSDL file but that would still mean writing the code for Business logic. See if this is what you want :-
https://wiki.eclipse.org/Creating_a_Top-Down_Java_Web_Service_Skeleton_from_a_WSDL_Document
I have a python client (ubuntu) which calls the following web service:
http://xxx.xxx.xxx.xxx:8774/v2/8d118e773c6a44c88f64960c1177ede6/getNodes'
Both client and server are located on the same machine.
How can I find to which working directory this web service (which my client is calling) is pointing to?
(I don't know the source of the web Service. All I know that it is running on the same box and its url. How do I get to the source with these two clues?)
Since it is Ubuntu, you can find all the configured Apache hosts in /etc/apache/sites-enabled. One of the files in there will be your web service, and will specify its directory.
I need to consume a secure webservice deployed in WSO2 AS from another web service develop in axis2 and deployed in apache tomcat.
I create a java project to test the secure webservice client and I work OK.
But when I move the client code inside the axis2 service I cannot access to some resources like in this cases:
System.setProperty("javax.net.ssl.trustStore", "keys\\store.jks");
in this case I have the keys folder in the root of the wb services
sc.engageModule("rampart");
and in this case I leave the code idem
Any idea about this?
Well getting a resource path from an archieve file whether it is a jar ,war or aar is a tedious problem. There are two options two choose from:
1- Since client application runs on a servers put jks file somewhere on the server path, its path retrieved dynamically via property. (Either system property, servers context etc.)
2- A customSSLFactory handling loading keystore from resources.
This SO thread mentions such solution, which i used it too to connect to server via SSL from a web service without touching system properties.
I have added a jax-ws-catalog.xml to my .war file in order to resolve the schemaLocation locally instead of remotely in . I've followed the example at
Metro User Guide: 2.10. Developing client application with locally packaged WSDL
When I deploy the .war and use soapUI to validate the web service it gets stuck trying to access the schemaLocation http://somehost:8080/CMDB/schemas/common/1.0/CMDBCommonTypes.xsd
The schema and wsdl both validate in Eclipse (using XML Catalog tool for Eclipse). (I can post the contents of my jax-ws-catalog.xml and the relevant xsd and wsdl if that will help.
A Google search turns up lots of other problems with jax-ws-catalog.xml not working in the Metro stack.
Has anyone gotten a jax-ws-catalog.xml to work in Metro?
Where are you placing the jax-ws-catalog.xml and the WSDL files ?
You mentioned that you're using a WAR, but within a WAR the location of jax-ws-catalog.xml depends on whether you're trying to access it as a WS client or as a WS Endpoint publisher (server).
If you're accessing external Web Services from within your WAR, then your jax-ws-catalog.xml needs to go in app.war/WEB-INF/classes/META-INF directory,
Alternatively if you have a contract first web service deployed within your app, and that has the #WSDLLocation annotation, then for that WSDL, jax-ws looks for jax-ws-catalog.xml in app.jar/META-INF
So for client WSDL location app.war/WEB-INF/classes/META-INF/jax-ws-catalog.xml
for contract first WS Endpoints with #WSDLLocation annotation the app.war/META-INF
If you want to do both, i.e. publish (contract first) as well as consume Web Services, then you need to put jax-ws-catalog.xml + WSDLs in both the locations, i.e. app.jar/WEB-INF/classes/META-INF and app.jar/META-INF
I have successfully used the above approach in many of my projects, which simultaneously publish as well as consume web services, and I can guarantee it works as expected.
I've created an app that interacts with a SOAP service using java WS. I generate classes and manage the WSDL using the built in netbeans functions.
Every time I run the application, it has to download the WSDL and parse it again. The WSDL is frozen at each version so I don't think this is necessary. I've tried to reference it as a local file, but then my app complains it can't find the file when it's installed on another machine.
Does anyone know how I can stop Java WS needing to re-parse the WSDL, or at least cache it locally?
I've figured it out...
This page has the info
Developing client application with locally packaged WSDL