I want to consume a web service of which I have the wsdl. I am using spring-ws and want to use marshalling/unmarshalling (jaxb) to convert xml to java and vice versa. How can I get the jaxb classes from the wsdl. Do I need access to xsd which in this case I don't have. Can I use a tool like trang to do the work?
look here http://blog.dawouds.com/2008/09/maven-2-wsdl-to-java-using-jaxb.html
You can use the tool Apache CXF to create a Web-service client in Java from the WSDL. Follow the official page: http://cxf.apache.org/docs/developing-a-consumer.html
Related
I am generating the client side classes for invoking a
WebService. When i invoked the webservice it is not working and I came to know that the server side is not accepting the namespace in the soap body. ( if i didn't pass the namespace in soap body it is working) Is there a way i can override the targetnamespace in the client side WSDL.
Thanks
Sam
First and easy way is updating client side wsdl with proper ones. If you generate your client automatically on runtime it will fix your problem.
If you already generate java classes using that WSDL, and you are using that client to connect services, you can still re-create java classes and update your class path.
And if you do not want to regenerate java classes, you can update each jax-ws and jaxb annotation with new targetnamespace.
I'm using JaxWs Metro project implementation and i'm using this tutorial to add Ws Security feature to my web services.
http://java.globinch.com/enterprise-java/web-services/jax-ws/secure-usernametoken-java-web-services-using-metro-wsit/
What i have understand is that to add a Ws Security to your web service.You must first generate manually the wsdl file then add WSIT configuration part to your web service then put that modified wsdl in your project and modify sun-jaxws.xml so that take care of your modified wsdl file(so that it will not generate a new one).
I think it's extremley difficult to do all that for all my web services.In addition,i'm using eclipse so there is no generating tool(like netbeans).
I want to know is there any simple solution ?
Hi there i have a need to create a soap implementation of a wsdl first
soap service. Is there any howto on how to achieve this inside a
grails project?
I have to create a server implementation of a wsdl.
This is possible with the new cxf 1.x plugin. Check out the example in the cxf test source:
CustomerServiceWsdlEndpoint.groovy -> https://github.com/thorstadt/grails-cxf/blob/master/grails-app/endpoints/org/grails/cxf/test/CustomerServiceWsdlEndpoint.groovy
CustomerService.wsdl -> https://github.com/thorstadt/grails-cxf/blob/master/src/java/org/grails/cxf/test/soap/CustomerService.wsdl
Let me know if that doesn't meet your needs.
I have been handed a .WSDL file which I need to test within a Grails Framework.
Any suggestions how to go about this.
Take a look at the http://grails.org/plugin/cxf and http://grails.org/plugin/cxf-client plugins. They're easy to use and backed by Apache CXF - https://cxf.apache.org/
The client plugin has a wsdl2java script that will generate code that you can use in your Grails app.
You could start with documentation itself: http://grails.org/Calling+External+WebServices
I read somewhere here on stackoverflow that using NuSoap is not a good idea and its dead. If it is, what is the best possible solution to create WSDL files. I was just nusoap just for creating wsdl files and I never got the webservice to work
NuSOAP isn't being developed any more and hasn't been for a while.
I have looked at most of the current PHP Soap options, and settled for Zend_Soap_Server, specifically because of its AutoDiscovery component.
The main point about AutoDiscovery is that the WSDL is generated from the docblocks within your code. So as long as you follow the correct conventions, the component will build a well-formed WSDL for you.
If you don't want to use a framework, you can just include the files Server.php, AutoDiscover.php and Wsdl.php. I do it like this;
require_once 'Zend/Loader.php';
require_once "Zend/Loader/Autoloader.php";
$autoloader = Zend_Loader_Autoloader::getInstance();
Zend_Loader::loadClass('Zend_Soap_Server');
Zend_Loader::loadClass('Zend_Soap_AutoDiscover');
Zend_Loader::loadClass('Zend_Soap_Wsdl');
It's also worth remembering that AutoDiscovery alone IS NOT a SOAP server, it just generates your WSDL. So in theory, you could probably use it to create a WSDL, but use a different SOAP server if you wanted to i.e. the native PHP one (which does not generate WSDL). However, as you will have loaded up the Zend Soap Server it would seem a bit wasteful not to use it IMO.
If you're working with PHP4, it might be your only alternative.
With PHP5, you can use Zend Soap. http://framework.zend.com/manual/en/
I'm using Nusoap with php 5.2.5. Working great for me. But I never tested it with higher veersion.
Same as MacMan, I am using with php 5.2.17 and it is working great, easy that native PHP SOAP, I guess.