title: Setting a JBoss / Wildfly webservice endpoint correctly (jboss-web.xml)
body: <p>I made a little SOAP web service using Spring Boot, with the following files (only relevant files are shown):</p>
  <p><strong>WebServiceConfig.Java</strong></p>
  <pre><code>@EnableWs
  @Configuration
  public class WebServiceConfig {
      
  
      @Bean
      public ServletRegistrationBean&lt;MessageDispatcherServlet&gt; messageDispatcherServlet(ApplicationContext context) {
          MessageDispatcherServlet messageDispatcherServlet = new MessageDispatcherServlet();
          messageDispatcherServlet.setApplicationContext(context);
          messageDispatcherServlet.setTransformWsdlLocations(true);
          return new ServletRegistrationBean&lt;MessageDispatcherServlet&gt;(messageDispatcherServlet, &quot;/ws/*&quot;);
      }
  
      @Bean(name = &quot;consultas&quot;)
      public DefaultWsdl11Definition defaultWsdl11Definition(XsdSchema consultasSchema) {
          DefaultWsdl11Definition definition = new DefaultWsdl11Definition();
          definition.setPortTypeName(&quot;ConsultasPort&quot;);
          definition.setTargetNamespace(&quot;http:/site.com/consultas&quot;);
          definition.setLocationUri(&quot;/ws&quot;);
          definition.setSchema(consultasSchema);   
      
          return definition;
      }
  
      @Bean
      public XsdSchema consultasSchema() {
  
          return new SimpleXsdSchema(new ClassPathResource(&quot;consultas.xsd&quot;));
      }
  }
  </code></pre>
  <p><strong>application.properties</strong></p>
  <pre><code>server.port=9090
  </code></pre>
  <p><strong>Main.Java</strong></p>
  <pre><code>@SpringBootApplication
  public class Main extends SpringBootServletInitializer {
  
      public static void main(String[] args) {
                      
          System.setProperty(&quot;org.jboss.logging.provider&quot;, &quot;slf4j2&quot;);     
          SpringApplication.run(Main.class, args);                
      }
  }
  </code></pre>
  <p><strong>Problem description:</strong></p>
  <p>When I run Main.Java from Eclipse, a Tomcat instance is deployed. Visiting the address <em>http://localhost:9090/ws/consultas.wsdl</em>. shows the WSDL description file, and SOAPUI is able to consume the web services without a problem.</p>
  <p>The problem starts when I pack the .war and deploy it on wildfly-23.0.2.Final. The context root is always set to /soap-web-service-0.0.1-SNAPSHOT.</p>
  <p><strong>Edit 2021 05 17</strong></p>
  <p>I was able to change the WildFly endpoint by creating a jboss-web.xml file in the folder src\main\webapp\WEB-INF, with the following contents:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;jboss-web xmlns=&quot;http://www.jboss.com/xml/ns/javaee&quot;
             xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
             xsi:schemaLocation=&quot;
        http://www.jboss.com/xml/ns/javaee
        http://www.jboss.org/j2ee/schema/jboss-web_5_1.xsd&quot;&gt;
      &lt;context-root&gt;/ws/*&lt;/context-root&gt;
  &lt;/jboss-web&gt;
  </code></pre>
  <p><strong>Steps I tried</strong></p>
  <p>I tried setting
  
  to:</p>
  <ul>
  <li>/</li>
  <li>/ws/*</li>
  </ul>
  <p>But I'm still unable to reach the endpoint</p>
  <p>Any input will be greatly appreciated.</p>