How can i send soap headers
I am unable to pass following authentication credentials in soap headers.
<soap:Header> <UserSessionCredentials xmlns=""> <UserId>int</UserId> <clientId>string</clientId><SessionId>string</SessionId> </UserSessionCredentials> </soap:Header> <soap:Body> <GetSaveTemplate xmlns=""> <templateName>string</templateName> </GetSaveTemplate> </soap:Body>
Also when i am trying to send headers in $service->header($namespace, $name, $data), its returning following error: Server was unable to process request. ---> Object reference not set to an instance of an object.
Any kind of help would be really appreciated.
Hello @notfalsedev and Team,
This library is really useful, but i am sort of stuck with this small part. Can you please help me here.
<?xml version="1.0" encoding="utf-8"?> <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"> <soap12:Header> <ClientHeader xmlns="http://retailexpress.com.au/"> <ClientID>id</ClientID> <UserName>username</UserName> <Password>password</Password> </ClientHeader> </soap12:Header> <soap12:Body> <CustomerGetDetails xmlns="http://retailexpress.com.au/"> <CustomerId>1</CustomerId> </CustomerGetDetails> </soap12:Body> </soap12:Envelope>
` serviceName : what ever you want to set $wsdl='https://www.domain.com/service.asmx?WSDL';
$this->soapWrapper->add('serviceName', function ($service) use ($wsdl) { $service ->trace(true) ->wsdl($wsdl) ->header('http://retailexpress.com.au/','ClientHeader',['ClientID' =>'id','UserName' => 'username', 'Password' => 'password'])
;
dump($service);
});
$this->soapWrapper->client('serviceName',function($client){ echo '
Functions
'; dump($client->getFunctions()); // echo'call
'; $response = $client->call('CustomerGetDetails',[]);
dd($response);
});
`