1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
$user = "musteruser"
$pass = "4711"
$URI = "http://SERVER:8080/inf-process-engine/soap?wsdl"
$secpasswd = ConvertTo-SecureString $pass -AsPlainText -Force
$credentials = New-Object System.Management.Automation.PSCredential($user, $secpasswd)
$Body = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://soap.service.engine.inf.com/"><soapenv:Header/>
<soapenv:Body><soap:instantiate><processUri>API_Test.ipd</processUri></soap:instantiate>
</soapenv:Body></soapenv:Envelope>'
$response = [xml](Invoke-WebRequest -Credential $credentials -Uri $URI -Headers (@{SOAPAction = 'instantiate'}) -Method Post -Body $Body -ContentType text/xml | Select-Object -Expand Content )
$executionId = $response.Envelope.Body.instantiateResponse.return.executionId
$var_a = 3
$var_b = 7
Write-Host "ExecutionID:" + $executionId
$Body = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://soap.service.engine.inf.com/" xmlns:dat="http://www.inf.com/datastore"><soapenv:Header/><soapenv:Body><soap:startProcess><executionId>' + $executionId + '</executionId><processParams><dat:entry name="a" type="x-xsd/integer"><dat:value>' + $var_a + '</dat:value></dat:entry><dat:entry name="b" type="x-xsd/integer"><dat:value>' + $var_b + '</dat:value></dat:entry></processParams></soap:startProcess></soapenv:Body></soapenv:Envelope>'
$response = [xml](Invoke-WebRequest -Credential $credentials -Uri $URI -Headers (@{SOAPAction = 'startProcess'}) -Method Post -Body $Body -ContentType text/xml | Select-Object -Expand Content)
Write-Host "Ergebnis: " + $response.Envelope.Body.startProcessResponse.return.pipeline.entry.value
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
use strict;
use LWP::UserAgent;
use HTTP::Request;
my $url_of_wsdl = "http://[SERVER]:8080/inf-process-engine/soap?wsdl";
my $username = "musteruser";
my $password = "4711";
my $message = "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:soap='http://soap.service.engine.inf.com/'><soapenv:Header/><soapenv:Body><soap:instantiate><processUri>API_Test.ipd</processUri></soap:instantiate></soapenv:Body></soapenv:Envelope>";
my $userAgent = LWP::UserAgent->new();
my $request = HTTP::Request->new(POST => $url_of_wsdl);
$request->authorization_basic( "$username", "$password" );
$request->content($message);
$request->content_type("text/xml; charset=utf-8");
my $response = $userAgent->request($request);
print $response->as_string;
2020-06-22T10:50:54 nyjoMöchte aber gerne SOAP::Lite verwenden/einsteigen.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
use strict;
use LWP::UserAgent;
use HTTP::Request;
use XML::Simple;
use Data::Dumper;
my $url_of_wsdl = "http://[SERVER]:8080/inf-process-engine/soap?wsdl";
my $username = "musteruser";
my $password = "4711";
my $xml = new XML::Simple;
my $message = "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:soap='http://soap.service.engine.inf.com/'><soapenv:Header/><soapenv:Body><soap:instantiate><processUri>API_Test.ipd</processUri></soap:instantiate></soapenv:Body></soapenv:Envelope>";
my $userAgent = LWP::UserAgent->new();
my $request = HTTP::Request->new(POST => $url_of_wsdl);
$request->authorization_basic( "$username", "$password" );
$request->content($message);
$request->content_type("text/xml; charset=utf-8");
my $response = $userAgent->request($request);
print $response->error_as_HTML unless $response->is_success;
my $data = $xml->XMLin( $response->content );
my $executionId = $data->{'S:Body'}->{'ns0:instantiateResponse'}->{'return'}->{executionId};
print "ExecutionID: ".$executionId."\n";
$message = "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:soap='http://soap.service.engine.inf.com/' xmlns:dat='http://www.inf.com/datastore'><soapenv:Header/><soapenv:Body><soap:startProcess><executionId>".$executionId."</executionId><processParams><dat:entry name='a' type='x-xsd/integer'><dat:value>3</dat:value></dat:entry><dat:entry name='b' type='x-xsd/integer'><dat:value>7</dat:value></dat:entry></processParams></soap:startProcess></soapenv:Body></soapenv:Envelope>";
$request->content($message);
$response = $userAgent->request($request);
print $response->error_as_HTML unless $response->is_success;
$data = $xml->XMLin( $response->content );
my $ergebnis = $data->{'S:Body'}->{'ns0:startProcessResponse'}->{'return'}->{'pe:pipeline'}->{'dat:entry'}->{'dat:value'};
print "Ergebnis: ".$ergebnis;