Вопрос

We have a maven project which generates the wsdl client through apache cxf. The main goal is, to have the service wrapper fully generated, so that only the wsdl files have to be maintained under version-control.

<plugin>
  <groupId>org.apache.cxf</groupId>
  <artifactId>cxf-codegen-plugin</artifactId>
  <version>2.7.5</version>
  <executions>
    <execution>
      <id>generate-sources</id>
      <phase>generate-sources</phase>
      <configuration>
        <wsdlOptions>
          <wsdlOption>
            <wsdl>src/main/resources/WSAnzeigeKunde.wsdl</wsdl>
            <extraargs>
              <extraarg>-frontend</extraarg>
              <extraarg>jaxws21</extraarg>
              <extraarg>-p</extraarg>
              <extraarg>http://www.die-software.com/xsd/OBS_ANZEIGE_KUNDE_ANTWORT.xsd=com.diesoftware.service.anzeigekunde</extraarg>
            </extraargs>
          </wsdlOption>
        </wsdlOptions>
      </configuration>
      <goals>
        <goal>wsdl2java</goal>
      </goals>
    </execution>
  </executions>
</plugin>

this works fine so far. the resulting code looks like

public class WSAnzeigeAssetsummenService extends Service {
  public final static URL WSDL_LOCATION;
  public final static QName SERVICE = new QName("http://www.die-software.com/xsd/OBS_ANZEIGE_ASSETSUMMEN_ANTWORT.xsd", "WSAnzeigeAssetsummenService");
  public final static QName WSAnzeigeAssetsummenPort = new QName("http://www.die-software.com/xsd/OBS_ANZEIGE_ASSETSUMMEN_ANTWORT.xsd", "WSAnzeigeAssetsummenPort");
  static {
      URL url = null;
      try {
        url = new URL("file:/C:/Data/workspace-temp/WebAppPOC/src/main/resources/WSAnzeigeAssetsummen.wsdl");
      } catch (MalformedURLException e) {
        java.util.logging.Logger.getLogger(WSAnzeigeAssetsummenService.class.getName())
            .log(java.util.logging.Level.INFO, 
                 "Can not initialize the default wsdl from {0}", "file:/C:/Data/workspace-temp/WebAppPOC/src/main/resources/WSAnzeigeAssetsummen.wsdl");
      }
      WSDL_LOCATION = url;
  }

I found that cxf supports SLF4J (http://cxf.apache.org/docs/debugging-and-logging.html#DebuggingandLogging-UsingLog4jInsteadofjava.util.logging) but this seems not to belong to wsdl2java.

Is there really no way to configure the wsdl2java, to use any other logger.

Это было полезно?

Решение

Not for this particular case, no. The JAX-WS spec mandates that these generated service classes be 100% usable in any JAX-WS compliant environment. That would include the one in the JDK that would not have any other logging implementation.

For CXF 3.0, we've start discussing a new "cxf" frontend for wsdl2java that would allow more use of CXF specific API's and features, but would obviously not be 100% JAX-WS compliant.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top