我正在使用Laravel SOAP Wrapper在我的应用程序中集成SOAP API:
https://github.com/artisaninweb/laravel-soap
除非我在登录API时感到困惑,请参阅下面的代码。我总是得到一个虚假凭证错误,而它在在线SOAP客户端中运行得非常好。
$request = $this->soapWrapper->add('Auto', function ($service) {
$service
->wsdl('WSDL URL') // The WSDL url
->trace(true) // Optional: (parameter: true/false)
->cache(WSDL_CACHE_NONE) // Optional: Set the WSDL cache
// Optional: Set some extra options
->options([
'username' => 'xxx',
'password' => 'xxx'
]);
});
// dd($request);
// Without classmap
$response = $this->soapWrapper->call('Auto.method', [
'username' => 'xxx',
'password' => 'xxx',
]);
dd($response);
SOAP:
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="wdsl url">
<s:element name="method">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="credentials" type="tns:credentials"/>
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="credentials">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="username" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="password" type="s:string"/>
</s:sequence>
</s:complexType>
提前谢谢你们!