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

Cannot load resource "null" #98

Open
ghost opened this issue May 4, 2017 · 0 comments
Open

Cannot load resource "null" #98

ghost opened this issue May 4, 2017 · 0 comments

Comments

@ghost
Copy link

ghost commented May 4, 2017

Good day,

Please your help!

I'm creating a web service that encapsulates another SAP service. For security reasons I can not publish the SAP service directly since all the services on the Internet would be exposed. I got the next error:

http://localhost:8000/app_dev.php/ws/WSConsultaSuscriptor?wsdl

Cannot load resource "null".

Configuration:
#WSConsultaSuscriptorController.php

"<?php

namespace Acme\SOAPBundle\Controller;

use BeSimple\SoapBundle\ServiceDefinition\Annotation as Soap;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Container;

-/**
-* @soap\Header()
_*/

class WSConsultaSuscriptorController implements ContainerAwareInterface
{

  • /**
    -* Sets the container.
    -*
    -* @param ContainerInterface|null $container A ContainerInterface instance or null
    -*/
    public function setContainer(ContainerInterface $container = null){
    $this->container = $container;
    }

-/**
-* @soap\Method("ConsultaSuscriptor")
-* @soap\Param("VCliente", phpType = "string")
-* @soap\Param("VEtmenge", phpType = "string")
-* @soap\Param("VProducto", phpType = "string")
-* @soap\Param("VSpart", phpType = "string")
-* @soap\Result(phpType = "string")
-*/

public function ConsultaSuscriptorAction($header, $VCliente = '0',$VEtmenge = '0',$VProducto = '',$VSpart = '')
{
var_dump($VCliente);
exit();
ini_set('soap.wsdl_cache_enabled',0);
ini_set('soap.wsdl_cache_ttl',0);

  // require_once "nusoap.php";
  
  $URL = 'http://webservice?wsdl';
  $option = array('trace'=>true,'login' => 'xxxxx','password' => 'xxxxx',
  				'soap_version' => 'SOAP_1_1',
  				'encoding' => 'utf-8');
  $client = new \SOAPClient($URL, $option);
  $functions = $client->__getFunctions();
  $bodyoptions = array(
  	'VCliente' 	=> $VCliente,
  	'VEtmenge'	=> $VEtmenge,
  	'VProducto'	=> $VProducto, 
  	'VSpart'    => $VSpart
  	);
  $result = $client->call('Zvop20ValidaCant', array($bodyoptions));
  $soap = $client->__getLastResponse();
  
  $response = new Response($soap);
  $response->headers->set('Content-Type', 'application/xml; charset=utf-8');
  return $response;		

}
}

#routing.yml

acme_soap_homepage:
path: /
defaults: { _controller: AcmeSOAPBundle:Default:index }
acme_soap:
resource: '@AcmeSOAPBundle/Controller/'
type: annotation
_besimple_soap:
resource: 'be_simple_soap.yml'
prefix: /ws

#be_simple_soap.yml

_webservice_call:
path: /{webservice}
defaults: { _controller: BeSimpleSoapBundle:SoapWebService:Call }
requirements:
_format: xml
methods: POST

_webservice_definition:
path: /{webservice}
defaults: { _controller: BeSimpleSoapBundle:SoapWebService:Definition }
requirements:
_format: xml
methods: GET

#config.yml

be_simple_soap:
services:
WSConsultaSuscriptor:
namespace: http://localhost:8000/app_dev.php/ws/WSConsultaSuscriptor
binding: rpc-literal
resource: '@AcmeSOAPBundle/Controller/WSConsultaSuscriptorController.php'
resource_type: annotation

#SoapWebServiceController.php

"<?php

/*

  • This file is part of the BeSimpleSoapBundle.
  • (c) Christian Kerl [email protected]
  • (c) Francis Besset [email protected]
  • This source file is subject to the MIT license that is bundled
  • with this source code in the file LICENSE.
    */

namespace BeSimple\SoapBundle\Controller;

use BeSimple\SoapBundle\Handler\ExceptionHandler;
use BeSimple\SoapBundle\Soap\SoapRequest;
use BeSimple\SoapBundle\Soap\SoapResponse;
use BeSimple\SoapServer\SoapServerBuilder;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\FlattenException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\Log\DebugLoggerInterface;

/**
.....
*/
class SoapWebServiceController Implements ContainerAwareInterface
{

  • /**
    -* Sets the container.
    -*
    -* @param ContainerInterface|null $container A ContainerInterface instance or null
    -*/
    public function setContainer(ContainerInterface $container = null){
    $this->container = $container;
    }

#autoload.php

"<?php

use Doctrine\Common\Annotations\AnnotationRegistry;
use Composer\Autoload\ClassLoader;

/** @var ClassLoader $loader */
$loader = require DIR.'/../vendor/autoload.php';
//Load BesimpleSoap
$loader->add('BeSimple\SoapCommon' , DIR.'/../vendor/besimple-soapcommon/src');
$loader->add('BeSimple\SoapServer' , DIR.'/../vendor/besimple-soapserver/src');
$loader->add('BeSimple\SoapClient' , DIR.'/../vendor/besimple-soapclient/src');
$loader->add('BeSimple\SoapClient' , DIR.'/../vendor/besimple-soapclient/src');
$loader->add('BeSimple', DIR.'/../vendor/bundles');

// var_dump ($loader);
// exit();

AnnotationRegistry::registerLoader([$loader, 'loadClass']);

return $loader;

#AppKernel.php

"<?php

use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;

class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = [
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new AppBundle\AppBundle(),
new Acme\SOAPBundle\AcmeSOAPBundle(),
new BeSimple\SoapBundle\BeSimpleSoapBundle(),
];

    if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
        $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
        $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
        $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
        $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
    }
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

0 participants