Wednesday, July 27, 2016

Enabling WS-Security in Spring Boot using CXF, JAX-WS and JAXB

In my previous post, I've shown how to quickly create a WSDL/SOAP based web service. This post will build on top of that to include WS-Security. We'll be using simple username/password authentication.

Friday, July 22, 2016

Getting Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions...

My previous post shows how we can easily create a SOAP based web service using Spring Boot, CXF, JAX-WS and JAXB.

There's a small matter to note when naming functions. The following function naming works:

package com.techtots.services;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.xml.bind.annotation.XmlElement;

import com.techtots.contracts.UserRegisterRequest;
import com.techtots.contracts.UserRegisterResponse;

@WebService
public interface UserService {
    
    @WebMethod
    @WebResult(name = "userRegisterResponse")
    public @XmlElement(required = true, nillable = false) UserRegisterResponse registerUser(
            @XmlElement(required = true, nillable = false) 
            @WebParam(name = "userRegisterRequest")
            UserRegisterRequest userRegisterRequest);
}

Creating WSDL/SOAP web services in Spring Boot using CXF, JAX-WS and JAXB

Here's a quick way to use Spring Boot to expose web services via WSDL/SOAP using CXF, JAX-WS and JAXB.

Add the following artifacts into your Spring Boot pom.xml:


    org.apache.cxf
    cxf-rt-frontend-jaxws
    3.1.6



    org.apache.cxf
    cxf-rt-transports-http
    3.1.6