-
-
Notifications
You must be signed in to change notification settings - Fork 45
Description
I'm not sure if I'm misunderstanding the documentation, the feature doesn't exist, or if there's a way to do this with the existing features. I'm working with a SOAP API that specifies the following message format:
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="insert API namespace here">
<env:Header>
<ns1:Authenticate>
<AuthenticateRequest>
<id>my_id_here</id>
<key>my_key_here</key>
</AuthenticateRequest>
</ns1:Authenticate>
</env:Header>
<env:Body>
...
</env:Body>
</env:Envelope>
Based on the example used in withHeaders(), it appears that those add Http headers, not soap headers which is what I'm trying to do here. I did try putting it in withHeaders() but that didn't work with the api responding that the id and key are invalid.
$auth_header = [
'id' => $my_id,
'key' => $my_key
]
$response = Soap::withHeaders($auth_header)->baseWsdl($api_wsdl)->$api_method($params);
Calling their standalone authenticate endpoint does verify my credentials are valid which rules out the wrong credentials being provided.
$response = Soap::baseWsdl($api_wsdl)->Authenticate([
'id' => $my_id,
'key' => $my_key
]);
Attempting the following doesn't work either with the api complaining that my credentials were not valid and I suspect it's because it's being put into the body.
$auth_header = [
'AuthenticateRequest' => [
'id' => $my_id,
'key' => $my_key
]
];
$response = Soap::baseWsdl($api_wsdl)->$methodName([
'Authenticate' => $auth_header,
'other_params' => $values
]);