Is there some tool available or code or library to convert rpc/literal wsdl to document/literal style
you can combine your soapui with apache axis v1 and v2 to work with the RPC WSDL service. I used axis v1 to generate java code from the RPC WSDL service easily.
Related
In the wsdl_first sample of Apache CXF the pom file puts the wsdl file in WEB-INF/. Also all the xml files and the wsdl file in src/main/resources ends up in WEB-INF/classes, because they are in src/main/resources.
I deploy the webapp in tomcat.
My question is: when I remove the wsdl file from WEB-INF and the xml files and the wsdl file from WEB-INF/classes (and restart Tomcat), the webapp still works. Why does the pom file put the wsdl file explicitly in WEB-INF? And why are the xml files and the wsdl file in WEB-INF/classes?
In src/main/webapp there are web.xml and cxf-servlet.xml. They end up in WEB-INF/. When I remove them, things go wrong.
So remember a WSDL is the official definition of a service interface. In other words if you want to create a client for a SOAP service you need a WSDL. You can use this WSDL to then generate code artifacts for the client. It is almost exactly similar to generating a server from a WSDL.
Now the WEB-INF folder is published and when the WSDL is in there it is published too. This will allow clients to get to the WSDL. However the WSDL is not needed for the service to run. Thus we can remove the WSDL.
You would typically remove the WSDL when you secure a service against public browsing. This will remove the ability for anyone just to get hold of the service definition.
Remember the WSDL is just a definition used to generate artefacts in various languages such as Java, .Net etc.
However it is not required for a SOAP server or client to run. Just for code generation.
Can I have a web deployment descriptor file, web.xml, with a Jersey project that runs on top of a Grizzly container? I want to constrain my resource to ensure that input is provided, using #NotNull.
Some context...
I'm using Jersey 2.19 to implement a REST API.
Following the 'Getting Started' section of the user guide I successfully created a new Jersey project that runs on top of a Grizzly container using a Jersey-provided maven archetype.
I have also successfully implemented some bean validation by annotating a resource with various built-in constraints.
I would like add a #NotNull constraint to my resource and for it to mean that input is required - i.e. for an empty string to fail this validation constraint.
The Java EE tutorial refers to making a change to web.xml but there isn't one in my project. I see from the user guide that if I'd created a JavaEE web application instead then the web.xml file would be present.
Can I add one? Or is there another way to validate empty strings in the way I want?
UPDATE
Chapter 18 of the Jersey User Guide does not tell me what I need to know. The Java EE tutorial indicates that I need to set javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL in the web.xml file. What is the equivalent of that if I don't have a web.xml?
javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL is a JSF parameters so it will have no affect on Jersey. Since The default implementation for bean validation with Jersey is Hibernate Validator, you can use it's annotation #NotEmpty. It should serve similar purpose as the JSF parameter (to fail on empty strings).
I have to create simulator where on run time WSDL files can be generated if XSD file is given as input. For this i am using Spring Web Services and JAXB API to generate WSDL from given XSD file.
After all the sample programs , i have understood that java classes can be generated with help of JAXB on running maven file but still we need to manually write the serviceEndpoint class , hence it seems difficult to generate ServiceEndpoint class for the given xsd file.
I want to know is it possible to generate serviceEndpoint class as well for the given xsd on the run time and compiled as well.
In short i want to automate whole process of WSDL generation if XSD file is given as input as runtime.
Spring automatically exposes the WSDL generated from your configuration. See section 5.3.1.1 from the official documentation
Make sure that you use ServletRegistrationBean with defined URL mapping, etc., like this:
#Bean
public ServletRegistrationBean messageDispatcherServlet(ApplicationContext applicationContext) {
MessageDispatcherServlet servlet = new MessageDispatcherServlet();
servlet.setApplicationContext(applicationContext);
servlet.setTransformWsdlLocations(true);
return new ServletRegistrationBean(servlet, "/ws/*");
}
If your XSD schema is named test.xsd then you can access your WSDL at runtime here: http://localhost:8080/ws/test.wsdl
I have a WSDL file and I would like to create a webservice from that using Java ("Contract first approach"). I used the WSImport-Tool from JAX-WS (Java version 1.6.0_07) on the command line to generate Java-code stubs. This worked fine and I received the following Java files:
Add.java
AddResponse.java
ObjectFactory.java
package-info.java
Test.java
TestPortType.java
But how do I go on from here?
I am using Eclipse. There I could set up a new "Dynamic Web Project" with Target Runtime = "Tomcat 7.0". In Configuration do I have to choose "Axis2"? (Tomcat 7 and Axis2 are already setup locally).
I am lost at this point and do not know how to keep going.
Does it make it easier to create the webservice using Axis2 or do you recommend using JAX-WS? Or is there an even better option?
How and where do I include my WSDL file so it gets deployed to Tomcat 7?
Can anyone recommend a good (preferably open source) tool for creating WSDL files for some soap web services?
I've tried playing around with some of the eclipse plug ins available and was less than impressed with what I found.
As mentioned above, probably the easiest thing to do is use Apache CXF or Apache Axis2 to automatically generate your WSDL for you.
If you have downloaded the Java EE version of Eclipse, you should be able to create a Dynamic Web Project with the Axis2 facets. If you create a simple Java class in the project, you should be able to right-click on it, and choose Web Services->Create Web Service. That should automatically create an Axis2 service for you.
WSDL would then be available from some URL like: http://localhost/axis/{yourservice}?WSDL
One of the more interesting tools for bypassing all the associated headaches with WSDL is the XSLT script created by Arjen Poutsma (the lead developer of Spring Web Services):
http://blog.springframework.com/arjen/archives/2006/07/27/xslt-that-transforms-from-xsd-to-wsdl/
Basically it allows you to develop simple schemas that correspond to your desired operations (i.e. <BuyItem> and <BuyItemResponse>) and then generate all the associated WSDL crap from the XSD. I highly recommend it if you are interested in 'contract-first' web-services but the idea of using a WSDL as the starting point for that contract makes you feel green.
I am tired of generating massive amounts of files on the filesystem just to transport over SOAP. Now I use Apache CXF for both WS producers and consumers and let it handle the WSDL/stubs generation dynamically.
Depends on which language you're working in, but if you're active in Java then I'd recommend looking at Apache CXF. It's a pretty solid framework for publishing java code as a SOAP web service. It also includes a tool for directly generating WSDL files: java2wsdl
Nice tool can be found as SAAS solution at www.cofiq.com. Its strong point is the datamodel repository from which WSDL and REST JSON can be generated and impact analysis on datamodel changes.