GithubHelp home page GithubHelp logo

Comments (11)

wa05 avatar wa05 commented on May 24, 2024 1

composer.json
"autoload": { "classmap": [ "database/seeds", "database/factories" ], "files": [ "app/helper.php" ],

web.php
Route::any('ws-delos', 'WebService\WsController@connect');

controller
` public function connect()
{
try {

        $server = new \nusoap_server();
        $server->configureWSDL('WMS', "urn:delos", url('ws-delos'), 'rpc');

        $this->server = $server;

        $this->server->wsdl->addComplexType(
            'item',
            'complexType',
            'struct',
            'all',
            '',
            [
                'codigoMaterial' => [
                    'name' => 'codigoMaterial', 'type' => 'xsd:string'
                ],
                'cantidad' => [
                    'name' => 'cantidad', 'type' => 'xsd:int'
                ],
                'nroTransaccion' => [
                    'name' => 'nroTransaccion', 'type' => 'xsd:int'
                ],
                'codigoInterno' => [
                    'name' => 'codigoInterno', 'type' => 'xsd:int'
                ]
            ]
        );
    
        $this->server->register('DocumentoEgreso_Agregar',
            [
                'empresa' => 'xsd:int',
                'nroPedido' => 'xsd:string',
                'cliente' => 'xsd:string',
                'codigoTransportista' => 'xsd:int',
                'descripcionTransportista' => 'xsd:string',
                'items' => 'tns:listaEgreso'
            ],
            [
                'output' => 'xsd:string'
            ],
            "urn:delos",
            "urn:delos#DocumentoEgreso_Agregar",
            "rpc",
            'encoded',
            "Circuito Comercial - Recibe la tarea y la graba en estado pendiente");


    } catch (Exception $e) {
        return response('ERROR ' . $e->getMessage());
    }

    $rawPostData = file_get_contents("php://input");

    return response($this->server->service($rawPostData), 200)
        ->header('Content-Type', 'text/xml')
        ->header('charset', 'ISO-8859-1');
}`

helper.php
`function DocumentoEgreso_Agregar($empresa, $nroPedido, $cliente,
$codigoTransportista, $descripcionTransportista, $items, $codigoLugarEnvio = null)
{
$controller = app('app\Http\Controllers\WebService\WsController');

return $controller->wsEgresoData($empresa, $nroPedido, $cliente,
                $codigoTransportista, $descripcionTransportista, $items, $codigoLugarEnvio);

}
`

from nusoap.

f3l1x avatar f3l1x commented on May 24, 2024

Hi. Thanks for an issue.

I do not known how to help you. What kind of problem do you have?

from nusoap.

wa05 avatar wa05 commented on May 24, 2024

When you use the register function the first parameter is a string, that string is the method that you will implement, how you can point that string to a method from the same controller that were you are instanciating the web server ...

Now I'm using a helpers file but I'm trying to make it more "elegantly"..

from nusoap.

f3l1x avatar f3l1x commented on May 24, 2024

Well, I've found this thread https://stackoverflow.com/a/8094692.

// register the class method and the params of the method
$server->register("myClass.ShowString"                       
                 ,array('name'=>'xsd:string')
                 ,array('return'=>'xsd:string')
                 ,$namespace,false
                 ,'rpc'
                 ,'encoded'
                 ,'Sample of embedded classes...' 
                                );

from nusoap.

wa05 avatar wa05 commented on May 24, 2024

Finally I solved adding a global helper file to the composer.json and Laravel encounters the method in that file

from nusoap.

Alvax500-debug avatar Alvax500-debug commented on May 24, 2024

Hi wa05, you have some example of your solution? please i have exactly the same problem right now u.u,

from nusoap.

wa05 avatar wa05 commented on May 24, 2024
Route::any('ws-delos', 'WebService\WsController@connect');

public function connect()
{
try {

        $server = new \nusoap_server();
        $server->configureWSDL('WMS', "urn:delos", url('ws-delos'), 'rpc');

        $this->server = $server;

        $this->server->wsdl->addComplexType(
            'item',
            'complexType',
            'struct',
            'all',
            '',
            [
                'codigoMaterial' => [
                    'name' => 'codigoMaterial', 'type' => 'xsd:string'
                ],
                'cantidad' => [
                    'name' => 'cantidad', 'type' => 'xsd:int'
                ],
                'nroTransaccion' => [
                    'name' => 'nroTransaccion', 'type' => 'xsd:int'
                ],
                'codigoInterno' => [
                    'name' => 'codigoInterno', 'type' => 'xsd:int'
                ]
            ]
        );
    
        $this->server->register('DocumentoEgreso_Agregar',
            [
                'empresa' => 'xsd:int',
                'nroPedido' => 'xsd:string',
                'cliente' => 'xsd:string',
                'codigoTransportista' => 'xsd:int',
                'descripcionTransportista' => 'xsd:string',
                'items' => 'tns:listaEgreso'
            ],
            [
                'output' => 'xsd:string'
            ],
            "urn:delos",
            "urn:delos#DocumentoEgreso_Agregar",
            "rpc",
            'encoded',
            "Circuito Comercial - Recibe la tarea y la graba en estado pendiente");


    } catch (Exception $e) {
        return response('ERROR ' . $e->getMessage());
    }

    $rawPostData = file_get_contents("php://input");

    return response($this->server->service($rawPostData), 200)
        ->header('Content-Type', 'text/xml')
        ->header('charset', 'ISO-8859-1');
}
composer.json
`
 "autoload": {
    "classmap": [
      "database/seeds",
      "database/factories"
    ],
    "files": [
      "app/helper.php"
    ],
`

from nusoap.

Alvax500-debug avatar Alvax500-debug commented on May 24, 2024

thank you so much wa05 you save my ass, a great contribution

from nusoap.

GermanZun avatar GermanZun commented on May 24, 2024

thanks you @wa05 !

from nusoap.

excalibur1028 avatar excalibur1028 commented on May 24, 2024

Hi, would like to know on how did you define the code below on the register function. Thanks

'items' => 'tns:listaEgreso' ->> listaEgreso class where did you define it? inside the controller?

from nusoap.

wa05 avatar wa05 commented on May 24, 2024

@excalibur1028 excuse me for the slow response...
Its defined in the controller... as a complexType

$this->server->wsdl->addComplexType( 'listaEgreso', 'complexType', 'array', '', 'SOAP-ENC:Array', [], [ [ 'ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:item[]' ] ], 'tns:item' );

from nusoap.

Related Issues (20)

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.