Thread Hilfe zu SOAP::Lite (Migration Powershell nach Perl) (4 answers)
Opened by nyjo at 2020-06-19 09:38

nyjo
 2020-06-23 10:45
#192374 #192374
User since
2005-01-11
17 Artikel
BenutzerIn
[Homepage] [default_avatar]
Hallo,
danke für die Info!

Werde folgenden Ansatz verwenden:
Code: (dl )
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;
alles wird gut

---

mfg

Joachim Nyenhuis

View full thread Hilfe zu SOAP::Lite (Migration Powershell nach Perl)