Wsdl file changed on new server - web-services

We have deployed our webservice in liberty server.Earlier it was on IBM WAS. After deploying in liberty, we came to know that Webservices is running on CXF webservice framework. In WAS, it was Axis framework.
Another difference is that , changes happened in wsdl url & content. The old wsdl url is http://localhost:8080/Hello/HelloServices/Helloservices.wsdl and it contains xsd schema definition.
In the liberty server above wsdl url is not working and throwing file not found. But if we try to invoke http://localhost:8080/Hello/HelloServices?wsdl it's working.
Could anyone tell why old url is not working in New server. Is it due to server or inbuilt cxf framework in server.
Another team is using wsdl url to consume this webservice, with this new url they are not able to achieve it.
Any thoughts or suggestions are appreciated..
Thanks in Advance

The main reason for this is the change in the JAX-WS implementations used by the different WebSphere profiles. CXF, unfortunately, hard codes the WSDL url to append ?wsdl in several locations and so this is something that is not possible to change in configuration. The easiest solution would to add a ServletFilter to check the incoming request url for http://localhost:8080/Hello/HelloServices/Helloservices.wsdl and then redirect the request to http://localhost:8080/Hello/HelloServices/Helloservices?wsdl.
There's a good SO post that shows how to write a ServletFilter to redirect here:
How to use a servlet filter in Java to change an incoming servlet request url?
The other option would be to have the client side update either their code or configuration to account for the change to the WSDL URL.

Related

TomEE server is not passing web service request to the webmethod

I am new in the area of SOAP Based web services. I am using TomEE server. The server is a bit customized according to my organization's need.
Few days back, when I was trying to run the web services example from TomEE website, I was able to generate the wsdl and calling the web service by a client.
Now, when I need to use the customized version of TomEE plus (by the organization), I can see that the request does reach to the server and hence there is a log entry also but my #WebMethod is not getting executed.
Does any one has any idea about any configuration which can prevent the request from reaching to the webservice method? Is there any pointer around how can I debug further to reach out to the root cause of this issue?
Without further information about what is customized it's like fishing in the dark.
I would guess that perhaps the global web.xml or the server.xml of tomee server is changed so that some URI context mappings are not forwarded or ignored. But it's only a lucky tip.

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

User defined log files for SOAP requests and Responses in Websphere 8

I have a Soap based web services running in websphere 8. Since we have he trace.log, which have the Webservices request and response XML. I am trying to log it to a different file apart from trace.log.
To be very precise, If my service is HelloWorldService. I would like to log the SOAP requests in service_helloworld.log. I have defined the appenders and loggers in log 4j already. But I am looking into a way where I could configure websphere to redirect the webservices traces to that file.
I still could write a interceptor, but I am trying it in websphere configs. Please help
I don't know if you still have that problem... But I had the same one and I just fix it implementing a GenericHandler that interceps the request/response.
Take a look:
http://www.ibm.com/developerworks/websphere/library/techarticles/0511_phung-lu/0511_phung-lu.html

How can I get Fiddler to display information about a web service request made from my ASP.NET code behind?

I have an ASPX page. When the page is loaded there is code in the code behind that uses an API. The API makes an HTTPS call out to a third party, commercial web service. I am trying to troubleshoot why the API calls are not working properly. Apparently the API actually constructs an XML request that is sent out over HTTPS to the web service. I've been told by the support rep that I need to provide them with the XML that is being sent. The only way I can figure out how to get the XML is to use a tool like Fiddler to see what is being sent out. So how can I use Fiddler to see the contents of the XML request that is being sent from the server out to the web service? I am running everything directly on the server but all I am seeing is the GET request for the ASPX file itself. I am not seeing anything in relation to the HTTPS request that the server code is sending out to the web service. I have not used Fiddler much so I am hoping that maybe I just don't have it set up right to monitor that traffic.
Corey
After mucking around with it a bit I found this post: Why isn't fiddler capturing request when invoking XMLRPC from iis?. That seemed to do the trick! Basically it sounds like the default proxy settings in Win7 are on a per user basis. So I went in and changed the identity of the AppPool for my site to a local user (Administrator) and then it worked great. I started up Fiddler. Then I started up my ASP.NET app and then when I loaded the page I saw the request that went out to the web service from my code behind! Yay!