1

Java SOAP web app. I have several services to query and I must differentiate one of them based on environment (test, prod). I thought to be logic to keep common WSDL together and create two profiles for the service that need differentiation. Unfortunately I cannot change WSDL_LOCATION programmatically at runtime. So I wrote (simplifying XML as YAML and removing obvious elements like <phase>generate-sources</phase>):

project: 
 build: 
  plugins: 
   plugin: 
    executions: 
     execution: 
      id: "generate-common-sources"
      configuration: 
       wsdlOptions: 
        wsdlOption: 
         -
          wsdl: "${project.basedir}/src/main/resources/wsdl/Service1.wsdl"
          wsdlLocation: "/wsdl/Service1.wsdl"
         - 
          wsdl: "${project.basedir}/src/main/resources/wsdl/Service2.wsdl"
          wsdlLocation: "/wsdl/Service2.wsdl"
 profiles: 
  profile: 
   id: "env-test"
   build: 
    plugins: 
     plugin: 
      executions: 
       execution: 
        id: "generate-test-sources"
        configuration: 
         wsdlOptions: 
          wsdlOption: 
           wsdl: "${project.basedir}/src/main/resources/wsdl/Service3-test.wsdl"
           wsdlLocation: "/wsdl/Service3-test.wsdl"
  profile:
   id: "env-prod"
   build:
    # Duplicate env-test here

But this doesn't work: Service1 and Service2 get generated with a full path WSDL_LOCATION that obviously fails on the server. Why?

vault
  • 3,930
  • 1
  • 35
  • 46

1 Answers1

0

The working configuration that I discovered after many many curses is:

project: 
 build: 
  plugins: 
   plugin: 
    executions: 
     execution: 
      id: "generate-common-sources"
      configuration: 
       wsdlOptions: # Keep this empty!
 profiles: 
  profile: 
   id: "env-test"
   build: 
    plugins: 
     plugin: 
      executions: 
       execution: 
        id: "generate-test-sources"
        configuration: 
         wsdlOptions: 
          wsdlOption: 
           - 
            wsdl: "${project.basedir}/src/main/resources/wsdl/Service1.wsdl"
            wsdlLocation: "/wsdl/Service1.wsdl"
           - 
            wsdl: "${project.basedir}/src/main/resources/wsdl/Service2.wsdl"
            wsdlLocation: "/wsdl/Service2.wsdl"
           - 
            wsdl: "${project.basedir}/src/main/resources/wsdl/Service3-test.wsdl"
            wsdlLocation: "/wsdl/Service3-test.wsdl"
  profile:
   id: "env-prod"
   build:
    # Duplicate env-test here

Still unclear why my first approach did not work.

vault
  • 3,930
  • 1
  • 35
  • 46