Automate Deployment IWS Webservices on IBMi - web-services

How does one go about automating the creation of Webservices on the IBMi?
Using the GUI at http://my.ibmi:2001/HTTPAdmin is a painfully slow process, and prone to fat finger errors. Thus my quest for automation.
During my research, I was unable to find the CL commands to export my RPGLE *SRVPGM procedures as Web Services.
Automation for IBMi V6R1 or V7R1.
Reference Sites:
http://www.ibm.com/systems/power/software/i/iws/‎
http://www-03.ibm.com/systems/resources/integrated_web_application_server_information.pdf
http://www-03.ibm.com/systems/resources/systems_i_software_iws_pdf_WebServicesClient_new.pdf
CL based method for adding HTTP Servers on IBMi system
http://www.ibm.com/support/knowledgecenter/ssw_ibm_i_61

Answer found at
http://www.volubis.fr/news/liens/courshtm/AS400web/V6R1_LWI.htm
All scripts relating to Webservices are in
/QIBM/ProdData/OS/WebServices/V1/server/bin
Step:
STRQSH
cd /QIBM/ProdData/OS/WebServices/V1/server/bin
installWebService.sh -h
Command usage:
installWebService.sh
-server 'server-name' -programObject 'program-object'
[-service 'service-name'] [-pcml 'pcml-file'] [-userid 'userid']
[-libraryList 'library-list'] [-libraryListPosition '*FIRST|*LAST']
[-disableNillableWSDLElements] [-disableOptionalWSDLElements]
[-addUnderscoreToWSDLElementNames] [-libraryListPosition '*FIRST|*LAST']
[-printErrorDetails] [-help]
Where:
server is the name of the Web services server in which the service
will be installed.
programObject is the integrated file system path to the ILE program or
service program. For example, '/QSYS.LIB/MYLIB.LIB/MYPGM.[SRVPGM or PGM]'
service is the name of Web service to be installed. This parameter is
optional. If not specified, the program object name will be used.
pcml is a path to the PCML file. This parameter is optional. If not
specified, the program object must contain the PCML data.
userid is the user profile the Web service will be modified to run under.
This parameter is optional. If not specified, the Web service will run
under the Web services server user profile. Note: The Web service server's
user profile needs to have *USE authority to the user profile specified on
this parameter. A value of *SERVER will ensure the Web service runs under the
same user profile as the Web services server.
libraryList is a list of libraries, that will be added to the library
list prior to invoking the Web service. Each library in the list must
be delimited by a colon. This parameter is optional.
libraryListPosition is the position in the user portion of the job
library list where the list of libraries specified in -libraryList will be
placed. A value of *FIRST inserts the libraries at the beginning of
the user portion of the library list. A value of *LAST inserts the libraries
at the end of the user portion of the library list. This parameter is
optional. If not specified the default value of *LAST is used.
disableNillableWSDLElements will define elements in generated WSDL as
not nillable. If not specified, elements are defined as nillable.
This parameter is ignored for version 1.3 of Web services engine.
disableOptionalWSDLElements will define elements in generated WSDL as
not optional. If not specified, elements are defined as optional.
This parameter is ignored for version 1.3 of Web services engine.
addUnderscoreToWSDLElementNames will generate WSDL element names
that start with the underscore (_) character, as was always done in
version 1.3 of the Web services engine. If not specified, element names
in WSDL will not start with the underscore character.
This parameter is ignored for version 1.3 of Web services engine.
printErrorDetails will show additional error information, such as stack
traces and error codes, if the command fails. This parameter is optional.
help displays the command syntax. This parameter is optional.

Related

How to Exclude Application Definition from Import in Oracle Apex

I need to have different values in substitution strings in DEV and PROD. How do I prevent overwriting the substitution strings when updating PROD. DEV and PROD are in separate databases.
I don't see how to exclude the application definitions in build options.
Is there a better way to meet this requirement?
Thanks
The way I see it, substitution strings are application items defined as constants. Only use them for strings that are always the same in any deployment instance of the app. As soon as the value needs to be changeable (for example dev has different value than prod), use application items instead.
If you insist on doing this with build options then this is an option:
Set the values of the application items using a computation or an application process (this is for for production).
Create a 2nd set of computations or an app process with a sequence higher than the sequence of the one above (so this will override the original values) and set a build option on those (exclude on export).
That way, when you export the app, only the first set of computations / app process will be included.
However, my preference is to configure this in the database and have a settings table that has a record indicating the status of the environment (prod/dev/stage/uat) and store the strings in a custom messages table (one record per app status/application item) . In an application process or computation get the value of the application items. The reason I prefer this is that the app doesn't need to know if it is dev or prod, but the database should. This option has a couple of challenges if the same database and schema is used for prod and dev.

boto3 list_services() with order

I made aws auto deployment code with boto3 library.
In my code, get all service list and use it.
I have to get lastest service. But I think there is no order option.
(https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ecs.html#ECS.Client.list_services)
Sometimes, first element is latest service.
But sometimes, old service is placed in first element.
Is there any option or way to get latest service?
Thanks.
The list_services method does not return details of individual services. It simply lists the services, and returns you a list of identifiers (ARNs) for those services.
To get more details of a given service, you can use describe_services. This allows you to get details of up to 10 services at a time.
So, take the list of service identifiers that you get back from list_services, and pass it to describe_services (with at most 10 service identifiers). Something like this (untested):
list_response = client.list_services(
cluster='xyz',
launchType='EC2'
)
desc_response = client.describe_services(
cluster='xyz',
services=list_response['serviceArns']
)
Note that you will have to do pagination using maxResults / nextToken if there are a lot of results.

Property configuration AEM Day lib

We are using the lib
"Day Commons Library - HTTP Client 3.1 Bundling
(com.day.commons.osgi.wrapper.commons-httpclient)"
in our AEM 6.0 system.
We'd like to change the property http.protocol.cookie-policy of this lib to another value. (It's the cookie policy https://hc.apache.org/httpclient-3.x/apidocs/org/apache/commons/httpclient/cookie/CookiePolicy.html).
What is the best way to do that?
The property is not visible in the OSGi console, there are only other values of this lib configurable (like HTTP Proxy User etc.)
According to https://docs.adobe.com/docs/en/aem/6-0/deploy/configuring/configuring-osgi.html
one could create a configuration in
/apps/system/config
But how can we ensure that the library reloads exactly this configuration when we restart the bundle/service in OSGi console?
Does the entry in JCR require to be named like the class
org.apache.commons.httpclient.cookie.CookiePolicy
and the value in the jcr:content has to be of type String and has to contain the other cookie policy, e.g. BROWSER_COMPATIBILITY, correct?
How can we determine later if the value was loaded? The problem is: the lib is not our code, we can't simply add a log line.
The httpclient osgi bundle loads only select properties defined in metatype.xml (This is an example. not the actual config used in day common httpclient). so your config will not be used.
You should be able to use setCookiePolicy method of org.apache.commons.httpclient.params.HttpMethodParams.

Windows Service Command line parameters with Automatic Start

I wrote a simple Windows service based on this sample. I need to pass a couple of parameters to the service, as command line parameters (reading the Service registry hive does not work on Windows7). I tried the solution described here but it does not work: when I add the parameters to the value in the <MyService>\ImagePath entry (i.e "D:\MyService.exe" "-param1" "-param2") the service fails to start..

Azure Storage Copy Blob Console App - 403 Forbidden Error

Using Microsoft.WindowsAzure.Storage 2.1.0.3
Attemping to write a conosle app to move documents from one Azure Storage account to another account. The app lists all the containers using sourceClient.ListContainers(), loops through all containers in a foreach block getting a Shared Access Token for each, and then fires a StartCopyFromBlob request for each blob. The destination blob has the same naming structure, but is in a different account (e.g. sourceAzureUrl/testContainer/filename.ext -> destAzureUrl/testContainer/filename.ext).
Most of the files (98%) copy just fine, but when certain requests are sent, it returns with this exception: "The remote server returned an error: (403) Forbidden." When the CloudBlockBlob reference to the destination blob is created, the URL does not seem to be properly URL escaped which results in the exception. However, when this code is run inside of an MVC controller, the request is somehow properly URL escaped and the request is completed without error. The copied blob contains the unescaped name as well.
It appears that the reason is the blob/filename contains a "[" and/or "]" character (e.g. Roger_Smith[1].doc). If the the filename is URL encoded beforehand, the request is completed without error, but the filename in Azure Storage is its URL escaped incarnation and not the original filename (Roger_Smith%255b1%255d.doc instead of Roger_Smith[1].doc).
Is there a way to properly URL escape the copy request and still have the result blob have the unescaped name?
Can you confirm you are running with .net 4.5? There is a uri escaping issue for the characters you mentioned (brackets) that was introduced in .net 4.5 that is incompatible with .net 4.0 (which is what the service is using to validate the response). As such it appears as if the message signature was incorrectly formed. We are working with the .net team on long term resolution for this. In the meantime you may consider running under .net 4.0 (with .net 4.5 installed to take advantage of GC improvements) or avoiding the bracket characters in the file name.