Different WSDL after creating the web service from a WSDL - web-services

I have a wsdl and can create the server from it in various ways. But I need the wsdl generated by the web service is just like the original wsdl.
I have the .wsdl file and generate the .asmx file (for example using the wsdl.exe)
When caught the URL localhost/MyWS.asmx?wsdl the wsdl generated is not equal to the source.
It is possible that the wsdl is equal after the generated webservice?

Related

Why is there no need for wsdl in grails web service?

I have a project where we have developed the webservices using grails.
Here we have given the mapping in URLMappings.groovy and have controller and Services defined along with domain clasess.
When we get a request we generate an xml or json response based on the request.
Here we have not used any wsdl file.
Can anyone explain how this works in background and why we don't need a wsdl here?

SOAP web service without WSDL at the end of URL

I have a web service deployed on Jetty. I use the SOAP UI to call it via link like http://ip:port/DefaultRequestListener?workflow=WsdlCPF&soapAction=Import and it works.
I have always worked with service which had ?wsdl at the end of url, but now I confused.
Why there is no ?wsdl at the end of url?
A Web Service endpoint usually has an url that looks like this:
http://server:port/services/myservice
It does not have a wsdl parameter. This is the url of the web service itself, the one that will be called by the clients.
Most web service frameworks have a convenient feature in which they map the url of the endpoint with a wsdl url parameter to a webpage that shows the content of the WSDL for that web service. So this url:
http://server:port/services/myservice?wsdl
Is like telling the server: "Show me the wsdl file for this web service endpoint". The content that you see in that webpage is not a wsdl file stored in disk, it is just the content of the wsdl generated by the framework.
This feature is very useful because if we want to create a client for that web service we don't need to go ask for the wsdl file, we can just go and fetch it from that url.
In SoapUI
All this means that in SoapUI you would create a new project and tell him that the wsdl file can be found here: http://server:port/services/myservice?wsdl. If you tell him that the wsdl file is: http://server:port/services/myservice it will throw an error as that is not a wsdl file.
Alternatively you could enter the location of the wsdl file that you have in disk instead of the url and it should create the same ws client.
Then SoapUI will read the wsdl and he will see that the endpoint for the web service is http://server:port/services/myserviceso this is where he will send the requests.
Your web service
In your case, since you are already passing url parameters to the endpoint, you can consider that your webservice will be called at this url:
http://ip:port/DefaultRequestListener?workflow=WsdlCPF&soapAction=Import
And if you want to see the wsdl for that web service, you just add a wsdl parameter to the url. Note that just as any other url query the symbol ? just denotes that the url ends there and next characters are url parameters which are separated by &. In your case you have 3 parameters (workflow, soapAction and now wsdl):
http://ip:port/DefaultRequestListener?workflow=WsdlCPF&soapAction=Import&wsdl
now it returns a text like Company type: blah blah... Region: blah blah...
This is the wsdl content, which of course includes the xml types used in the web service, all normal.
Maybe it looks strange to you because in the wsdl file you have in disk it does not show all these types and instead it imports the xsd files that contain those definitions. The wsdl you see in your browser will never have imports like that, and will always show all the types embedded in the wsdl file.
Scroll down past all those types definitions and you will see the rest of the wsdl.
I hope it helped to make clear that the url with ?wsdl at the end is not the web service and it's just the wsdl content.

Which is better to generate the WS client from the WSDL URL or from the WSDL file?

I am using a wsdl file sent to me via email to generate a WS client application but I wonder if it is better to have the WSDL hosted on a server and to use an URL to request it.
Actually, I requested the URL but apparently this WSDL don't have one and I can ask to create an Url for the wsdl if it is really necessary.
Can you tell me please what are the benefits of using the WSDL Url to create a WS client ?
There is not difference for you how to generate WS client. In both cases this is just WSDL document, no matter where it located is.
I see only one benefit direct accessible WSDL against WSDL file - WSDL will be always actual and and all web service changes will be reflected to WSDL document.
If you using axis 2, you can try call your webservice with ?wsdl suffix to get WSDL document
if this your webservice url
http://localhost:8080/axis2/services/StockQuoteService
This is wsdl location
http://localhost:8080/axis2/services/StockQuoteService?wsdl

Keep original wsdl in jax-ws

How can I expose a webservice keeping the original wsdl file?
I have a wsdl file and I generated the stub classes from that file, then I implemented the service, but when I deploy in my Weblogic server, the generated wsdl file is not the same as original wsdl file.
For example, the generated wsdl has different Binding name, Port name, xsd url changed, etc, and I need keep the original wsdl due to client request.
Is possible provide the original wsdl to jax-ws? I tried using the wsdllocation property from WebService annotation too, but it doesn't works.

Will JAX WS Web Service generation always create XSD file

I am using RAD 7.5 to generate WSDL from java service class using JAX-WS. My Server is WAS 7.0. I am not able to see any option in RAD to exclude the XSD generation and include the request & response type object details in WSDL itself.
Is this possible to create a WSDL file which will also hold the request & response object detail using JAX-WS? I dont want to have XSD file.
I am new to Web Service, please let me know if I am thinking something rubbish :)