Comments (11)
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.
Hi. Thanks for an issue.
I do not known how to help you. What kind of problem do you have?
from nusoap.
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.
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.
Finally I solved adding a global helper file to the composer.json and Laravel encounters the method in that file
from nusoap.
Hi wa05, you have some example of your solution? please i have exactly the same problem right now u.u,
from nusoap.
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.
thank you so much wa05 you save my ass, a great contribution
from nusoap.
thanks you @wa05 !
from nusoap.
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.
@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)
- UTF-8 encoding. HOT 1
- Charencoding always true
- What is the license actually? HOT 1
- nusoapmime.php missing
- missing `class.wsdlcache.php` used in samples HOT 3
- Migrating from PHP Soap module: Cannot use stdclass as array
- Automatic release sync w/ Sourceforge
- Web Description HTML - "ul" tag doesn't closed
- Expected type 'CurlHandle'. Found 'false' HOT 1
- Creating default object from empty value HOT 1
- Server Samples HOT 1
- Undefined variable: tt_ns
- No memory error HOT 1
- Cannot redeclare timestamp_to_iso8601
- remove executable bit on nusoap.php HOT 1
- How to send empty response from nusoap server HOT 1
- PHP 5.6 working perfectly but PHP 8 gets the error HOT 1
- $this->portTypes[$bindingData['portType']][$operation]['output'] is undefined in One-way service
- new release tag and refactoring HOT 1
- Type error in get_class with php 8.* HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nusoap.