How see wsdl using Struts 2 in browser - web-services

I have implemented a web service in my project. I also have deployed project on JBoss server successfully. I can see web service in jboss admin console in Web Service section. when i open wsdl url in browser it tells :
HTTP Status 404 - There is no Action mapped for namespace [/] and action name [AddNumbers] associated with context path [/TEST].
The url that i am opening in browser is http://localhost:8085/TEST/AddNumbers?wsdl
How map wsdl in struts.xml file?

This is because the struts 2 filter is configured to map those requests. You should add excludePattern constant to struts.xml to exclude some URLs from Struts processing. More about this you can find in Preventing Struts from Handling a Request.
Since Struts 2.1.7, you are able to provide a comma separated list of patterns for which when matching against the
request URL the Filter will just pass by. This is done via the configuration option struts.action.excludePattern, for example in your struts.xml
<struts>
<constant name="struts.action.excludePattern" value=".*\?wsdl,/some/conent/?.*"/>
...
</struts>

Related

Avoid redirect to HTTPS when calling orchestration as web service

I published a BizTalk orchestration as a web service with the BizTalk WCF Service Publishing Wizard.
When I try to reach the wsdl with this URL: http://machine.domain.dev/Scheduler.Orchestrations/Scheduler_Orchestrations_CallOrchestration_Port_Rcv_WCF_Scheduler_CallOrchestration.svc?singleWsdl
I end up with the Can't reach this page error and the URL is changed (by BizTalk ?) to https//...
When I replace machine.domain.dev by localhost it's working well and I can reach the wsdl.
In ISS, under Bindings options I only have http binding.
How can I reach the wsdl with the URL provided by IIS when I'm browsing (with http)?

Wsdl file changed on new server

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.

HTTP Failure , An error occured during URL invocation. ORA-12535: TNS:operation timed out

There is a REST web service that I can successfully call from POSTMAN (just as a side note, I have to include a bearer token for it to work.)
I was doing research on how to call a rest web service from Oracle APEX, and found I can do that by creating a WEB SOURCE MODULE. This is the first screen where I add the URL of the endpoint
However when I click on NEXT, it takes a while before giving me this error:
Again, on POSTMAN I can successfully make the GET request, but I haven't figured out how to do it in Oracle APEX
Note that for Oracle APEX the database is actually doing the HTTP request. A "TNS Timeout" error typically indicates that the database cannot reach the internet.
Did you specify a proxy server for your application (Shared Components > Application Definition Attributes > Proxy Server)?

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.

Consuming SAP Web Service in .net or sharepoint

I have received these three links from SAP team.
http://nmb.net:2525/sap/opu/odata/sap/empl/
URL for service document:
http://nmb.net:2525/sap/opu/odata/sap/empl/?$format=xml
URL for metadata:
http://nmb.net:2525/sap/opu/odata/sap/empl/?$metadata
If I open them in the browser I am getting this result:
<app:service xml:lang="en" xml:base="http://os0.nmb.net:2525/sap/opu/odata/sap/ZEMPLOYEERFCGEBO/">
<app:workspace>
<atom:title type="text">Data</atom:title>
<app:collection sap:deletable="false" sap:content-version="1" href="EmployeeCollection">
<atom:title type="text">EmployeeCollection</atom:title><sap:member-title>Bank</sap:member-title>
</app:collection>
</app:workspace>
<atom:link rel="self" href="http://os0wdddc.ores.net:8021/sap/opu/odata/sap/ZEMPLOYEERFCGEBO/"/>
<atom:link rel="latest-version" href="http://os0wdddc.ores.net:8021/sap/opu/odata/sap/ZEMPLOYEERFCGEBO/"/>
</app:service>
Is this the wsdl that we normally get? How do I format the URL above to get some data back as I would normally get when I create a custom service in .net and view it in browser?
Edit 1:
If I use the provided URL and I add service reference in visual studio project, I get:
Operations: WCF Data Service: No operations found
It's fairly simple. Open your metadata – by opening
http://os0.nmb.net:2525/sap/opu/odata/sap/ZEMPLOYEERFCGEBO/?$metadata
in your browser – and then append the names of entity sets at the end of URL. See few examples here and here.