I wish to consume a SOAP webservice from the Govt. of India public data sets. Here is an sample URL:
http://data.gov.in/sites/default/files/Fish_2013.xml
I have been using REST APIs and have never used a SOAP one.This is a SOAP webservice and it does not give me any information about the wsdl file location. As per my understanding I can generate a client using the WSDL if available and use it but how do I use a SOAP API without WSDL.
Most of the other posts talk about changing the response format but then its not possible in my case.
You can do 2 tricks:
install a local webserver
map the localhost/yourproject?wsdl to that xml file
use a Soap client generator tool on that wsdl link ( some allow other links wich doesn't end at wsdl some doesn't)
use the generated artifacts to consume soap.
Related
There is a requirement by our client to create XML request messages from the WSDL file. The WSDL file has some 50 requests and responses. I am able to host to port 8080 the WSDL file and get response in SOAP UI for each request.
How to create those XML request and response messages(seen in SOAP UI)? Is there any SOAP UI jar files available to do the same work as SOAP UI?
The WSDL and XSD files are available and I am able to generate classes.
One option is to compile the wsdl into java classes using the wsimport utility, which can be invoked via various maven plugins, like the cxf-codegen-plugin if you're using maven or gradle. This will generate JAXB classes that represent requests and responses and JAXWS classes representing the actual services. You would use the generated classes to create request objects, call the web service operations, and receive responses back, all completely in java.
I was wondering if it was actually possible to create a Java SOAP Webservice without using it's WSDL.
Context:
The idea is that I have to mock a webservice, so I have its WSDL. The mock will only read the soap request, search if there are any similar request (as key in a map) and send the matching response (as its value). This is for automated testing purpose. The problem is not the "map" part.
Anyway, I've been using Axis and eclipse to generate classes and files and load them in tomcat from the WSDL. So far it've been a mess, with a lot of compatibility issues between these components. And it's gonna be much more difficult to compare the input or serialize the output to do what I want this way.
I thought about creating a REST endpoint and send the soap request through it (so I would directly get the SOAP request !), but I rode somewhere that soap request weren't valid and wouldn't be retreived by the REST endpoint... Also, won't the client application throw an error if there is no WSDL at this address ?
My question is:
Is there a way to create an access point, that looks like a SOAP Webservice (from clients), but which allows me to get the full soap request (as a String for example) and send a response (still as a String) inside a Java app?
Complements:
I'm looking for something, a library, maybe just an annotation on Servlets, that doesn't needs (if possible) to generate a huge load of classes and xml files everywhere. The app would be running on tomcat (but I can be a basic Java app). Using maven and spring wouldn't be a problem.
Thanks in advance !
Normally, clients do not require an WSDL. But it is a nice feature - use a normal servlet and handle the "?WSDL" manually. Then use some simple XPath or parse logic to extract the payload as a DOM document.
I am trying to implement a soap ws client in my java application. I have a WSDL file to generate the client stubs. When I implemented the code, I saw that the WSDL file is out of date and I can not get the response as expected in the WSDL. I do not have an option to make the vendor update WSDL.
What are my options to implement the client properly?
Is it possible to fix the WSDL manually or intercept the response before generated codes receive the response?
Thank you.
You can always get the most updated WSDL by accessing the URL from the browser. Since you are able to communicate with the server application I assume you have the server application endpoint.
The URL should be simller to the folliwng
http[s]://(IP or Domain Name)[:port]/.../...?WSDL
Here is an example for a common WSDL online for global weather as an example of how WSDL URL look like
http://www.webservicex.net/globalweather.asmx?WSDL
Additional Details:
You can re-generate the stub classes from WSDL URL directly using many tools like:
Axis
Code Generator Wizard Guide for Eclipse Plug-in
Code Generator Tool Guide for Command Line and Ant Task
Apache CXF
Generate a JAX-WS Web Service Client from a WSDL document using Apache CXF
I have to request a PHP page with 3 Parameters (e.g. www.test.com/index.php?name=mrTest&no=1&id=10001). I'm using WSDL2JAVA for other Services and am now wondering if it is possible to generate a similar Service for this case. This PHP page Returns an XML. I'm just consumer/client of the Service.
I could also make a simple request and then use JAXB to parse the XML but i would like to implement all my Services the same way.
So, does anybody has already implement a php page consumer using WSDL2JAVA?
Best regards
So from my understanding this is a simple PHP page not a SOAP service. Remember XML is just the protocol used in a SOAP service however a SOAP service consists out of a WSDL that is published describing operations and how to call those operations.
A simple PHP page even if it returns XML data is NOT a SOAP service and thus does NOT have a WSDL. You wont be able to use WSDL2JAVA for that.
This PHP page seems more like a REST type service that returns XML instead of JSON. To be honest it really sounds like a REST service.
Try using the latest SOAPUI to connect to the page and see if you can use the REST project type with this page. If it is a REST service it might have a WADL file. YOu can use the WADL2JAVA cxf utility to generate classes to you. HOwever this is a BIG might as most REST services dont use WADL's yet. See this link on CXF
I have a WSDL file, and also i can retrieve the XSD file as well, in a server. i need to read either WSDL or XSD and generate a SOAP request accordingly in Android.
Thanks !!!
Use can kSoap for SOAP request.Please check my answer to this thread.