soap-bin-script
Standardizes the creation of new synchronous SOAP scripts for Hyper-V management.
Install
mkdir -p .claude/skills/soap-bin-script && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/12300" && unzip -o skill.zip -d .claude/skills/soap-bin-script && rm skill.zipInstalls to .claude/skills/soap-bin-script
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Creates a new synchronous SOAP operation script in bin/ following the exact boilerplate from bin/GetVM.php, bin/DeleteVM.php, etc. Use when user says 'add a bin script', 'new SOAP operation', 'create a hyperv command', or adds a new HyperVService method. Generates the ini_set block, argc check, get_service_master() call, getSoapClientParams(), SoapClient instantiation, and exception handler. Do NOT use for async variants (use async-soap-script instead) and do NOT use for Plugin.php method additions.Key capabilities
- →Create new synchronous SOAP operation scripts in `bin/`
- →Generate the `ini_set` block for PHP scripts
- →Implement `argc` checks for argument validation
- →Include `get_service_master()` calls for credential retrieval
- →Instantiate `SoapClient` with appropriate parameters
How it works
The skill generates a new synchronous PHP SOAP operation script by following a predefined boilerplate. It includes critical elements like `ini_set` blocks, `argc` checks, and `SoapClient` instantiation, ensuring security and consistency.
Inputs & outputs
When to use soap-bin-script
- →Add new HyperV management command
- →Implement new SOAP operation
- →Generate synchronous API wrapper script
About this skill
soap-bin-script
Critical
- Never use PDO —
$mastercredentials come exclusively fromget_service_master(), never from raw DB queries or env vars. - Never skip the full
ini_setblock — all 6ini_setcalls must appear verbatim in every script. - Always place
hyperVAdminandadminPasswordinside the SOAP params array — never as separate constructor args. - Result key must match the method name —
$response->GetVMResultforGetVM,$response->RebootResultforReboot, etc. (exception:CreateVMand similar create operations useprint_r($response)directly). - Do NOT create async variants here — async scripts belong in
bin/async/and use a different pattern entirely.
Instructions
Step 1 — Identify method signature
Determine:
- SOAP method name (e.g.,
SetCPUCount) - Extra parameters beyond
<id>(e.g.,<vps>,<cpuCount>) - Whether the response has a typed
Resultproperty (query/action ops) or returns the raw object (create ops)
Verify the method exists in https://{host}/HyperVService/HyperVService.asmx?WSDL before writing the script. Check bin/WsdlInfo.php for discovery.
Step 2 — Create the script file in bin/
File name must be the PascalCase SOAP method name inside bin/ — for example bin/GetVMState.php for the GetVMState method, or bin/TurnON.php for TurnON.
Start with the fixed shebang + include + ini_set block. This block is identical in every script — do not modify it:
#!/usr/bin/env php
<?php
include_once __DIR__.'/../../../../include/functions.inc.php';
ini_set('soap.wsdl_cache_enabled', '0');
ini_set('default_socket_timeout', 1000);
ini_set('max_input_time', '0');
ini_set('max_execution_time', '0');
ini_set('display_errors', '1');
ini_set('error_reporting', E_ALL);
Step 3 — Add argc check
Count is 1 (script) + number of positional args. <id> is always first.
- Host only (no vps param):
argc < 2 - Host + vps:
argc < 3 - Host + vps + 1 extra:
argc < 4 - Host + vps + 2 extras:
argc < 5
Usage die message format (match exactly):
// Host only (e.g. GetVMList):
if ($_SERVER['argc'] < 2) {
die("Call like {$_SERVER['argv'][0]} <id>\nwhere <id> is the VPS Master / Host Server ID\nuse 423 for Hyperv-dev and 440 for Hyperv1\n");
}
// Host + vps (most common):
if ($_SERVER['argc'] < 3) {
die("Call like {$_SERVER['argv'][0]} <id> <vps>\nwhere <id> is the VPS Master / Host Server ID\nuse 423 for Hyperv-dev and 440 for Hyperv1\n and <vps> is the id of a vps\n");
}
// Host + additional named params:
if ($_SERVER['argc'] < 5) {
die("Call like {$_SERVER['argv'][0]} <id> <name> <hdsize> <ramsize> [template]\nwhere <id> is the VPS Master / Host Server ID\nuse 423 for Hyperv-dev and 440 for Hyperv1\n");
}
Step 4 — Add host lookup and SOAP call
This output from Step 3 feeds into the try block:
$master = get_service_master($_SERVER['argv'][1], 'vps', true);
try {
$params = \Detain\MyAdminHyperv\Plugin::getSoapClientParams();
$soap = new SoapClient("https://{$master['vps_ip']}/HyperVService/HyperVService.asmx?WSDL", $params);
$response = $soap->MethodName(
[
'vmId' => $_SERVER['argv'][2],
'hyperVAdmin' => 'Administrator',
'adminPassword' => $master['vps_root']
]
);
print_r($response->MethodNameResult);
} catch (Exception $e) {
echo 'Caught exception: '.$e->getMessage().PHP_EOL;
}
Rules for the params array:
vmIdmaps to$_SERVER['argv'][2](the vps arg)- Additional params use
$_SERVER['argv'][3],[4], etc. in order hyperVAdminis always'Administrator'— hardcoded, never from argvadminPasswordis always$master['vps_root']- For operations with no vmId (e.g.,
GetVMList): omitvmId, keep onlyhyperVAdmin+adminPassword
Result printing:
- Query/action operations:
print_r($response->{MethodName}Result); - Create operations that return the full object:
print_r($response);
Step 5 — Verify the script
Run against dev host (id 423) — using bin/GetVMState.php as the example:
php bin/GetVMState.php 423
# Should print usage die message
php bin/GetVMState.php 423 <vmId>
# Should print SOAP response or 'Caught exception: ...'
Verify no PHP parse errors: php -l bin/GetVMState.php
Examples
User says: "Add a bin script for the GetVMState SOAP method that takes a host id and vps id"
Actions:
- Method name:
GetVMState, params:<id> <vps>, result key:GetVMStateResult - argc check:
< 3(host + vps) - Create
bin/GetVMState.php:
#!/usr/bin/env php
<?php
include_once __DIR__.'/../../../../include/functions.inc.php';
ini_set('soap.wsdl_cache_enabled', '0');
ini_set('default_socket_timeout', 1000);
ini_set('max_input_time', '0');
ini_set('max_execution_time', '0');
ini_set('display_errors', '1');
ini_set('error_reporting', E_ALL);
if ($_SERVER['argc'] < 3) {
die("Call like {$_SERVER['argv'][0]} <id> <vps>\nwhere <id> is the VPS Master / Host Server ID\nuse 423 for Hyperv-dev and 440 for Hyperv1\n and <vps> is the id of a vps\n");
}
$master = get_service_master($_SERVER['argv'][1], 'vps', true);
try {
$params = \Detain\MyAdminHyperv\Plugin::getSoapClientParams();
$soap = new SoapClient("https://{$master['vps_ip']}/HyperVService/HyperVService.asmx?WSDL", $params);
$response = $soap->GetVMState(
[
'vmId' => $_SERVER['argv'][2],
'hyperVAdmin' => 'Administrator',
'adminPassword' => $master['vps_root']
]
);
print_r($response->GetVMStateResult);
} catch (Exception $e) {
echo 'Caught exception: '.$e->getMessage().PHP_EOL;
}
- Verify:
php -l bin/GetVMState.php→ no errors,php bin/GetVMState.php 423→ prints usage.
Result: bin/GetVMState.php created, identical in structure to bin/GetVM.php.
Common Issues
PHP Fatal error: Uncaught SoapFault: WSDL
- The host is unreachable or the WSDL URL is wrong. Confirm
$master['vps_ip']is set: addvar_dump($master);before the try block. - Confirm
ini_set('soap.wsdl_cache_enabled', '0')is present — missing it causes stale WSDL cache failures.
PHP Fatal error: Call to undefined function get_service_master()
- The
include_oncepath is wrong. Script must be inbin/(four levels from project root). If placed elsewhere, adjust the relative path tofunctions.inc.php.
Notice: Undefined property: stdClass::$MethodNameResult
- The result key doesn't match. Run
bin/WsdlInfo.phpto inspect exact property names, or useprint_r($response)temporarily to dump the full response object.
Caught exception: Could not connect to host
default_socket_timeouttoo low for slow hosts — it is set to1000seconds in the boilerplate, which is correct. If still failing, verify the host server id (423= Hyperv-dev,440= Hyperv1).
argc check never triggers / script runs with missing args
- Ensure the comparison is
< Nnot<= N. For 2 positional args (<id> <vps>), the count is 3 (including script name), so use$_SERVER['argc'] < 3.
When not to use it
- →When creating asynchronous SOAP variants (use `async-soap-script` instead)
- →When adding methods to `Plugin.php`
- →When the user does not need a synchronous SOAP operation script
Limitations
- →Does not create asynchronous SOAP variants
- →Not for adding methods to `Plugin.php`
- →Requires the script to be placed in the `bin/` directory
How it compares
This skill automates the creation of SOAP operation scripts with strict adherence to a boilerplate, enforcing security practices and argument validation, which is more reliable than manual script creation.
Compared to similar skills
soap-bin-script side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| soap-bin-script (this skill) | 0 | 4mo | Review | Intermediate |
| laravel-specialist | 12 | 3mo | No flags | Intermediate |
| laravel-query-builder | 0 | 2mo | No flags | Intermediate |
| laravel-development | 0 | 3mo | No flags | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by myadmin-plugins
View all by myadmin-plugins →You might also like
laravel-specialist
Jeffallan
Use when building Laravel 10+ applications requiring Eloquent ORM, API resources, or queue systems. Invoke for Laravel models, Livewire components, Sanctum authentication, Horizon queues.
laravel-query-builder
relaticle
Build filtered, sorted, and included API endpoints using spatie/laravel-query-builder. Activates when working with QueryBuilder, AllowedFilter, AllowedSort, AllowedInclude, or when the user mentions query parameters, API filtering, sorting, includes, or spatie/laravel-query-builder.
laravel-development
monicahq
Expert guidance for Laravel PHP development following best practices, SOLID principles, and Laravel conventions
Laravel Invite Only
offload-project
Conventions and APIs for the offload-project/laravel-invite-only package — polymorphic invitations, token acceptance, bulk invites, scheduled reminders, and event-driven hooks.
woocommerce-backend-dev
woocommerce
Add or modify WooCommerce backend PHP code following project conventions. Use when creating new classes, methods, hooks, or modifying existing backend code. **MUST be invoked before writing any PHP unit tests.**
model
JaguarJack
Generate Eloquent model for CatchAdmin module with full CatchModel features.