Skip to content

Commit

Permalink
HPCC4J-334 Automate WsClient Interface
Browse files Browse the repository at this point in the history
- Adds python to generate new wsdls, stub, and wrappers
- Adds vscode launch profile
- Updates filespray wsdl reference in pom
- Targets source code wrapper utility rather than jared version

Signed-off-by: Rodrigo Pastrana <rodrigo.pastrana@lexisnexisrisk.com>
  • Loading branch information
rpastrana committed Jun 15, 2023
1 parent 82c6ca6 commit 52d6feb
Showing 1 changed file with 31 additions and 25 deletions.
56 changes: 31 additions & 25 deletions wsclient/utils/wsInterfaceUpdater.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def main():
build_hpcc4j()
print("Done...")

for service_name, ecm_file, wsdl_prefix, service_uri, non_eclwatch_port in services:
for service_name, ecm_file, wsdl_prefix, service_uri, non_eclwatch_port in services:
if args.service != "all" and service_name != args.service:
continue
if ecm_file == None:
Expand Down Expand Up @@ -183,11 +183,23 @@ def main():
remove_latest_stub(service_name)
print(f"Generating latest stub for {wsdl_prefix}-{version}...")
generate_stubcode(service_name)
print(f"Rebuilding wsclient...")
build_hpcc4j()

print(f"Rebuilding wsclient...")
build_hpcc4j()

wsclient_classpath = get_wsclient_runtime_classpath()
if wsclient_classpath == None:
print("Could not generate wsclient classpath!")
return
else:
for service_name, ecm_file, wsdl_prefix, service_uri, non_eclwatch_port in services:
if args.service != "all" and service_name != args.service:
continue

print(f"Generating latest stub wrappers for {wsdl_prefix}-{version}...")
generate_wrappers(service_name, wsdl_prefix)
generate_wrappers(service_name, wsdl_prefix, wsclient_classpath)
print("Done...")

print(f"Building wsclient after WSDL based changes...")
build_hpcc4j()
print("Done...")
Expand Down Expand Up @@ -351,28 +363,22 @@ def get_wsclient_runtime_classpath():

return class_path

def generate_wrappers(service_name, wsdl_prefix):
def generate_wrappers(service_name, wsdl_prefix, wsclient_class_path):
wrapper_class_name = "org.hpccsystems.ws.client.utils.Axis2ADBStubWrapperMaker"
wrappers_output_path = f"{os.getcwd()}/wsclient/src/main/java"
wrappers_package = "org.hpccsystems.ws.client.wrappers.gen"
package_to_wrap = f"org.hpccsystems.ws.client.gen.axis2.{service_name}.latest"
working_directory = f"{os.getcwd()}/wsclient"
gen_wrappers_command= f"java -classpath {wsclient_class_path} {wrapper_class_name} outputpackage=org.hpccsystems.ws.client.wrappers.gen targetpackage=org.hpccsystems.ws.client.gen.axis2.{service_name}.latest servicename={wsdl_prefix} outputdir={working_directory}/src/main/java"
logging.debug(f"gen_wrappers_command: {gen_wrappers_command}")

wsclient_classpath = get_wsclient_runtime_classpath()
if wsclient_classpath == None:
print("Could not generate wsclient classpath!")
return
else:
wrapper_class_name = "org.hpccsystems.ws.client.utils.Axis2ADBStubWrapperMaker"
wrappers_output_path = f"{os.getcwd()}/wsclient/src/main/java"
wrappers_package = "org.hpccsystems.ws.client.wrappers.gen"
package_to_wrap = f"org.hpccsystems.ws.client.gen.axis2.{service_name}.latest"
working_directory = f"{os.getcwd()}/wsclient"
gen_wrappers_command= f"java -classpath {wsclient_classpath} {wrapper_class_name} outputpackage=org.hpccsystems.ws.client.wrappers.gen targetpackage=org.hpccsystems.ws.client.gen.axis2.{service_name}.latest servicename={wsdl_prefix} outputdir={working_directory}/src/main/java"
print (f"gen_wrappers_command: {gen_wrappers_command}")

process = subprocess.Popen(gen_wrappers_command.split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, cwd=working_directory)
for line in process.stdout:
message = str(line, 'utf-8')
if message.startswith("Alert!") or message.startswith("Warning:"):
logging.warning(message)
else:
logging.info(message)
process = subprocess.Popen(gen_wrappers_command.split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, cwd=working_directory)
for line in process.stdout:
message = str(line, 'utf-8')
if message.startswith("Alert!") or message.startswith("Warning:"):
logging.warning(message)
else:
logging.info(message)

#generate-wsdl/hpcc4j$
# java
Expand Down

0 comments on commit 52d6feb

Please sign in to comment.