-
-
Notifications
You must be signed in to change notification settings - Fork 27
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 pass credentials to client? #61
Comments
you need to pass a custom message factory to the client factory. someting like use Http\Discovery\Psr17FactoryDiscovery;
use Psr\Http\Message\RequestFactoryInterface;
use Psr\Http\Message\RequestInterface;
// get your factory , as example $factory = new ClientFactory($metadata, $serializer);
$baseMessageFactory = Psr17FactoryDiscovery::findRequestFactory();
$myMessageFactory = new MyMessageFactory($baseMessageFactory);
$factory->setMessageFactory($messageFactory);
class MyMessageFactory implements RequestFactoryInterface
{
private RequestFactoryInterface $parentFactory;
public function __construct(RequestFactoryInterface $parentFactory): RequestInterface
{
$this->parentFactory = $parentFactory;
}
public function createRequest(string $method, $uri): RequestInterface
{
$message = $this->parentFactory->createRequest($method, $uri);
$message = $message->withHeaders(...); // add here your auth headers as example
return $message;
}
} |
Thanks, but I have an additional problem, I cannot generate the metadata because also to access to WSDL during metadata generation needs credentials... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I need to pass credentials to soap client, is there an example to do this?
The text was updated successfully, but these errors were encountered: