Ik moet deze code sturen voor een soap-request, maar het lukt met niet dit voor elkaar te krijgen.
de wsdl = http://xxx.xxx.xxx.xxx:yyyy/wsdl/ICustomLinkSoap

kan iemand een simple PHP script maken die een respons geeft?

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Header xmlns:NS1="urn:UCoSoapDispatcherBase" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<NS1:TAuthenticationHeader xsi:type="NS1:TAuthenticationHeader">
<UserName xsi:type="xsd:string">portal</UserName>
<Password xsi:type="xsd:string">portal</Password>
</NS1:TAuthenticationHeader>
</SOAP-ENV:Header>
<SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<NS2:ExecuteRequest xmlns:NS2="urn:UCoSoapDispatcherCustomLink-ICustomLinkSoap">
<ARequest xsi:type="xsd:string">
<?xml version="1.0" encoding="windows-1252"?> <EoCustomLinkRequestDateTime Type="TEoCustomLinkRequestDateTime"></EoCustomLinkRequestDateTime>
</ARequest>
</NS2:ExecuteRequest>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

met onderstaande code lukt het niet:
<?php



$wsdl_url = 'http://xxx.xxx.xxx.xxx:yyyy/wsdl/ICustomLinkSoap';
$location = 'http://xxx.xxx.xxx.xxx:yyyy/soap/ICustomLinkSoap';
$action = 'ExecuteRequest';
$version = SOAP_1_1;
$one_way = 0;

$soapClient = new SoapClient('http://xxx.xxx.xxx.xxx:yyyy/wsdl/ICustomLinkSoap', array(
'cache_wsdl' => WSDL_CACHE_NONE,
'cache_ttl' => 86400,
'trace' => false,
'exceptions' => true,
));


$auth = array(
'UserName'=>'portal',
'Password'=>'portal',
);
$header = new SoapHeader($wsdl_url,'TAuthenticationHeader',$auth,false);
$soapClient->__setSoapHeaders($header);

$request = '
<ARequest>
<EoCustomLinkRequestDateTime Type="TEoCustomLinkRequestDateTime"></EoCustomLinkRequestDateTime>
</ARequest>
';

$xmlVar = new SoapVar($request, XSD_ANYXML);
$result = $soapClient->ExecuteRequest($request);

$functions = $soapClient->__getFunctions ();
var_dump($soapClient->__getLastResponse());
var_dump($soapClient->__getLastRequest());
?>
Wat lukt er niet aan met je PHP-script? Waar loop je tegenaan?
Ik krijg met het maken van de header de volgende code:

<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="urn:UCoSoapDispatcherCustomLink-ICustomLinkSoap"
xmlns:ns2="http://xxx.xxx.xxx.xxx:yyy/wsdl/ICustomLinkSoap"
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Header>
<ns2:TAuthenticationHeader>
<item><key>UserName</key><value>portal</value></item>
<item><key>Password</key><value>portal</value></item>
</ns2:TAuthenticationHeader>
</SOAP-ENV:Header>

<SOAP-ENV:Body>
<ns1:ExecuteRequest>
<ARequest>
<EoCustomLinkRequestDateTime Type="TEoCustomLinkRequestDateTime"></EoCustomLinkRequestDateTime>
</ARequest>
</ns1:ExecuteRequest>
</SOAP-ENV:Body>

</SOAP-ENV:Envelope>

twee zaken vallen op:
in de header staat:
<item><key>UserName</key><value>portal</value></item> i.p.v. <UserName>portal</UserName>

en in de header staat ns2 ipv ns1
en in de body staat ns1 ipv ns2


Toevoeging op 03/03/2016 14:41:26:

punt 1 heb ik opgelost.

$auth = array(
'UserName'=>'portal',
'Password'=>'portal',
);
<item><key>UserName</key><value>portal</value></item>

$auth = (object)array(
'UserName'=>'portal',
'Password'=>'portal',
);
<UserName>portal</UserName>

Nu punt 2 nog: ns1 en ns2 wisselen

Reageren