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

SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://currencyconverter.kowabunga.net/converter.asmx?WSDL' : failed to load external entity "http://currencyconverter.kowabunga.net/converter.asmx?WSDL" #182

Open
Rkant7767 opened this issue Apr 18, 2020 · 13 comments

Comments

@Rkant7767
Copy link

Hello sir,

I have used this package but, I am getting above mentioned error when trying to launch it.It seems that there is some issue with my configurations.Could you please help me with this????

@nguyenhiepvan
Copy link

i got this too :(

@K2ouMais
Copy link

K2ouMais commented May 7, 2020

I think this issue could be, because Soap isnt sending the user_agent.

I tried to set the user agent in ->options but it still doesnt work.

@nguyenhiepvan
Copy link

sloved

@K2ouMais
Copy link

K2ouMais commented May 7, 2020

Could you please tell us at least how you solved it?

@lichtner
Copy link

lichtner commented Jul 8, 2020

@nguyenhiepvan how did you solved it?

@Rkant7767
Copy link
Author

Rkant7767 commented Jul 8, 2020 via email

@wankimmy
Copy link

wankimmy commented Aug 5, 2020

image

solved !

@jalvarado-it
Copy link

jalvarado-it commented Jan 23, 2021

I created this controller SoapController.php

<?php

namespace App\Http\Controllers;

use Artisaninweb\SoapWrapper\SoapWrapper;
use App\Soap\Request\GetConversionAmount;
use App\Soap\Response\GetConversionAmountResponse;

class SoapController
{
  /**
   * @var SoapWrapper
   */
  protected $soapWrapper;

  /**
   * SoapController constructor.
   *
   * @param SoapWrapper $soapWrapper
   */
  public function __construct(SoapWrapper $soapWrapper)
  {
    $this->soapWrapper = $soapWrapper;
  }

  /**
   * Use the SoapWrapper
   */
  public function show()
  {
    $response = 'empty';

    if(isset($this->soapWrapper)){
        $this->soapWrapper->add('Currency', function ($service) {
        $service
            ->wsdl('http://currencyconverter.kowabunga.net/converter.asmx?WSDL')
            ->trace(true)
            ->options(['user-agent'=>'PHPSoapClient'])
            ->classmap([
            GetConversionAmount::class,
            GetConversionAmountResponse::class,
            ]);
        });

        $response = $this->soapWrapper->call('Currency.GetConversionAmount', [
        new GetConversionAmount('USD', 'EUR', '2014-06-05', '1000')
        ]);
    }
    echo $response;
  }
}

As the documentation mention I created the Request and Response PHP files
Request \app\SOAP\Request

<?php

namespace App\Soap\Request;

class GetConversionAmount
{
  /**
   * @var string
   */
  protected $CurrencyFrom;

  /**
   * @var string
   */
  protected $CurrencyTo;

  /**
   * @var string
   */
  protected $RateDate;

  /**
   * @var string
   */
  protected $Amount;

  /**
   * GetConversionAmount constructor.
   *
   * @param string $CurrencyFrom
   * @param string $CurrencyTo
   * @param string $RateDate
   * @param string $Amount
   */
  public function __construct($CurrencyFrom, $CurrencyTo, $RateDate, $Amount)
  {
    $this->CurrencyFrom = $CurrencyFrom;
    $this->CurrencyTo   = $CurrencyTo;
    $this->RateDate     = $RateDate;
    $this->Amount       = $Amount;
  }

  /**
   * @return string
   */
  public function getCurrencyFrom()
  {
    return $this->CurrencyFrom;
  }

  /**
   * @return string
   */
  public function getCurrencyTo()
  {
    return $this->CurrencyTo;
  }

  /**
   * @return string
   */
  public function getRateDate()
  {
    return $this->RateDate;
  }

  /**
   * @return string
   */
  public function getAmount()
  {
    return $this->Amount;
  }
}

Response \app\SOAP\Response

<?php

namespace App\Soap\Response;

class GetConversionAmountResponse
{
  /**
   * @var string
   */
  protected $GetConversionAmountResult;

  /**
   * GetConversionAmountResponse constructor.
   *
   * @param string
   */
  public function __construct($GetConversionAmountResult)
  {
    $this->GetConversionAmountResult = $GetConversionAmountResult;
  }

  /**
   * @return string
   */
  public function getGetConversionAmountResult()
  {
    return $this->GetConversionAmountResult;
  }
}

Then i call it

Route::get('/soap',[SoapController::class, 'show']);

And I got this error too:

image

I really need to create a SOAP client, I need to create a SOAP client for a BizFlow POC

@jalvarado-it
Copy link

jalvarado-it commented Jan 23, 2021

I founded a solution

Here is my controller

<?php

namespace App\Http\Controllers;

use Artisaninweb\SoapWrapper\SoapWrapper;
use App\Soap\Request\GetConversionAmount;
use App\Soap\Response\GetConversionAmountResponse;

class SoapController
{
  /**
   * @var SoapWrapper
   */
  protected $soapWrapper;

  /**
   * SoapController constructor.
   *
   * @param SoapWrapper $soapWrapper
   */
  public function __construct(SoapWrapper $soapWrapper)
  {
    $this->soapWrapper = $soapWrapper;
  }

  /**
   * Use the SoapWrapper
   */
  public function show()
  {
    $response = 'empty';
    $opts = array(
        'http' => array(
            'user_agent'=>'PHPSoapClient'
        )
    );
    $context=stream_context_create($opts);
    $wsdl='http://currencyconverter.kowabunga.net/converter.asmx?WSDL';
    $o=array(
        'stream_context'=>$context,
        'cache_wsdl'=>WSDL_CACHE_NONE
    );

    $a=$this->soapWrapper->add('servicio',function($service){
        $service
            ->wsdl('http://currencyconverter.kowabunga.net/converter.asmx?WSDL')
            ->trace(true)
            ->options([
                'stream_context'=>stream_context_create([
                    'http' => array(
                        'user_agent'=>'PHPSoapClient'
                    )
                ]),
                'cache_wsdl'=>WSDL_CACHE_NONE
            ]);
        dump($service);

    });

   

    $this->soapWrapper->client('servicio',function($client){
        echo '<h3>Functions</h3>';
        dump($client->getFunctions());
        echo'<h3>call</h3>';
        dump($client->call('GetCurrencies',[]));
    });


/*
    if(isset($this->soapWrapper)){
        $this->soapWrapper->client(null,function($service){
            $service
            ->wsdl('http://currencyconverter.kowabunga.net/converter.asmx?WSDL')
            ->options(['user-agent'=>'PHPSoapClient']);
        });

        $this->soapWrapper->add('Currency', function ($service) {
        $service
            ->wsdl('http://currencyconverter.kowabunga.net/converter.asmx?WSDL')
            ->trace(true)
            ->options(['user-agent'=>'PHPSoapClient'])
            ->classmap([
            GetConversionAmount::class,
            GetConversionAmountResponse::class,
            ]);
        });

        //*$response = $this->soapWrapper->call('Currency.GetConversionAmount', [
        new GetConversionAmount('USD', 'EUR', '2014-06-05', '1000')
        ])
    }*/

    
    echo $response;
  }
}

And this is the invocation
image

@jalvarado-it
Copy link

You can close it!
The solution is in the options

$this->soapWrapper->add('servicio',function($service){
        $service
            ->wsdl('http://currencyconverter.kowabunga.net/converter.asmx?WSDL')
            ->trace(true)
            ->options([
                'stream_context'=>stream_context_create([
                    'http' => array(
                        'user_agent'=>'PHPSoapClient'
                    )
                ]),
                'cache_wsdl'=>WSDL_CACHE_NONE
            ]);
        dump($service);

    });

@charmtorio
Copy link

Hi, using Laravel 9 and the WSDL url (http://currencyconverter.kowabunga.net/converter.asmx?WSDL) is not available anymore. Also adding 'user_agent' => 'PHPSoapClient' is not working anymore. Someone help?

@Maerryham
Copy link

Please all these are not working, still getting

SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://currencyconverter.kowabunga.net/converter.asmx?WSDL' : failed to load external entity "http://currencyconverter.kowabunga.net/converter.asmx?WSDL"

@siribanjoy
Copy link

siribanjoy commented Jun 26, 2023

Updates? Still not working

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

No branches or pull requests

9 participants