Can any one please let me know what is the method to generate WSDL in Apache CXF Server using original WSDL.
I know Axis 2 has a configuration in Service.xml to set useOriginalWSDL to TRUE and I get the original wsdl.
I want to know the setting in CXF.
For using the original WSDL to generate WSDL in CXF Server we can use the attribute wsdlLocation in the element jaxws:endpoint
The attribute ,Specifies the location of the endpoint's WSDL contract. The WSDL contract's location is relative to the folder from which the service is deployed.
OR
in CXF we can use #WebService annotation we can specify the WSDL location Please refer the documentation
about #WebService
I myself found the answer, I think this is a simple question, but felt that this answer can be in stackoverflow
EDIT:
Eventhough I added wsdlLocation , the service could not be created by CXF framework. Errors in apache tomcat are not that helpful, except stating that Service could not be created.
For proper working jaxws:endpoint should have following attributes:
wsdlLocation - relative path from the project folder e.g /WEB-INF/originalwsdl.wsdl
serviceName - service name in the WSDL, with namespace specified in wsdl e.g e:ServiceName
endpointName - this is the port binding name, same rules as serviceName e.g e1:endpointName
Remember to define the namespaces for e: and e1 by xmlns:e="namespace as in your wsdl"
After all this setting my application worked.
The classes we create from wsdl should have the same package name as target name space, for creating exactly same WSDL using original WSDL. Please someone confirm this finding.
I found that there is very little documentation for CXF, and had to
dig in the code and xsds for my solutions
Related
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.
I am seeing one behavior while accessing one wsdl. I used Apache Axis 1.3 as well as JAX-WS wsimport tool to generate client stubs, it is successfully generating stubs.
But when I am using apache-cxf-2.7.18 and using wsdl2java command, it's not generating stubs, giving me error.
WSDL is on https. I added proxy in wsdl2java bat file as well. wsdl contains a which is also on https.
Error I am getting like:
enter image description here
It seems to that it's not able to include underlying wsdl.
Can anybody give me any pointer what I am doing wrong?
I believe, when I am doing any service publishing, it can not be client implementation specific like it is supported by Axis but not CXF. or I can do that? Is there any restriction that could be applied?
(Solution in comments)
The error log shows a connection error when downloading the WSDL, probably due to a misconfiguration of the proxy in wsdl2java when using a SSL connection through maven
Maven is not is not able to download imports using the proxy configuration, since you have downloaded the wsdl, you can also download all referenced url resources to local files and change <wsdl:import location= to use each local file. Use a relative path ./yourfile or a URL format file://path/to/the/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
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.
I have down loaded WSO2 ESB Version 4.6 and started the server. Clicked on proxy service. There I have selected WSDL Proxy option. It is asking the following for creating proxy.
Proxy Service Name* OpportunityService
WSDL URI* https://crm-aufsn4x0ruf.oracleoutsourcing.com//opptyMgmtOpportunities/OpportunityService?WSDL
WSDL Service* https://crm-aufsn4x0ruf.oracleoutsourcing.com:443/opptyMgmtOpportunities/OpportunityService
WSDL Port* 443
I just want consume this external web service via ESB. So I dont want publish. Did not configure any publish related fields. Now When I click on create it throws exception "Failed to add proxy service: OpportunityService. Check whether the Proxy already exists
". But I am sure that there is no existed service with that. I have tried with different names but the error is same.
I suspect that may gave values wrong for fields WSDL Service and WSDL Port. If click on Test URI its giving success.Can any one please suggest where I am doing wrong.
Thanks&Regards,
Raghu
For wsdl service parameter you need to give the <wsdl:service name>which you can find in the particular wsdl itself. I dont think it will be a URI like you have mentioned above. Likewise for port you can find the <wsdl:port> parameter in the wsdl.