Triggering SOAP requests in a Maven Mojo - maven-2

I have a WSDL which I need to trigger some commands from. I need to do this as part of a Maven Plugin (Mojo)
I'm a relative newbie to SOAP so what I want to know is this:
1) Is this possible? Can the SOAP calls be run from a Maven Plugin or does it require a container or something else?
2) If so, what tools should I use to do this? I've read about Apache Axis and have seen that it's capable of building a lot of things from the WSDL itself. Is this the sort of tool I should use? Do Mojos have a built in SOAP executor?
3) If not, what are my alternatives?

Is this possible? Can the SOAP calls be run from a Maven Plugin or does it require a container or something else?
Yes, that's possible, you do not require any kind of container to run a SOAP client.
If so, what tools should I use to do this? I've read about Apache Axis and have seen that it's capable of building a lot of things from the WSDL itself. Is this the sort of tool I should use? Do Mojos have a built in SOAP executor?
I would consider using a JAX-WS stack like JAX-WS RI which is included in Java 6. Much easier and much more elegant. Here are some tutorials to get started:
Introducing JAX-WS 2.0 With the Java SE 6 Platform, Part 1
Creating a Simple Web Service and Client with JAX-WS
Getting Started with JAX-WS Web Services
Developing JAX-WS Web Service Clients
In short, use wsimport to generate and compile the web service artifacts needed to connect to the service and use them from the Mojo.

Related

Is there any solution for generating the restfual api code both for client and server

The functions for operating the restful api is quite same. Is there any project that can generate the source code for different platform such android,ios and backend stuff.
I suggest you to use API description languages such Swagger ou RAML.
After having described your RESTful application with a language like this, you will be able to generate things like server skelekons and client sdks with different technologies and languages. You can even generate documentations.
With Swagger, swagger-codegen will do that. swagger-ui may also interest you for the documentation part.
To finish, I would like to mention the Restlet studio that allows to define graphically and quickly the structure of RESTful applications and generate then the corresponding Swagger and RAML contents. The APISpark plaform provides a mecanism to introspect Restlet applications and generate the corresponding contents with these languages. It also allow you to generate a set of server skelekons and client sdks.
Hope it helps you.
I will suggest you to use Spring RESTful webservices starter kit. Which will manage your back-end with centralized database. Also Spring has its own android libs to communicate with REST Apis.

How to implement WCF test client for non windows platform.

I have been evaluating and working on a prototype where I have exposed couple of API using WCF web service. My service is working as expected with managed client in windows platform. My service client can be on any platform. I dont know how to approach for other platform (UNIX). Couple of options I have considered so far -
GSOAP
MONO dotnet
I could not use any one of these due to some constraints. Now the only option I left out to implement my own client which can send soap request and get soap response. My preferred technology is C/C++. I am using wsHttpBinding in my server and will be working on http protocol only.
I am not sure about the following points-
Do I need to implement my own WSDL parser?
Do I need my own serializer?
How could I make my client more flexible so that any changes in my WSDL make minimal code changes on client side?
I am looking for help from the experts who could guide me with a proper approach with a basic client sample.
My experience is in WCF interoperability with Java clients. You can use Java SOAP libraries like metro http://metro.java.net/ or axis http://axis.apache.org/axis2/java/core/index.html . There is even a C library for axis. http://axis.apache.org/axis2/c/core/
I am sure other languages like Ruby/Python etc has similar libraries as well.
The other option is to use a REST based interface and then you can use any language/platform that has HTTP support or even a tool like curl and libcurl http://curl.haxx.se/.

Glassfish 3.1 application.wadl reorder elements

I am currently using Glassfish to host a bunch of RESTful Web Services. Glassfish is very helpful and generates a wadl for me. The problem that I'm having is the wadl it generates puts all the resources in a random order.
Our wonderful QA folks (and us developers) use SoapUI to consume the wadl and manually call the web serivices for testing purposes. This process has become frustrating because it is hard to find the web service we want to call because it is not alphabetized. To make it worse every time we add or change a web service we have to re import the wadl into SoapUI which changes the order of the web services.
I have done a lot of digging and have not found a configuration file or property that will tell glassfish to order the wadl before publishing it. I also could not find a way to get SoapUI to reorder the web services to be in alphabetical order. The solution that I came up with is to use JAXB to convert the wadl to Java objects, reorder the Java objects, then convert it back to Java.
What all of this boils down to, is there a way to get Glassfish 3.1 to reorder the wadl to be in alphabetical order or get SoapUI to display the web services in alphabetical order?

axis2 vs spring-ws vs jersey

My friend asked to explain me what's the difference between Spring, axis2 and Jersey. Here I listed down a few differences that I'm aware of. Please comment/respond if you know more differences
Spring webservices:
A java web application with a servlet configured in
web.xml(org.springframework.ws.transport.http.MessageDispatcherServlet).
You can use spring annotated POJOs for creating web services
Supports both RESTful and SOAP based web services.
Since it’s a web application you can use http authentication mechanisms
for enabling security
Axis2:
The webservice application is a .aar file that will be deployed in
axis2.war
Use AXIOM for using non-primitive type arguments to web service calls
You can use JSR181 annotations to create webservices
You can use spring-dependency injection using axis2 extensions.
Supports both RESTful and SOAP based web services.
I guess you have to use ws-security implementation for
providing security
to your web services>
They claim hot deployment of webservices works but I haven’t seen
it working.
Jersey:
A regular web application with a servlet configured in web.xml.
Write custom message readers/writers for using
non-primitive type arguments to web
service calls
Since it’s a web application you can use http authentication mechanisms
for enabling security
Supports only RESTful implementation of web services
I have seen hot deployment working may be because it’s a web application
and the container can do hot
deployment
I'm not familiar with Jersey and Axis, but I can tell you something about Spring-WS.
You cannot use Spring-WS for restful webservices. Spring-WS is intended to be used for contract first webservices. You can however use the features of Spring 3.x and Spring-MVC for REST services.
As for authorization, you can easily wire in any sort of security (with Spring-Security for instance).
I'm a big fan of the 'automatic' (de) marshalling features of Spring-WS. Just annotate your methods with the correct types and it'll know what to do.

Axis2 and OpenSAML

I'm trying to add SAML assertions to a SOAP web service that is built on the axis2 engine. I'm having a little trouble wrapping my head around how the two would interact. Could someone help point me in the right direction to add a SAML assertion to a response message from Axis2?
Thanks,
Tom
You'll need to include the rampart module as an extra module. The relevent section for configuring SAML support appears to be here
If you want more platform support then I'd recommend deploying your web service onto the Web services application server produced by the authors of Axis2. It has GUI driven screens that assist in configuring the Rampart module.