1
votes

What i am trying to do is to separate configurations of endpoint address and also service versions into something like .properties file or any. Since, the endpoint will be different in various environments, such as UAT and PRODUCTION environments. Also, the service provider controls the service/message version by using naming convension like ABCDEF_10_4, ABCDEF is the name of the service and 10.4 is a release version. We are just a service consumer, so we cannot change anything on the server side.

What I am looking for is the way to make use of something similar to this

<wsdl:operation name="service1">
    <soap:operation soapAction="**${endpointurl}/${msgname}**" />
    <wsdl:input>
        <soap:body use="literal" />
        <soap:header use="literal" message="tns:MessageHeader" part="session" />
    </wsdl:input>
    <wsdl:output>
        <soap:body use="literal" />
        <soap:header use="literal" message="tns:MessageHeader" part="session" />
     </wsdl:output>
</wsdl:operation>

<wsdl:service name="**${servicename}**">
    <wsdl:port binding="tns:ServiceBinding" name="ServicePort">
        <soap:address location="**${endpointurl}**" />
    </wsdl:port>
</wsdl:service>

Where I can specify those values in name:value pair similar to .properties file like

endpointurl=http://xxx.xxx.xxx.xxx:10000
msgname=ABCDEF_10_4
servicename=myService

The problem is that I dont want to change wsdl everytime the service provider releases a new version of their services and also it will be easier for me and my team to manage the version of the services in just one place.

Also, when we deploy our applicaion on UAT/DEV/PROD/TEST environments, we dont need to make any changes in wsdl everytime or have many wsdl files for each environment.

We are using maven cxf codegen plugin to generate client stubs.

Any idea or possible way to do something similar to this?

1
I found maven-properties-plugin, which is supposed to cope with what I need. I have tried it and checked wsdl in the jar file built, the ${param} in wsdl file is correctly replaced with the value in the .properties. However, the ${param} in generated client stubs is not replaced. Is there any way to replace all the resources in the src generated with the variables replaced by the values specified in properties? Any help would be grateful.papokk

1 Answers

0
votes

OK, after digging around google for 3-4 hrs, I found the answer and think that I should contribute to the community.

First, I create a new profile and use maven-resources-plugin filtering to replace ${param} in wsdl from the .properties file and copy the replaced resource to target folder.

Then, in that profile I user cxf-codegen-plugin to generate the webservices clients from the generated wsdl.

That's it :)