Coder Social home page Coder Social logo

laravel-soap's People

Contributors

anthonyblazejack avatar batrarri avatar feedbackmatters avatar jay-jay avatar notfalsedev avatar sebdesign avatar thijsvdanker avatar vitorbari avatar vshushkov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

laravel-soap's Issues

Call to a member function __setCookie() on null

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;
  }

Usage documentation wrong

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');
        });

Failing to Validate Again (Probably my fault)

$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

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');

Unable to catch Error

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

SOAP Request Format for Sabre Solutions

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

I make the following request and still get Internal Server Error !!!

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);
    });

Laravel SOAP Endpoints

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);
});

array_merge(): Argument #2 is not an array

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} [] []

Change url

How can i change the url for endpoint?

This is part of the wsdl of FEDEX:

Add soap extension dependency

Package should have this in composer.json in order to inform users that the dependency is missing

"require": {
  "php": ">=5.4.0",
  "ext-soap": "*"
 },

After update can't get response

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?

Error while calling the wsdl !

when i call the method that contains the SoapWrapper code , i get this error :

SOAP-ERROR: Parsing WSDL: Missing with name 'ns:null'

how to make a request

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>

Working locally and busting apache

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);
    });
}

}

How to pass element attributes, such as xsi:type

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

Separate the core classes

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.

Send XML as parameter data

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.

Response in single and many results

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.

Call to a member function __setLocation() on null

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://....'])

Nil results when query appears right

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!

Passing an array to the Service::call function

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?

not working with SoapWrapper - native SoapClient works

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?

Nested tags in soap request

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

Error

I have an error,
Missing argument 1 for Artisaninweb\SoapWrapper\Service::header(),

Thanks

How can I create a cache wsdl response?

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');
    }
}

ErrorException in Service.php line 186: Array to string conversion

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

Do you have some examples tutorials?

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

SOAP-ERROR: Parsing WSDL: Couldn't load from ...

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! :)

Cannot get POST request result.

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,

SoapFault in Service.php line 218

Cannot process the message because the content type 'text/xml; charset=utf-8' was not the expected type 'application/soap+xml; charset=utf-8'.

SoapFault Exception handling

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

Module Not Found

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 error, when

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;

}

error calling the service

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]));
        });

Usage as model extension

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!

Not able to use it in non-WSDL mode without hack

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.

Always String 0 or float -1

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)

Change url

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"/>

Not enough message parts were received for the operation.

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?

CDATA in $data

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>&lt;!CDATA[&#13;
                            &lt;parametros&gt;&#13;
                                &lt;nomeSegurado&gt;RenanLeme&lt;/nomeSegurado&gt;&#13;
                                &lt;inicioVigencia&gt;2014-11-11&lt;/inicioVigencia&gt;&#13;
                                &lt;fimVigencia&gt;2014-12-11&lt;/fimVigencia&gt;&#13;
                                &lt;email&gt;[email protected]&lt;/email&gt;&#13;
                                &lt;dataNascimento&gt;1990-10-17&lt;/dataNascimento&gt;&#13;
                                &lt;tipoDocumento&gt;C&lt;/tipoDocumento&gt;&#13;
                                &lt;documento&gt;1234456789&lt;/documento&gt;&#13;
                                &lt;premioSeguro&gt;25.00&lt;/premioSeguro&gt;&#13;
                                &lt;planoProduto&gt;1&lt;/planoProduto&gt;&#13;
                            &lt;/parametros&gt;</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.

Not able to authorize client

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.