notfalsedev / laravel-soap Goto Github PK
View Code? Open in Web Editor NEWA soap client wrapper for Laravel
License: MIT License
A soap client wrapper for Laravel
License: MIT License
FatalThrowableError in Service.php line 330: Call to a member function __setCookie() on null
i get this when i try to add cookie ->cookie('randomName','blablabla')
public function cookie($name, $value)
{
$this->client->__setCookie($name, $value); // <--- line 330
return $this;
}
Hi,
your documentation says that the service can be added like this:
SoapWrapper::add(function ($service) {
$service
->name('currency')
->wsdl('http://currencyconverter.kowabunga.net/converter.asmx?WSDL')
->options(['login' => 'username', 'password' => 'password']); // Optional: Set some extra options
});
So you can chain the options-method after the wsdl-method. In fact, the client-object is created in the wsdl-method. If you chain "options([])" after "wsdl(...)", your options will be ignored. You have to add the service like this:
SoapWrapper::add(function ($service) {
$service
->name('currency')
->options(['login' => 'username', 'password' => 'password']) // Optional: Set some extra options
->wsdl('http://currencyconverter.kowabunga.net/converter.asmx?WSDL');
});
$data = [
'memberID' => $memberId
];
// Using the added service
SoapWrapper::service('validMemberId', function ($service) use ($data,$memberId) {
//var_dump($service->getFunctions());
$returned_result = $service->call('CheckMemberID', [$data])->CheckMemberIDResult;
if($returned_result==$memberId){
//return $returned_result;
return 'ok';
exit;
}
else{
//return 'Fail: ('.$returned_result.')';
return 'fail';
exit;
}
});
return 'conditions not met - '.$returned_result.' / '.$memberId;
So there are no SOAP or Laravel errors being generated. I know the $memberId
being sent is correct because if I run this command outside Laravel I get this result:
object(stdClass)#4 (1) { ["CheckMemberIDResult"]=> int(550474) }
The issue is that $returned_result is not receiving the result of $service->call
Additionally the else{} statement is not being triggered, which I find plain odd.
Any ideas - and thank you for your patience - as this is undoubtedly my fault :) - thanks for providing this interface though as it makes connecting to a SOAP service really easy!
Martin
FatalThrowableError in Service.php line 356:
Fatal error: Class 'SoapClient' not found
I' dont know what am i doing wrong
this is my controller:
`<?php
namespace cajas\Http\Controllers;
use Artisaninweb\SoapWrapper\Facades\SoapWrapper;
class SoapController extends controller{
public function demo()
{
// Add a new service to the wrapper
SoapWrapper::add(function ($service) {
$service
->name('currency')
->wsdl('http://currencyconverter.kowabunga.net/converter.asmx?WSDL');
});
$data = [
'CurrencyFrom' => 'USD',
'CurrencyTo' => 'EUR',
'RateDate' => '2014-06-05',
'Amount' => '1000'
];
}
}`
And the route:
Route::get('/demo', 'SoapController@demo');
Heya,
I'm having issue detecting when a SOAP Error/Exception is thrown.
I'm in Laravel 4. This function works fine when valid data is sent, but I'm trying to catch a Soap Fault for when invalid data is sent.
SoapWrapper::service('RetrieveMember', function ($service) use ($data,$memberId,&$pin_number,&$date_of_birth,&$post_code,&$returned_result,&$member_details,&$AllMemberFields){
try{
$response = $service->call('RetrieveMember', [$data]);
array_push($AllMemberFields,$response->RetrieveMemberResult);
//array_push($AllMemberFields,$service->call('RetrieveMember', [$data])->RetrieveMemberResult);
}
catch(SoapFault $e){
return 'Invalid user ID';
//exit (not sure if you need this as 'return' effectively finished the function)
}
});
I just get this error:
Server was unable to process request. ---> No values returned from stored procedure
But I can't see how to tell my Laravel Controller that no value was returned, stop the current function and throw a proper error.
Hope someone here can help,
Thanks,
Martin
Hello,
I'm implementing sabre api in a web application.
Trying to implement the following body and authentication header to laravel-soap class format.
Request Body
<EnhancedAirBookRQ version="3.1.0" xmlns="http://services.sabre.com/sp/eab/v3_1" HaltOnError="true">
<OTA_AirBookRQ>
<OriginDestinationInformation>
<FlightSegment DepartureDateTime="2014-06-03T12:30:00" FlightNumber="1022" NumberInParty="1" ResBookDesigCode="F" Status="NN">
<DestinationLocation LocationCode="LAS"/>
<MarketingAirline Code="US" FlightNumber="1022"/>
<OriginLocation LocationCode="DFW"/>
</FlightSegment>
</OriginDestinationInformation>
</OTA_AirBookRQ>
<PostProcessing IgnoreAfter="true">
<RedisplayReservation/>
</PostProcessing>
<PreProcessing IgnoreBefore="false">
<UniqueID ID="JEGYLT"/>
</PreProcessing>
</EnhancedAirBookRQ>
The authantication
<wsse:Security xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/12/secext" xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/12/utility">
<wsse:UsernameToken>
<wsse:Username>USERNAME</wsse:Username>
<wsse:Password>PASSWORD</wsse:Password>
<Organization>IPCC</Organization>
<Domain>DEFAULT</Domain>
</wsse:UsernameToken>
</wsse:Security>
Could you please help me to prepare this example request to use in laravel-soap plugin.
Thank you
SoapWrapper::add(function ($service) {
$service
->name('Step_1_SearchCruises')
->wsdl('http://demo-cruisews.touricoholidays.com/CruiseServiceFlow.svc?wsdl')
->trace(true) // Optional: (parameter: true/false)
->options(['login' => 'xxxxxx', 'password' => 'xxxxxx', 'Culture' => 'en_US', 'Version' => '8']); // Optional: Set some extra options
});
$data = [
'CruiseLineID' => '1260327',
'CruiseDestinationID' => '51',
'MarketCode' => 'US',
'Currency' => 'USD',
'DepartingFrom' => '2016-12-01',
'DepartingTo' => '2016-12-27',
'MinCruiseLength' => '0',
'MaxCruiseLength' => '999',
'PortID' => '3612',
'ShipID' => '0',
'IsSenior' => 'true',
'IsInterline' => 'true',
'IsMilitary' => 'true',
'IsPastPassenger' => 'true'
];
// Using the added service
SoapWrapper::service('Step_1_SearchCruises', function ($service) use ($data) {
print_r($service->getFunctions());
var_dump($service->call('GetCruiseLines', [$data])->GetCruiseLinesResult);
});
Hey there
How would I go about changing the endpoints?
SoapWrapper::add(function ($service) {
$service
->name('submit')
->wsdl('xxxxxxxxxxxxxxxxxxxxxxxxxxxx')
->trace(true)
->location('xxxxxxxxxxxxxxxxxxxxxx')
->cache(WSDL_CACHE_NONE);
});
Hi,
How do I add ws-addressing ?
thx
After updating from 0.2.4 to 0.2.5 using the model is throwing the following error now:
[2014-09-29 10:37:34] development.ERROR: exception 'ErrorException' with message 'array_merge(): Argument #2 is not an array' in /home/varar/laravel/vendor/artisaninweb/laravel-soap/src/Artisaninweb/SoapWrapper/Service.php:349
Stack trace:
#0 [internal function]: Illuminate\Exception\Handler->handleError(2, 'array_merge(): ...', '/home/varar/lar...', 349, Array)
#1 /home/varar/laravel/vendor/artisaninweb/laravel-soap/src/Artisaninweb/SoapWrapper/Service.php(349): array_merge(Array, NULL)
#2 /home/varar/laravel/vendor/artisaninweb/laravel-soap/src/Artisaninweb/SoapWrapper/Service.php(158): Artisaninweb\SoapWrapper\Service->createClient()
#3 /home/varar/laravel/vendor/artisaninweb/laravel-soap/src/Artisaninweb/SoapWrapper/Extension/SoapService.php(36): Artisaninweb\SoapWrapper\Service->wsdl('https://registe...')
#4 /home/varar/laravel/app/models/PCMedic.php(66): Artisaninweb\SoapWrapper\Extension\SoapService->__construct()
#5 /home/varar/laravel/app/controllers/API/PCMedicController.php(47): Varar\Models\PCMedic::createLicense(Array)
#6 [internal function]: Varar\Controllers\API\PCMedicController->create()
#7 /home/varar/laravel/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(231): call_user_func_array(Array, Array)
#8 /home/varar/laravel/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(93): Illuminate\Routing\Controller->callAction('create', Array)
#9 /home/varar/laravel/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(62): Illuminate\Routing\ControllerDispatcher->call(Object(Varar\Controllers\API\PCMedicController), Object(Illuminate\Routing\Route), 'create')
#10 /home/varar/laravel/vendor/laravel/framework/src/Illuminate/Routing/Router.php(962): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'Varar\\Controlle...', 'create')
#11 [internal function]: Illuminate\Routing\Router->Illuminate\Routing\{closure}()
#12 /home/varar/laravel/vendor/laravel/framework/src/Illuminate/Routing/Route.php(109): call_user_func_array(Object(Closure), Array)
#13 /home/varar/laravel/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1028): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request))
#14 /home/varar/laravel/vendor/laravel/framework/src/Illuminate/Routing/Router.php(996): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#15 /home/varar/laravel/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(777): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#16 /home/varar/laravel/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(747): Illuminate\Foundation\Application->dispatch(Object(Illuminate\Http\Request))
#17 /home/varar/laravel/vendor/laravel/framework/src/Illuminate/Session/Middleware.php(72): Illuminate\Foundation\Application->handle(Object(Illuminate\Http\Request), 1, true)
#18 /home/varar/laravel/vendor/laravel/framework/src/Illuminate/Cookie/Queue.php(47): Illuminate\Session\Middleware->handle(Object(Illuminate\Http\Request), 1, true)
#19 /home/varar/laravel/vendor/laravel/framework/src/Illuminate/Cookie/Guard.php(51): Illuminate\Cookie\Queue->handle(Object(Illuminate\Http\Request), 1, true)
#20 /home/varar/laravel/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Illuminate\Cookie\Guard->handle(Object(Illuminate\Http\Request), 1, true)
#21 /home/varar/laravel/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(643): Stack\StackedHttpKernel->handle(Object(Illuminate\Http\Request))
#22 /home/varar/laravel/public/index.php(49): Illuminate\Foundation\Application->run()
#23 {main} [] []
How can i change the url for endpoint?
This is part of the wsdl of FEDEX:
Package should have this in composer.json
in order to inform users that the dependency is missing
"require": {
"php": ">=5.4.0",
"ext-soap": "*"
},
Today I have updated from 0.2.5.7 to 0.2.5.8, and from this point my app stopped working, Im always getting -1 response. Downgrade to 0.2.5.7 helped to me. Is there significant changes that should be mentioned in readme?
when i call the method that contains the SoapWrapper code , i get this error :
SOAP-ERROR: Parsing WSDL: Missing with name 'ns:null'
please @artisaninweb could you help me, how can maka a request with the next structure :
<PosLogin>
<PosName>434343</PosName>
<UserName>33434</UserName>
<UserPass>c32d196fea8fcc528dfcb65456829b20</UserPass>
</PosLogin>
<PosMethod>
<MethodName>ReservaTopUp</MethodName>
<Params>
<CountryCode>32</CountryCode>
<PhoneNumber>343434</PhoneNumber>
<CardID>3434</CardID>
</Params>
</PosMethod>
Hey,
For some weird reason, I have to add a SSL cipher into the SOAP option.
It's a weird bug that appeared a week ago, I think because I upgraded OpenSSL. more info: http://willbradley.name/2012/10/03/workaround-for-php-error-in-ubuntu-12-04-soapclient-ssl-crypto-enabling-timeout/
Problem is I can't add stream_context_create when I am using SoapService Model.
For example this isn't possible:
protected $options = stream_context_create(array('foo'=>'bar'));
When tried to run this code apache stop.
i'm usin laragon in local machine.
namespace
App\Http\Controllers;
use Artisaninweb\SoapWrapper\Facades\SoapWrapper;
class SoapController extends Controller
{
public function demo()
{
// Add a new service to the wrapper
SoapWrapper::add(function ($service) {
$service
->name('TASASCAMBIO')
->wsdl('https://casacambioserv-cert.extra.bcv.org.ve:443/service/autorizacion?wsdl')
->trace(true); // Optional: (parameter: true/false)
//->header() // Optional: (parameters: $namespace,$name,$data,$mustunderstand,$actor)
//->customHeader($customHeader); // Optional: (parameters: $customerHeader) Use this to add a custom SoapHeader or extended class
//->cookie() // Optional: (parameters: $name,$value)
//->location() // Optional: (parameter: $location)
//->certificate() // Optional: (parameter: $certLocation)
//->cache(WSDL_CACHE_NONE) // Optional: Set the WSDL cache
//->options(['Username' => '', 'Password' => '']); // Optional: Set some extra options
});
/*$data = [
'CurrencyFrom' => 'USD',
'CurrencyTo' => 'EUR',
'RateDate' => '2014-06-05',
'Amount' => '1000'
];*/
SoapWrapper::service('TASASCAMBIO', function ($service){ // use ($data) {
var_dump($service->getFunctions());
var_dump($service->call('TASASCAMBIO')->TASASCAMBIOResponse);
});
}
}
The structure of the XML request needs to contain and define a type, like this....
<RequestDetails xsi:type="PostcodeRequest">
<Postcode>BN12 123</Postcode>
</RequestDetails>
How do I pass/define the xsi:type when making this request?
I have tried:
"RequestDetails" => [
"RequestType" => "PostcodeRequest",
"_" => [
"Postcode" => $parameter
]
],
And without type:
"RequestDetails" => [
"Postcode" => $parameter
],
Any suggestions are very much appreciated. Thanks
Upon checking your wrapper classes, it seems this is useful not just on Laravel Framework but also to other frameworks/micro such as Slim/Phalcon/Symfony and many more.
This project I think must only focused on the Laravel as a provider.
Hoping you could separate the class into a separated repository to be agnostic.
Hi, I 'm using a webservice and I can not pass the information of this type :
<![CDATA[<IN> <CONSULTA> <DNI>41304499</DNI> </CONSULTA> <IDENTIFICACION> <CODUSER>N00003</CODUSER> <CODTRANSAC>5</CODTRANSAC> <CODENTIDAD>03</CODENTIDAD> <SESION>a8302129d43e0f0166054c0997c7de36a3daca76eea91650d1aae1ac73e47009e50a2ea6a84d773989332e6f60bf0fcc84dd9b1937264f1a20c6daf1310c257d</SESION> </IDENTIFICACION> </IN>]]>
Please indicate what would be the procedure to send the data.
Greetings.
Hello I really liked the flexibility of this Soap Client Plugin but I am a PHP developer and I could not figure out why the response returns different result if one or many appear. I searched a lot and found only one correct answer and I fixed it for myself here is the question that other dev asked more explanatory:
response with one:
object(stdClass)#2 (1) {
["return"]=>
object(stdClass)#3 (1) {
["row"]=>`
object(stdClass)#4 (1) {
["pkid"]=>
string(36) "9dbd9b32-8d64-41ad-a355-8f62e050ffce"
}
}
}
with more than one:
object(stdClass)#2 (1) {
["return"]=>
object(stdClass)#3 (1) {
["row"]=>
array(2) {
[0]=>
object(stdClass)#4 (1) {
["pkid"]=>
string(36) "fa0540f7-8e75-481b-a193-7a06d7f601a8"
}
[1]=>
object(stdClass)#5 (1) {
["pkid"]=>
string(36) "fa0c8c7a-79be-4667-ae70-c3e773908b52"
}
}
}
}
and to see why this is a problem:
for one:
foreach ($response->return as $row){
var_dump($row->pkid);
}
for more than one:
foreach ($response->return->row as $row){
var_dump($row->pkid);
}
So after I saw that's my case I simply added the 'features'=>SOAP_SINGLE_ELEMENT_ARRAYS function to the controllers approach in the options:
.....
->options(['login' => 'username', 'password' => 'password', 'features'=>SOAP_SINGLE_ELEMENT_ARRAYS]);
.....
This fixed the problem and now every response no mater if one or many, returns properly.
I think it is really strange that it was hard to find why this was happening and I'm just presenting you this matter to review.
FatalErrorException in Service.php line 348:
Call to a member function __setLocation() on null
i get this when i add my location url to:
->location('https://....')
to fix this and make my add work i added location in:
->options(['location'=>'https://....'])
Previously with SOAP in a PHP application I've used the in-built PHP SoapClient() functions. When I set up the client and then apply
$client->CheckMemberID(array('memberID'=>$memberID)); $returned_result = $result->CheckMemberIDResult
I get a result.
In your soap for Laravel:
$data = [
'memberID' => $memberId
];
SoapWrapper::service('validMemberId', function ($service) use ($data) { var_dump($service->call('CheckMemberID', $data)->CheckMemberIDResult); });
I get an empty array.
I've debugged this far - so I know it's connecting and the SOAP Client authorises fine (The AuthHeader is being passed fine).
It's just this final step- any help gratefully received! Thanks!
Hi,
I have a problem passing params as array to the Service::call function. If I do so, I receive the error msg
Array to string conversion
My call looks like your example:
SoapWrapper::service('calculate_bic', function($service) use ($data) {
var_dump($service->getFunctions());
var_dump($service->call('validate_iban', $data));
});
with data being an array.
I could fix the issue by replacing line 91 in Service.php from
return $this->client->{$function}($params);
to
return call_user_func_array( [$this->client, $function], $params );
Is this a bug or have i done something wrong?
With the following code, I'm getting an exception:
SoapWrapper::add(function ($service) {
$service
->name('getEntgelteMitNetzbetreiberDaten')
->wsdl('WSDL_URL')
->trace(false)
->cache(WSDL_CACHE_NONE);
});
$auth= array('auth_LoginName' => 'USERNAME', 'auth_Passwort' => 'PASSWORD');
$params_simple = array (
'rec' => $auth,
'param' => array(
'abrechnungIntervall' => 1,
'ausgabeKonfiguration' => 0,
'ausgabeKonfigurationLength' => '',
'druckstufe' => 1,
'konzessionsabgabe' => 1,
'lasttyp' => 0,
'leistung' => 11,
'zaehlerGroesse' => 10000,
'zaehlerTyp' => 0,
'plz' => 82140
)
);
$response = '';
SoapWrapper::service('METHODNAME',function($service) use ($params_simple,&$response) {
$response = $service->call('METHODNAME', $params_simple);
});
return response()->json($response->return);
If I use the same param with the native PHP SoapClient, it works fine:
$auth= array('auth_LoginName' => 'USERNAME', 'auth_Passwort' => 'PASSWORD');
$wsdl_file='WSDL_URL;
$client = new SoapClient ( $wsdl_file , array ('encoding' => 'ISO-8859-1', 'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP ) );
$params_simple = array (
'rec' => $auth,
'param' => array(
'abrechnungIntervall' => 1,
'ausgabeKonfiguration' => 0,
'ausgabeKonfigurationLength' => '',
'druckstufe' => 1,
'konzessionsabgabe' => 1,
'lasttyp' => 0,
'leistung' => 20000,
'zaehlerGroesse' => 0,
'zaehlerTyp' => 0,
'plz' => 82140
)
);
$result = $client -> METHODNAME ($params_simple);
echo "<pre>"; print_r($result->return);
Any ideas, what I'm doing wrong?
I start to think that you can't really create nested tags like this:
<soapenv:Header/>
<soapenv:Body>
<ns:GetTariffRequest>
<NeedList>0</NeedList>
<SessionToken>SAZANMVE4YP2IATMPvEA7A5DYdLjOaFAPAOf</SessionToken>
<TariffParameters>
<Agreement>
<General>
<Product>1350357003</Product>
<ProductItemList>
<ProductItem>2490061403</ProductItem>
<ProductItem>4984235603</ProductItem>
</ProductItemList>
<DateBeg>2016-02-11T00:00:00</DateBeg>
<DateEnd>2017-02-10</DateEnd>
<Currency>RUR</Currency>
<CitySales>77000000000</CitySales>
</General>
Take a look here plz:
http://stackoverflow.com/questions/35345115/laravel-soap-multilevel-tag-structure
I have an error,
Missing argument 1 for Artisaninweb\SoapWrapper\Service::header(),
Thanks
I tried to preserve the result of the response in a session, but when the request ends the session ends.
I am implementing something wrong or is it really a bug?
<?php
namespace M2Digital\Domains\Bens;
use M2Digital\Infrastructure\Wsdl\Soap;
class BemSoap extends Soap
{
/**
* @var string
*/
protected $method = 'DADOS_BENS';
protected $data;
/**
* Get all data.
*
* @return array
*/
public function all()
{
if (! session()->has('WSDL_DADOS_BENSRESULT')) {
session()->put('WSDL_DADOS_BENSRESULT', $this->call($this->method, [])->DADOS_BENSRESULT->BENS);
}
return session('WSDL_DADOS_BENSRESULT');
}
}
It would be useful to be able to see the XML request that is being generated so that its structure can be checked.
I found this:
http://stackoverflow.com/questions/3572414/how-do-i-see-the-actual-xml-generated-by-php-soap-client-class#3572445
... but I can't figure out how to get these suggestions to work with this Laravel component.
Hi artisaniweb,
I saw that you fixed some issues which caused the same error. Unfortunately I still get this error.
ErrorException in Service.php line 186: Array to string conversion
in Service.php line 186
at HandleExceptions->handleError('8', 'Array to string conversion', 'C:\xampp\htdocs\cam\laravel\vendor\artisaninweb\laravel-soap\src\Artisaninweb\SoapWrapper\Service.php', '186', array('function' => 'GetSystems', 'params' => array(array('Server' => 'World'))))
at SoapClient->__call('GetSystems', array(array('Server' => 'World')))
at SoapClient->GetSystems(array('Server' => 'World'))
at call_user_func_array(array(object(SoapClient), 'GetSystems'), array(array('Server' => 'World'))) in Service.php line 186
at Service->call('GetSystems', array(array('Server' => 'World'))) in SoapGetSystemsController.php line 31
at SoapGetSystemsController->App\Http\Controllers\{closure}(object(Service)) in Wrapper.php line 57
at Wrapper->service('getsystems', object(Closure)) in Facade.php line 213
...
I implemented the code exactly in the way you described.
class SoapGetSystemsController extends Controller{
public function demo()
{
// Add a new service to the wrapper
SoapWrapper::add(function ($service) {
$service
->name('getsystems')
->wsdl('xxxxxxxxxxxxxxxx')
->trace(true) // Optional: (parameter: true/false)
->cache(WSDL_CACHE_NONE) // Optional: Set the WSDL cache
->options(['login' => 'xxxxxxxxxxxxxx', 'password' => 'xxxxxxxxxxxxxx']); // Optional: Set some extra options
});
$data = [
'Server' => 'World'
];
// Using the added service
SoapWrapper::service('getsystems', function ($service) use ($data) {
var_dump($service->getFunctions());
var_dump($service->call('GetSystems', [$data])->GetSystemsResult);
});
return view('systemaccess.getsystems')->with('data', $data);
}
}
Only if I store a string for $data, I get an other result, but this could be not the way as I have to pass some (XML) data with the SOAP request. I would be very happy, if you could help me with this issue.
Best regards
Jakob
I want to implement this in a Laravel project. I copied the example in the read me but it's not working it says the webservice (Currency) can't be found
Hi,
I'm new to SOAP, and the documentation of your "library" is very limited so I wanted to ask you why I'm receiving the following error (below); My WSDL xml file can be access by tipying the url in the browser, so I'm not sure if I did something wrong.
SOAP-ERROR: Parsing WSDL: Couldn't load from "http://:..."
WSDL' : failed to load external entity "http://"
this is my code
SoapWrapper::add(function ($service) {
$service
->name('getItemRequest')
->wsdl('http://xxxxxxxxxxxx?WSDL')
->trace(true) // Optional: (parameter: true/false)
//->header()// Optional: (parameters: $namespace,$name,$data,$mustunderstand,$actor)
//->cookie() // Optional: (parameters: $name,$value)
//->location() // Optional: (parameter: $location)
->cache(WSDL_CACHE_NONE) // Optional: Set the WSDL cache
->options(['proxy_host' => "xxxxxxx", 'proxy_port'=> 000,'proxy_login'=> "###",'proxy_password' => "xxxxx"]);// Optional: Set some extra options
});
I needed it to set the proxy configuration because at the beginning I was receiving the following error:
SOAP-ERROR: Parsing Schema: can't import schema from 'http://www.w3.org/2005/05/xmlmime'
This was solved, but now I received the other error. I tried to search info about this, but I have not found anynthing useful yet.
My xml envelope is like this:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:int="http://webservice.mks.com/10/Integrity"
xmlns:sch="http://webservice.mks.com/10/Integrity/schema">
<soapenv:Header/>
<soapenv:Body>
<int:getItem>
<!--Optional:-->
<arg0 transactionId="?" sch:ItemId="11111">
<sch:Username>xxxxx</sch:Username>
<sch:Password>xxxxxx</sch:Password>
<!--Zero or more repetitions:-->
<sch:InputField>Summary</sch:InputField>
</arg0>
</int:getItem>
</soapenv:Body>
</soapenv:Envelope>
Thanks! :)
I am trying to post something, but I cannot get the result while simple cURL get the result.
Can I mentioned anywhere that it is post request?
Thanks,
Cannot process the message because the content type 'text/xml; charset=utf-8' was not the expected type 'application/soap+xml; charset=utf-8'.
Server was unable to process request. ---> Procedure or function 'www2_ProductInfo' expects parameter '@name', which was not supplied.
This error appeared in v0.2.5.8, my code works in v0.2.5.7.
I keep receiving this error every time. My wsdl file: http://retina.cannybee.in/services.wsdl
Can you please check it once
#0 [internal function]: SoapClient->__doRequest('<?xml version="...', 'http://202.78.1...', 'http://tempuri....', 1, 0)
#1 [internal function]: SoapClient->__call('UploadData', Array)
#2 [internal function]: SoapClient->UploadData(Array)
I can't find a way to handle SoapFault exception and to avoid application crash, i need to handle it gently.
Here is my code :
public function CleanseAddress(UserBillingShipping $address){
$authenticator = self::getAuthenticator();
$response = null;
SoapWrapper::service('usps', function ($service) use (&$response, $authenticator, $address){
try {
$request = [$authenticator[0] => $authenticator[1]];
$request['Address'] = self::parseAddress($address);
$response = $service->call('CleanseAddress',[$request]);
self::setAuthenticator($response->Authenticator);
} catch (SoapFault $fault) {
trigger_error("SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})", E_USER_ERROR);
}
});
return $response;
}
but, it does not catch SoapFault, it just breaks
how to know the parameter class if the type is complex type?
Hey,
I might be doing this wrong. I uploaded your module to the vendors folder and then followed your 'installation' process. I now get this error:
Class 'Artisaninweb\SoapWrapper\ServiceProvider' not found
Any idea what I could be doing wrong?
Thanks in advance!
Unable connect to host when using WSDL host uses port.
I`ve solved this issue by modifying getOptions() method to:
public function getOptions()
{
$options = [
'proxy_host' => parse_url($this->getWsdl(), PHP_URL_HOST),
'proxy_port' => parse_url($this->getWsdl(), PHP_URL_PORT),
'trace' => $this->getTrace(),
'cache_wsdl' => $this->getCache()
];
if ($this->certificate) {
$options['local_cert'] = $this->certificate;
}
$this->options = array_merge($options, $this->options);
return $this->options;
}
this is error i get:
SoapFault in Service.php line 218: Object reference not set to an instance of an object.
there is my code:
SoapWrapper::add(function ($service) {
$service
->name('multipass')
->wsdl('http://84.94.223.15/MultipassServices/GenericTransactionsService.svc?wsdl')
->trace(true);
});
$data = [
'OrganizationCode' => '44',
'OrganizationUserName' => 'StandardPOS',
'OrganizationPassword' => 'StandardPOS1562',
'PosId' => 11299,
'CardCode' => '21890001016144650',
'TranType' => 'T',
'IsMaster'=> 'N',
'MasterAmount' => '0',
'tranSum' => 3000,
'tranValue' => 3000,
];
SoapWrapper::service('multipass', function ($service) use ($data) {
dd($service->call('AddTransaction', [$data]));
});
Hi,
More info as how to use SoapService as model, atm with the example from docs i get this error:
Non-static method App\Soap::functions() should not be called statically, assuming $this from incompatible context
Thanks!
I had to bypass the SoapService
constructor and create the client myself to avoid the thrown exception.
Instead, I just have $this->createClient();
to initialise the client.
But following this 'hack', I could use the service OK.
It would be good if laravel-soap supported non-WSDL mode by default.
Can you please help me. Trying to test it in both Laravel 4.2 and Laravel 5 but can't get it to work. Did I miss anything?
http://www.webservicex.net/CurrencyConvertor.asmx?op=ConversionRate
Here's my Controller
<?php
use Artisaninweb\SoapWrapper\Facades\SoapWrapper;
class SoapController extends BaseController {
public function demo()
{
SoapWrapper::add(function ($service) {
$service->name('ConversionRate')->wsdl('http://www.webservicex.net/CurrencyConvertor.asmx?WSDL');
});
$data = [
'FromCurrency' => 'AUD',
'ToCurrency' => 'USD'
];
SoapWrapper::service('ConversionRate', function ($service) use ($data) {
var_dump($service->getFunctions());
var_dump($service->call('ConversionRate',$data)->ConversionRateResult);
});
}
}
And here's the output.
array(2) { [0]=> string(65) "ConversionRateResponse ConversionRate(ConversionRate $parameters)" [1]=> string(65) "ConversionRateResponse ConversionRate(ConversionRate $parameters)" } float(-1)
How can i change the url for endpoint?
This is part of the wsdl of FEDEX:
<operation name="getRates">
<s1:operation soapAction="http://fedex.com/ws/rate/v18/getRates" style="document"/>
<input>
<s1:body use="literal"/>
</input>
<output>
<s1:body use="literal"/>
</output>
</operation>
</binding>
<service name="RateService">
<port name="RateServicePort" binding="ns:RateServiceSoapBinding">
<!--<s1:address location="https://ws.fedex.com:443/web-services/rate"/>-->
<s1:address location="https://wsbeta.fedex.com:443/web-services/rate"/>
Hello, I am trying to make a request, i am using it as model.
i created a method inside the class:
class Client extends SoapService
like..
public function myMethod()
{
return $this->call('myMethod', [
'in0' => '-1',
'in1' => $this->credentials['username'],
'in2' => $this->credentials['password']]);
}
what could be the problem?
Hello,
I have a problem when I try to pass Cdata to one request. It changes every special character like this:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:xxxxx.ws" xmlns:ns2="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><SOAP-ENV:Header>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:UsernameToken>
<wsse:Username>teste</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">teste</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</SOAP-ENV:Header><SOAP-ENV:Body>
<ns1:contratarSeguro>
<ns1:produto>1</ns1:produto>
<ns1:canalVenda>Site</ns1:canalVenda>
<ns1:operacaoParceiro>1</ns1:operacaoParceiro>
<ns1:parametros><!CDATA[
<parametros>
<nomeSegurado>RenanLeme</nomeSegurado>
<inicioVigencia>2014-11-11</inicioVigencia>
<fimVigencia>2014-12-11</fimVigencia>
<email>[email protected]</email>
<dataNascimento>1990-10-17</dataNascimento>
<tipoDocumento>C</tipoDocumento>
<documento>1234456789</documento>
<premioSeguro>25.00</premioSeguro>
<planoProduto>1</planoProduto>
</parametros></ns1:parametros>
</ns1:contratarSeguro>
</SOAP-ENV:Body></SOAP-ENV:Envelope>
My Code is:
$data = [
'produto' => 1,
'canalVenda' => 'Site',
'operacaoParceiro' => 1,
'parametros' => "<!CDATA[
<parametros>
<nomeSegurado>RenanLeme</nomeSegurado>
<inicioVigencia>2014-11-11</inicioVigencia>
<fimVigencia>2014-12-11</fimVigencia>
<email>[email protected]</email>
<dataNascimento>1990-10-12</dataNascimento>
<tipoDocumento>C</tipoDocumento>
<documento>132456789</documento>
<premioSeguro>25.00</premioSeguro>
<planoProduto>1</planoProduto>
</parametros>"
];
Is there a way to fix that? I tried but I couldn't find.
I'm trying to use this package, but I can't seem to login to a soap server. It is required to send a login operation before sending any other operation. Any help would be appreciated.
Is there extended document for this package on how to use? I am not able to retrieve value from demo code. Its returning string '0' (length=1) for GetConversionAmountResult. But successfully getting service functions list. How to pass authentication & namespace parameters to soap_call?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.