Squence generator for camunda - camunda

How can I set my own IdGenerator for camunda via processes.xml.
Before switching to using processes.xml, I used
ProcessEngineConfiguration.setIdGenerator(IdGenerator);
Which uses a sequence of a oracle database.

1) Implement a ProcessEnginePlugin
package com.example;
import org.camunda.bpm.engine.ProcessEngine;
import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl;
import org.camunda.bpm.engine.impl.cfg.ProcessEnginePlugin;
public class IdGeneratorPlugin implements ProcessEnginePlugin {
public void preInit(ProcessEngineConfigurationImpl processEngineConfiguration) {
processEngineConfiguration.setIdGenerator(new CustomIdGenerator());
}
public void postInit(ProcessEngineConfigurationImpl processEngineConfiguration) {
}
public void postProcessEngineBuild(ProcessEngine processEngine) {
}
}
2) Register the plugin in processes.xml
<?xml version="1.0" encoding="UTF-8"?>
<process-application
xmlns="http://www.camunda.org/schema/1.0/ProcessApplication"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.camunda.org/schema/1.0/ProcessApplication http://www.camunda.org/schema/1.0/ProcessApplication ">
<process-engine name="default">
...
<properties>
...
</properties>
<plugins>
<plugin>
<class>com.example.IdGeneratorPlugin</class>
</plugin>
</plugins>
</process-engine>
<process-archive name="pa">
<properties>
...
</properties>
</process-archive>
</process-application>
3) Make sure the plugin is on the camunda-engine classpath or the classpath of your process application
Source: https://docs.camunda.org/manual/7.3/api-references/deployment-descriptors/#descriptors-processesxml

Related

Why is onMessage() (JMS Listener) not called during unit tests

From console output below, as far as I could see, my embedded ActiveMQ was initialized correctly and it is answering at 61616 port.
When I run the test below, I assume the message is successfully sent because I can debug line-by-line and see both simpleSend() and sendMessage() been ran.
I was expecting to see onMessage been triggered twice but It is not really occurring.
In the code below, when I run the unit test, I understand that:
1 - an embedded ActiveMQ with its broker is started
2 - an instance of MyListener is passed to org.springframework.jms.listener.DefaultMessageListenerContainer
So, what I am missing here in order to test onMessage()?
Console
INFO | Using Persistence Adapter: MemoryPersistenceAdapter
INFO | Apache ActiveMQ 5.14.1 (localhost, ID:win10-cha-55866-1509636415848-0:1) is starting
INFO | Listening for connections at: tcp://127.0.0.1:61616
INFO | Connector tcp://localhost:61616 started
INFO | Apache ActiveMQ 5.14.1 (localhost, ID:win10-cha-55866-1509636415848-0:1) started
INFO | For help or more information please see: http://activemq.apache.org
Sender
import javax.jms.Queue;
import org.springframework.jms.core.JmsTemplate;
public class SampleJmsMessageSender {
private JmsTemplate jmsTemplate;
private Queue queue;
public void setJmsTemplate(JmsTemplate jmsTemplate) {
this.jmsTemplate = jmsTemplate;
}
public void setQueue(Queue queue) {
this.queue = queue;
}
public void simpleSend() {
jmsTemplate.send(queue, s -> s.createTextMessage("hello queue world"));
}
public void sendMessage(final MyPojo mp) {
this.jmsTemplate.convertAndSend(mp);
}
}
EmbeddedActiveMQ.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context"
xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:util="http://www.springframework.org/schema/util" xmlns:task="http://www.springframework.org/schema/task"
xmlns:amq="http://activemq.apache.org/schema/core"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd http://activemq.apache.org/schema/core
http://activemq.apache.org/schema/core/activemq-core-5.2.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
<!-- Embedded ActiveMQ Broker -->
<amq:broker id="broker" useJmx="false" persistent="false"
useShutdownHook="false">
<amq:transportConnectors>
<amq:transportConnector uri="tcp://localhost:61616" />
</amq:transportConnectors>
</amq:broker>
</beans>
applicationContext.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:amq="http://activemq.apache.org/schema/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
<!-- JmsTemplate Definition -->
<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory" ref="connectionFactory" />
<property name="defaultDestination" ref="destinationQueue" />
<property name="messageConverter" ref="myMessageConverter" />
</bean>
<bean id="amqConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
<constructor-arg index="0" value="tcp://localhost:61616" />
</bean>
<!-- ConnectionFactory Definition -->
<bean id="connectionFactory"
class="org.springframework.jms.connection.SingleConnectionFactory">
<constructor-arg ref="amqConnectionFactory" />
</bean>
<bean id="destinationQueue" class="org.apache.activemq.command.ActiveMQQueue">
<constructor-arg index="0" value="IN_QUEUE" />
</bean>
<bean id="SampleJmsMessageSender" class="com.mypackage.spring.jms.SampleJmsMessageSender">
<property name="queue" ref="destinationQueue" />
<property name="jmsTemplate" ref="jmsTemplate" />
</bean>
<bean id="myMessageConverter" class="com.mypackage.spring.jms.SampleMessageConverter" />
<!-- this is the Message-Driven POJO (MDP) -->
<bean id="messageListener" class="com.mypackage.spring.jms.MyListener">
<property name="jmsTemplate" ref="jmsTemplate" />
<property name="queue" ref="destinationQueue" />
</bean>
<!-- and this is the message listener container -->
<bean id="jmsContainer"
class="org.springframework.jms.listener.DefaultMessageListenerContainer">
<property name="connectionFactory" ref="connectionFactory" />
<property name="destinationName" value="IN_QUEUE" />
<property name="messageListener" ref="messageListener" />
</bean>
</beans>
Unit Test
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class DefaultTextMessageSenderIntegrationTest {
private static SampleJmsMessageSender messageProducer;
#SuppressWarnings("resource")
#BeforeClass
public static void setUp() {
ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:EmbeddedActiveMQ.xml", "classpath:applicationContext.xml");
messageProducer = (SampleJmsMessageSender) applicationContext.getBean("SampleJmsMessageSender");
}
#Test
public void test1() {
messageProducer.simpleSend();
}
#Test
public void test2() {
messageProducer.sendMessage(new MyPojo("name", 1));
}
}
Listener
import org.springframework.jms.core.JmsTemplate;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.Queue;
import javax.jms.TextMessage;
import java.util.Map;
public class MyListener implements MessageListener {
private JmsTemplate jmsTemplate;
private Queue queue;
public void setJmsTemplate(JmsTemplate jmsTemplate) {
this.jmsTemplate = jmsTemplate;
}
public void setQueue(Queue queue) {
this.queue = queue;
}
#Override
public void onMessage(Message message) {
if (message instanceof TextMessage) {
try {
String msg = ((TextMessage) message).getText();
System.out.println("Received message: " + msg);
} catch (JMSException ex) {
throw new RuntimeException(ex);
}
}
}
public MyPojo receiveMessage() throws JMSException {
Map map = (Map) this.jmsTemplate.receiveAndConvert();
return new MyPojo((String) map.get("name"), (Integer) map.get("age"));
}
}
pom.xml
<properties>
<springframework.version>4.3.4.RELEASE</springframework.version>
<activemq.version>5.14.1</activemq.version>
<maven-war-plugin.version>2.6</maven-war-plugin.version>
<maven-compiler-plugin.version>3.6.0</maven-compiler-plugin.version>
<junit.version>4.12</junit.version>
</properties>
<dependencies>
<!-- Spring JMS -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jms</artifactId>
<version>${springframework.version}</version>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
</exclusions>
</dependency>
<!-- ActiveMQ -->
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-all</artifactId>
<version>${activemq.version}</version>
</dependency>
<!-- test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>${maven-war-plugin.version}</version>
<configuration>
<warSourceDirectory>src/main/webapp</warSourceDirectory>
<warName>spring-jms</warName>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<finalName>spring-jms</finalName>
</build>
your unit test stops before your listener (asynchronously) consume the message, you have to include that to the test by
Adding a Thread.sleep(2000); to delay the test stop
Or you add MyListener.receiveMessage() and remove the DMLC...
Or you put String msg = null; of MyListener as an instance variable and await in the test this value to be not null...
With actual code, in debug mode you can put a breakpoint on MyListener.onMessage to verify that the message is consumed

What is the WSO2 ESB message processor method performed after that an element is retrieved from a message store and before the sequence execution?

I am pretty new in WSO2 ESB and I have the following problem trying to create a custom message processor which extends the WSO2 SamplingProcessor class.
The SamplingProcessor class extends the ScheduledMessageProcessor abstract class which in turn implements the MessageProcessor interface (so I think that it should contain the list of all methods that can be implemented by a message processor.
So, to implement my custom message processor, I created a Maven project using this pom.xml file (it should fit the requirement to build a custom message processor):
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany.toolkit</groupId>
<artifactId>SamplingProcessorHeaderRateLimitation</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>Sampling Processor Header Rate Limitation</name>
<description>Custom Sampling Mesageprocessor using response header to implement the rate limitation</description>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.4</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>com.mycompany.toolkit.messageprocessor</Bundle-SymbolicName>
<Bundle-Name>com.mycompany.toolkit.messageprocessor</Bundle-Name>
<Export-Package>com.mycompany.toolkit.*</Export-Package>
<DynamicImport-Package>*</DynamicImport-Package>
<Implementation-Build>${buildNumber}</Implementation-Build>
<Scm-Root>${project.scm.connection}</Scm-Root>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<releases>
<updatePolicy>daily</updatePolicy>
<checksumPolicy>ignore</checksumPolicy>
</releases>
<id>wso2-nexus</id>
<url>http://maven.wso2.org/nexus/content/groups/wso2-public/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<releases>
<updatePolicy>daily</updatePolicy>
<checksumPolicy>ignore</checksumPolicy>
</releases>
<id>wso2-nexus</id>
<url>http://maven.wso2.org/nexus/content/groups/wso2-public/</url>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>org.apache.synapse</groupId>
<artifactId>synapse-core</artifactId>
<version>2.1.7-wso2v3</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
</dependencies>
<properties>
<CApp.type>lib/synapse/mediator</CApp.type>
</properties>
</project>
Then I created this SamplingProcessorHeaderRateLimitation that is my custom message processor implementation and that extends the SamplingProcessor WSO2 message processor class:
package com.mycompany.toolkit.messageprocessor;
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.synapse.SynapseException;
import org.apache.synapse.core.SynapseEnvironment;
import org.apache.synapse.message.processor.impl.ScheduledMessageProcessor;
import org.apache.synapse.message.processor.impl.sampler.SamplingProcessor;
import org.apache.synapse.message.processor.impl.sampler.SamplingProcessorView;
public class SamplingProcessorHeaderRateLimitation extends SamplingProcessor {
private static final Log logger = LogFactory.getLog(ScheduledMessageProcessor.class.getName());
private SamplingProcessorView view;
#Override
public void init(SynapseEnvironment se) {
super.init(se);
logger.info("init() START");
System.out.println("init() START");
try {
view = new SamplingProcessorView(this);
} catch (Exception e) {
throw new SynapseException(e);
}
// register MBean
org.apache.synapse.commons.jmx.MBeanRegistrar.getInstance().registerMBean(view,
"Message Sampling Processor view", getName());
logger.info("init() END");
System.out.println("init() END");
}
#Override
public void setParameters(Map<String, Object> parameters) {
logger.info("setParameters() START");
System.out.println("setParameters() START");
// TODO Auto-generated method stub
super.setParameters(parameters);
logger.info("setParameters() END");
System.out.println("setParameters() END");
}
}
Finnally I am using my custom SamplingProcessorHeaderRateLimitation class into the ESB message processor definition (instead of the standard SamplingProcessor):
<?xml version="1.0" encoding="UTF-8"?>
<!---<messageProcessor class="org.apache.synapse.message.processor.impl.sampler.SamplingProcessor" messageStore="transferFromMessageStore" name="transferFromMessageProcessor" xmlns="http://ws.apache.org/ns/synapse">-->
<messageProcessor class="com.mycompany.toolkit.messageprocessor.SamplingProcessorHeaderRateLimitation" messageStore="transferFromMessageStore" name="transferFromMessageProcessor" xmlns="http://ws.apache.org/ns/synapse">
<parameter name="sequence">transferProcessorSequence</parameter>
<parameter name="interval">1000</parameter>
<parameter name="is.active">true</parameter>
<parameter name="concurrency">1</parameter>
</messageProcessor>
This message processor perform the transferProcessorSequence.xml sequence for each element retrieved from the transferFromMessageStore message store.
It works fine but as you can see I put some logger.info() into the init() and setParameters() methods of my custom implementation. It works fine but these method are performed only once when the message processor is initialized.
I need to know what is the method that is performed each time that an element is retrieved from the transferFromMessageStore message store because here I have to implement a custom operation.
So, what is the method performed after that an element is retrieved from the message store related to a message processor and before the execution of the related sequence? (it is very important to me know the method after the retrieving of the element and before the sequence execution)
Inorder to do custom implementation between every message consumption and dispatch to the sequence, need to extend the class SamplingService. org.apache.synapse.message.processor.impl.sampler.SamplingService.java
Because its the org.apache.synapse.task.Taskassociated with SamplingService Processor.
Need to override either execute() or fetch(MessageConsumer msgConsumer) method in SamplingService. preferably fetch method. Also have a look at dispatch() method of the service.
public MessageContext fetch(MessageConsumer msgConsumer) {
MessageContext newMsg = super.fetch(msgConsumer);
// custom code here
return newMsg;
}
Use https://github.com Luke
MessageProcessor code on github
important lines are:
boolean setMessageConsumer(MessageConsumer messageConsumer);
List<MessageConsumer> getMessageConsumer();
Documentation of method setMessageConsumer, clearly states.
/**
* This method is used to set the message consumer of message processor. Consumer is the one who is
* responsible for retrieving messages from a store.
* #param messageConsumer is the name of the associated message consumer
* #return is true if the message if the message consumer is returned successfully. Otherwise false.
*/
Since storing and consuming messages from store are opposite operation, then all those java classes should be next to each other. All you need, must be around same folder.

Service could not find resource (Wildfly 10.0, JAX-RS)

I am learning REST services and face the problem: RestEasy cannot find my resources, even though I've tried various ways to demonstrate them.
Exception:
Failed to execute: javax.ws.rs.NotFoundException: RESTEASY003210: Could not find resource for full path: http://localhost:8080/RestfullService/services/hello
where RestfullService is the name of my project, /service - applicationPath, hello - resource. None of the errors (404 etc.) are shown on this pages.
My web.xml
(by the way, I've met controversial approaches regarding the content of web.xml while using web app server 3.0. According to official manuals, it is not required, but lots of people argue for it. What is the best practice?)
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
<display-name>RestEasy sample Web Application</display-name>
<listener>
<listener-class>
org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class>
</listener>
<servlet>
<servlet-name>resteasy-servlet</servlet-name>
<servlet-class>
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>com.store.model.WebConfig</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>resteasy-servlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
<context-param>
<param-name>resteasy.scan</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>resteasy.servlet.mapping.prefix</param-name>
<param-value>/</param-value>
</context-param>
</web-app>
My pom.xml (Although I've added all dependencies manually, the problem wasn't eliminated)
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>RestfullService</groupId>
<artifactId>RestfullService</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webXml>webapp\WEB-INF\web.xml</webXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<!-- <executions> <execution> <phase>package</phase> <configuration> <webXml>\webapp\WEB-INF\web.xml</webXml>
</configuration> </execution> </executions> -->
<plugin>
<artifactId>maven-ear-plugin</artifactId>
<version>2.7</version>
<configuration>
<modules>
<ejbModule>
<!-- property configurations goes here -->
</ejbModule>
</modules>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>JBoss repository</id>
<url>https://repository.jboss.org/nexus/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>3.0.4.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jackson-provider</artifactId>
<version>3.0.4.Final</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-servlet-initializer</artifactId>
<version>3.0.4.Final</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client</artifactId>
<version>3.0.4.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxb-provider</artifactId>
<version>3.0.4.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>jaxrs-api</artifactId>
<version>3.0.4.Final</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-multipart-provider</artifactId>
<version>3.0.4.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-7.0</artifactId>
<version>1.0.0.Final</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.annotation</groupId>
<artifactId>jboss-annotations-api_1.2_spec</artifactId>
<version>1.0.0.Final</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
</dependency>
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<version>2.0-EDR1</version>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.servlet</groupId>
<artifactId>jboss-servlet-api_3.0_spec</artifactId>
<version>1.0.2.Final</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20140107</version>
</dependency>
</dependencies>
</project>
ServiceInitialisation.java (both options with and without the body of this class didn't help):
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
#ApplicationPath("/services")
public class ServiceInitialisation extends Application{
// private Set<Object> singletons = new HashSet<Object>();
// private Set<Class<?>> classes = new HashSet<Class<?>>();
//
// public ServiceInitialisation() {
// singletons.add(new GoodsWebServiceImpl());
// }
//
// #Override
// public Set<Object> getSingletons() {
// return singletons;
// }
//
// #Override
// public Set<Class<?>> getClasses() {
// return classes;
// }
}
And finally services:
import java.util.List;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Response;
import com.store.entity.Item;
#Path("/")
public interface GoodsWebService {
#GET
#Path("/hello")
#Produces("application/json")
public Response greet();
// id: \\d+ - regex for cheching if it is int #GET #Path("{id:
\\d+}")
#Produces("application/json")
public Response
getInfoById(#PathParam("id") int id);
#GET
#Path("/all")
#Produces("application/json")
public List<Item> getAllItems();
}
package com.store.restService;
import java.util.ArrayList;
import java.util.List;
//import org.json.JSONException;
//import org.json.JSONObject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Response;
import org.json.JSONObject;
import com.store.entity.Item;
import com.store.entity.Shop;
#Path("/")
public class GoodsWebServiceImpl implements GoodsWebService
{
private static List<Item>data;
private static List<Shop>shops1;
private static List<Shop>shops2;
private static List<Shop>shops3;
private static Shop shop1;
private static Shop shop2;
private static Shop shop3;
static {
shop1 = new Shop(1,4.55, 1);
shop2 = new Shop(2,9.99, 2);
shop3 = new Shop(3,6,0);
shops1.add(shop1); shops1.add(shop2);
shops2.add(shop3); shops2.add(shop1);
shops3.add(shop2); shops3.add(shop3);
data = new ArrayList<>();
data.add(new Item(1, "hand", shops1));
data.add(new Item(2, "pen", shops2));
data.add(new Item(3, "ball", shops2));
}
public static Item getItemById(int id){
for(Item e: data){
if(e.getId()==id) return e;
}
throw new RuntimeException("Can't find Item with id -" + id);
}
public static List<Item> getAll(){
return data;
}
#Override
public Response greet(){
String result = "Hello!";
return Response.status(200).entity(result).build();
}
#Override
public Response getInfoById(int id){
JSONObject jsonObject = new JSONObject();
Item item = getItemById(id);
jsonObject.put("Id ", item.getId());
jsonObject.put("Mpn ", item.getMpn());
jsonObject.put("Shop ", item.getShops());
String result = "Output:\n" + jsonObject;
return Response.status(200).entity(result).build();
}
#Override
public List<Item> getAllItems(){
// JSONObject jsonObject = new JSONObject();
// List<Item> items = getAll();
// jsonObject.put("List", items);
// JSONArray jArray = jsonObject.getJSONArray("List");
// for(int i=0; i<jArray.length(); i++){
// System.out.println(jArray.getJSONObject(i).getString("id"));
// System.out.println(jArray.getJSONObject(i).getString("mpn"));
// System.out.println(jArray.getJSONObject(i).getString("shop"));
// }
return getAll();
}
}
I would be gratefull for any comments, since all the available solutions in the web were already been unsuccessfully tried.
Thanks in advanced
Update:
Due to the fact that only a few manuals were succesfully deployed on my machine, I suppose I choose incorrect setting during the process of creation of the project.
I create the project for REST in this way: create Dynamic web project -> convert it to Maven -> add dependencies etc. -> trying to deploy
Screenshot of them:
The image is here
Update2
Moreover, I've noticed that every time I start WildFly I meet the same error. I have tried to create a few project with various dependencies, but the result is the same. How to deal with it?
22:45:09,109 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC000001: Failed to start service jboss.deployment.unit."RestService.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."RestService.war".POST_MODULE: WFLYSRV0153: Failed to process phase POST_MODULE of deployment "RestService.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:163)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: java.lang.ClassNotFoundException: com.sun.jersey.spi.container.servlet.ServletContainer from [Module "deployment.RestService.war:main" from Service Module Loader]
at org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.checkDeclaredApplicationClassAsServlet(JaxrsScanningProcessor.java:292)
at org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.scanWebDeployment(JaxrsScanningProcessor.java:153)
at org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.deploy(JaxrsScanningProcessor.java:104)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:156)
... 5 more
Caused by: java.lang.ClassNotFoundException: com.sun.jersey.spi.container.servlet.ServletContainer from [Module "deployment.RestService.war:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:205)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:455)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:404)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:385)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:130)
at org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.checkDeclaredApplicationClassAsServlet(JaxrsScanningProcessor.java:290)
... 8 more
22:45:09,114 ERROR [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 1) WFLYCTL0013: Operation ("full-replace-deployment") failed - address: ([]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"RestService.war\".POST_MODULE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"RestService.war\".POST_MODULE: WFLYSRV0153: Failed to process phase POST_MODULE of deployment \"RestService.war\"
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: java.lang.ClassNotFoundException: com.sun.jersey.spi.container.servlet.ServletContainer from [Module \"deployment.RestService.war:main\" from Service Module Loader]
Caused by: java.lang.ClassNotFoundException: com.sun.jersey.spi.container.servlet.ServletContainer from [Module \"deployment.RestService.war:main\" from Service Module Loader]"}}
You don't need web.xml, the resteasy-servlet, or any explicit RESTEasy dependencies in your POM.
You'd better start with a simple working example, e.g. https://github.com/wildfly/quickstart/tree/10.x/jaxrs-client.
Despite its name, this sample not only includes a JAX-RS client, but also a JAX-RS service.

ClassNotFoundException after adding JAX-RS annotations (#Path etc.) in classes in Java

I need some help with JAX-RS and Jersey in my multi module Java EE App.
I will start with describing my environment:
Java 8 (Java EE 7)
Maven 3.3.3
GlassFish 4.1.
After properly deploying on GlassFish there are such errors in logs:
[2016-02-08T14:06:10.302+0100] [glassfish 4.1] [WARNING] [AS-WEB-UTIL-00035] [javax.enterprise.web.util] [tid: _ThreadID=44 _ThreadName=admin-listener(2)] [timeMillis: 1454936770302] [levelValue: 900] [[
Unable to load class pl.com.softnet.rest.RestConfig, reason: java.lang.ClassNotFoundException: pl.com.softnet.rest.RestConfig]]
[2016-02-08T14:06:10.304+0100] [glassfish 4.1] [WARNING] [AS-WEB-UTIL-00035] [javax.enterprise.web.util] [tid: _ThreadID=44 _ThreadName=admin-listener(2)] [timeMillis: 1454936770304] [levelValue: 900] [[
Unable to load class pl.com.softnet.rest.GraphConfig, reason: java.lang.ClassNotFoundException: pl.com.softnet.rest.GraphConfig]]
[2016-02-08T14:06:10.304+0100] [glassfish 4.1] [WARNING] [AS-WEB-UTIL-00035] [javax.enterprise.web.util] [tid: _ThreadID=44 _ThreadName=admin-listener(2)] [timeMillis: 1454936770304] [levelValue: 900] [[
Unable to load class pl.com.softnet.rest.GraphConfig, reason: java.lang.ClassNotFoundException: pl.com.softnet.rest.GraphConfig]]
[2016-02-08T14:06:10.304+0100] [glassfish 4.1] [WARNING] [AS-WEB-UTIL-00035] [javax.enterprise.web.util] [tid: _ThreadID=44 _ThreadName=admin-listener(2)] [timeMillis: 1454936770304] [levelValue: 900] [[
Unable to load class pl.com.softnet.rest.GraphConfig, reason: java.lang.ClassNotFoundException: pl.com.softnet.rest.GraphConfig]]
[2016-02-08T14:06:10.305+0100] [glassfish 4.1] [WARNING] [AS-WEB-UTIL-00035] [javax.enterprise.web.util] [tid: _ThreadID=44 _ThreadName=admin-listener(2)] [timeMillis: 1454936770305] [levelValue: 900] [[
Unable to load class pl.com.softnet.rest.GraphConfig, reason: java.lang.ClassNotFoundException: pl.com.softnet.rest.GraphConfig]]
[2016-02-08T14:06:10.305+0100] [glassfish 4.1] [WARNING] [AS-WEB-UTIL-00035] [javax.enterprise.web.util] [tid: _ThreadID=44 _ThreadName=admin-listener(2)] [timeMillis: 1454936770305] [levelValue: 900] [[
Unable to load class pl.com.softnet.rest.RestConfig, reason: java.lang.ClassNotFoundException: pl.com.softnet.rest.RestConfig]]
Here is my poms dependency of Web Service module:
<!-- JAVAEE API 7-->
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
<!-- SERVLET-->
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<exclusions>
<exclusion>
<groupId>javax.el</groupId>
<artifactId>el-api</artifactId>
</exclusion>
</exclusions>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet</artifactId>
<version>2.22</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>2.22</version>
<scope>provided</scope>
</dependency>
<!-- RICHAFACES -->
<dependency>
<groupId>org.richfaces</groupId>
<artifactId>richfaces</artifactId>
<version>4.5.0.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.el</groupId>
<artifactId>el-api</artifactId>
<version>2.1.2-b04</version>
<scope>provided</scope>
</dependency>
<!-- JSF -->
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.faces</artifactId>
<version>2.2.0</version>
<scope>provided</scope>
</dependency>
This is the resource class:
package pl.com.softnet.rest;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.SAXException;
import pl.com.softnet.ejb3.localBeans.FSMAdministratorBean;
import pl.com.softnet.ejb3.localBeans.ModulBezpieczenstwaBean;
import pl.com.softnet.entity.ProcesyDef;
import pl.com.softnet.entity.Uzytkownik;
import pl.com.softnet.filters.TestFilter;
import pl.com.softnet.util.ServiceLocator;
import pl.com.softnet.util.XmlUtils;
import pl.com.softnet.wyjatki.ModyfikacjaProcesuException;
import javax.naming.NamingException;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.xpath.XPathExpressionException;
import java.io.IOException;
import java.util.UUID;
#Path("config")
public class GraphConfig {
#GET
#Path("{id}")
#Produces(MediaType.APPLICATION_XML)
public Response getMethod {
}
#POST
#Path("{id}")
#Consumes(MediaType.APPLICATION_XML)
public Response postMethod() {
}
}
There is a Web Service class:
package pl.com.softnet.rest;
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
import java.util.HashSet;
import java.util.Set;
#ApplicationPath("/rest/*")
public class RestConfig extends Application {
#Override
public Set<Class<?>> getClasses() {
Set<Class<?>> myResources = new HashSet<Class<?>>();
myResources.add(GraphConfig.class);
return myResources;
}
}
My web.xml file:
<servlet>
<servlet-name>jersey-servlet</servlet-name>
<servlet-class>pl.com.softnet.rest.RestConfigr</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>jersey-servlet</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
In your web.xml you just need this:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<servlet>
<servlet-name>ServletAdaptor</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
</web-app>
Note that is important the web-app version of web.xml
In your pom.xml
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-json</artifactId>
<version>1.12</version>
</dependency>
And, you need a class that implements Application, but you don't need any Implementation. Just Like this is enough:
#ApplicationPath("/rest")
public class RestConfig extends Application {
#Context
private UriInfo context;
/**
* Creates a new instance of SimetPersistence
*/
public RestConfig() {
}
}
and, your application:
#Path("config")
public class GraphConfig {
public GraphConfig() {}
#GET
#Path("{id}")
#Produces(MediaType.APPLICATION_XML)
public Response getMethod {
...
It, must work. =)
Enviroment :
Java version: 1.7.0_79, vendor: Oracle Corporation
Apache Maven 3.0.3
Glassfish 4.1 (build 13)
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>br.ceptro.measure</groupId>
<artifactId>restfullexample</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>restfullexample</name>
<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-json</artifactId>
<version>1.12</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<compilerArguments>
<endorseddirs>${endorsed.dir}</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${endorsed.dir}</outputDirectory>
<silent>true</silent>
<artifactItems>
<artifactItem>
<groupId>javax</groupId>
<artifactId>javaee-endorsed-api</artifactId>
<version>7.0</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Class that extends Application
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package br.ceptro.measure.restfullexample;
import java.util.Set;
import javax.ws.rs.core.Application;
/**
*
* #author polianareis
*/
#javax.ws.rs.ApplicationPath("resources")
public class ApplicationConfig extends Application {
#Override
public Set<Class<?>> getClasses() {
Set<Class<?>> resources = new java.util.HashSet<>();
addRestResourceClasses(resources);
return resources;
}
/**
* Do not modify addRestResourceClasses() method.
* It is automatically populated with
* all resources defined in the project.
* If required, comment out calling this method in getClasses().
*/
private void addRestResourceClasses(Set<Class<?>> resources) {
resources.add(br.ceptro.measure.restfullexample.OlaBrasilResource.class);
}
}
Your REST WEb Services
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package br.ceptro.measure.restfullexample;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.UriInfo;
import javax.ws.rs.Consumes;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.POST;
import javax.ws.rs.Produces;
import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject;
/**
* REST Web Service
*
* #author polianareis
*/
#Path("ola-brasil")
public class OlaBrasilResource {
#Context
private UriInfo context;
/**
* Creates a new instance of OlaBrasilResource
*/
public OlaBrasilResource() {
}
/**
* Retrieves representation of an instance of br.ceptro.measure.restfullexample.OlaBrasilResource
* #return an instance of java.lang.String
*/
#POST
#Produces("application/json")
public String postJson(String content) throws JSONException {
JSONObject jSONObject = new JSONObject(content);
String value = jSONObject.getString("value");
return "Your web service works so well !!! ValueIs="+ value;
}
/**
* PUT method for updating or creating an instance of OlaBrasilResource
* #param content representation for the resource
* #return an HTTP response with content of the updated or created resource.
*/
#PUT
#Consumes("application/json")
public String putJson(String content) {
return "Example PUT";
}
}
You just need, clean and build. and deploy the war artifact in Glassfish 4.1
For test, you could use a REST Client in your navigator.
This is complete example and its works . See the image below:
Testing your rest application
Assuming you are using servlet 3.0 or higher
From https://jersey.java.net/nonav/documentation/2.0/deployment.html
There are multiple deployment options for the class that implements
Application interface in the Servlet 3.0 container. For simple
deployments, no web.xml is needed at all. Instead, an #ApplicationPath
annotation can be used to annotate the user defined application class
and specify the the base resource URI of all application resources
First remove all related Jersey configuration from web.xml
Update your RestConfig to be :
#ApplicationPath("rest")
public class MyApplication extends ResourceConfig {
public MyApplication() {
packages("pl.com.softnet.rest");// This will scan for rest resources
}
}
The other approach is to use web.xml in that case remove MyApplication class
and update your web.xml to be like the following:
<servlet>
<servlet-name>jersey-servlet</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<init-param>
      <param-name>jersey.config.server.provider.packages</param-name>
      <param-value>pl.com.softnet.rest</param-value>
</init-param>
</servlet>
...
<servlet-mapping>
<servlet-name>jersey-servlet</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
I hope that can work ! :)

How to create standalone WSDL based web service using Spring WS?

Please, help me to run standalone web service on local machine using Spring WS and existing wsdl.
I am new in Spring WS. There is my code:
package com.mayacomp.ws;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
#ComponentScan
#EnableAutoConfiguration
public class Application {
public static void main(String[] args) throws Exception {
SpringApplication.run(Application.class, args);
}
}
web service end point:
package com.mayacomp.endpoint;
import org.springframework.ws.server.endpoint.annotation.Endpoint;
import org.springframework.ws.server.endpoint.annotation.PayloadRoot;
import org.springframework.ws.server.endpoint.annotation.RequestPayload;
import org.springframework.ws.server.endpoint.annotation.ResponsePayload;
import com.mayacomp.pack.intRequest;
import com.mayacomp.pack.IntResponse;
#Endpoint
public class WsEndpoint {
private static final String NAMESPACE_URI = "http://new.webservice.namespace";
#PayloadRoot(namespace = NAMESPACE_URI, localPart = "intRequest")
#ResponsePayload
public IntResponse getIntHist(#RequestPayload intRequest request) {
try {
com.mayacomp.pack.IntResponse _return = new com.mayacomp.pack.IntResponse();
/*a lot of setters for _return object*/
return _return;
} catch (java.lang.Exception ex) {
ex.printStackTrace();
throw new RuntimeException(ex);
}
}
}
and webservie config:
package com.mayacomp.ws;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.context.embedded.ServletRegistrationBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;
import org.springframework.ws.config.annotation.EnableWs;
import org.springframework.ws.config.annotation.WsConfigurerAdapter;
import org.springframework.ws.transport.http.MessageDispatcherServlet;
import org.springframework.ws.wsdl.wsdl11.SimpleWsdl11Definition;
import org.springframework.ws.wsdl.wsdl11.Wsdl11Definition;
#EnableWs
#Configuration
#EnableAutoConfiguration
public class WebServiceConfig extends WsConfigurerAdapter {
#Bean
public ServletRegistrationBean dispatcherServlet(ApplicationContext applicationContext) {
MessageDispatcherServlet servlet = new MessageDispatcherServlet();
servlet.setApplicationContext(applicationContext);
servlet.setTransformWsdlLocations(true);
return new ServletRegistrationBean(servlet, "/ws/*");
}
#Bean(name = "MayaService")
public Wsdl11Definition defaultWsdl11Definition() {
SimpleWsdl11Definition wsdl11Definition = new SimpleWsdl11Definition();
wsdl11Definition.setWsdl(new ClassPathResource("MayaService.wsdl"));
return wsdl11Definition;
}
}
my pom file looks like:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>maya-ws</artifactId>
<dependencies>
<!-- tag::springws[] -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-ws</artifactId>
<version>1.2.3.RELEASE</version>
</dependency>
<!-- end::springws[] -->
<dependency>
<groupId>wsdl4j</groupId>
<artifactId>wsdl4j</artifactId>
<version>1.6.3</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
I need to run application (I can run) and get web service via link like localhost:8080/ws/MayaService?wsdl
I will be glad for any advices.