Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add headers in the envelope? #147

Closed
paulo-santos-ideahub opened this issue Jun 23, 2021 · 2 comments
Closed

How to add headers in the envelope? #147

paulo-santos-ideahub opened this issue Jun 23, 2021 · 2 comments
Labels

Comments

@paulo-santos-ideahub
Copy link

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
]);
@stale
Copy link

stale bot commented Jul 14, 2021

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@stale stale bot added the inactive label Jul 14, 2021
@stale
Copy link

stale bot commented Sep 12, 2021

Hey there, it's me again! I am going close this issue to help our maintainers focus on the current development roadmap instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Laravel Soap!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant