christiankerl / ckwebserviceplugin Goto Github PK
View Code? Open in Web Editor NEWBuild SOAP and WSDL based web services with symfony 1.x.
License: MIT License
Build SOAP and WSDL based web services with symfony 1.x.
License: MIT License
When using ckDoctrinePropertyStrategy on model with relations, for example Blog which have Posts, which have comments. When you give a parameter of type Blog which contains some posts and comments data, it is not in the final object in the request object. Only members of Blog are preserved.
Failing test :
$options = array(
'classmap' => array(
'Blog' => 'ckGenericObjectAdapter_Blog',
'Post' => 'ckGenericObjectAdapter_Post',
'Comment' => 'ckGenericObjectAdapter_Comment',
'PostArray' => 'ckGenericArray',
'CommentArray' => 'ckGenericArray'
),
);
$blog = new Blog();
$blog->setName("a blog");
$post = new Post();
$post->setDescription("first post");
$comment = new Comment();
$comment->setDescription("a comment");
$comments = new Doctrine_Collection("Comment");
$comments->add($comment);
$post->setComments($comments);
$posts = new Doctrine_Collection("Post");
$posts->add($post);
$blog->setPosts($posts);
$c = new ckTestSoapClient($options);
$c->createBlog($blog)
->isFaultEmpty()
->is("name", "a blog")
->is(".Posts.0.description", "a comment");
Hello,
I tried to link two websites with a transmission of some datas between them with a webservice. Both of the websites are using Symfony 1.4/Propel with php 5.3.5. The first website is the owner of the webservice build with ckWebServicePlugin 4.0.0, the second have a simple native php SoapClient. When I tried to request the server with SOAP_1_1 I have a response and my process is well computed. But when I tried to change the soap_version to SOAP_1_2, I encounter a problem the result binded to the var which receive the return of my soap method is empty but the __getLastResponse give me the same result as the SOAP_1_1 response.
So I tried to find the problem and I simply modify my Wsdl file in the wsdl:binding > wsdl:operation > wsdl:output > soap:body : part="result" I change "result" by "results" and also rename wsdl:message > wsdl:part name="result" by name="results"
Apparently the word "result" is a reserved word in SOAP_1_2, and the generation of the result part name is hard-coded in the file ckWebServicePlugin/lib/vendor/ckWsdlGenerator/ckWsdlOperation.class line: 65
I would like to thank you about a wonderful SOAP Plugin ckWebServicePlugin
,
I install it & set require configuration to use it, but I have a problem when I send an array parameter
My Code:
$client = new nusoap_client('http://localhost/sync/web/MathApi.php?wsdl', true);
$result = $client->call('SimpleMultiply', array(array(5.5,2.6)));
Action:
result = 2; foreach($request->getParameter('a') as $factor) { $this->result *= $factor; } } Problem: • $request->getParameter('factors') is empty no data Can you help me Please? i follow every step of config? i don't know what's thr wrong?Hello, something weird is happening when I try to change the name of a function on my web service. i have followed the steps on the readme of the plugin and when I create my aplication with a web service for the first time everything works fine, but when I change the name of the function, it seems that doesnt get change. I rebuild the .wsdl, clear the cache, erase the files that the wdsl command generates but nothing. Also I call the method print_r($client->__getFunctions()); and it returns my function with the old name. These are my configuration:
soap:
ckSoapParameterFilter
enable_soap_parameter: on
ck_web_service_plugin:
# the location of your wsdl file
wsdl: %SF_WEB_DIR%/MathApi.wsdl
# the class that will be registered as handler for webservice requests
handler: MathApiHandler
soap:
controller:
class: ckWebServiceController
prod:
logger:
class: sfNoLogger
param:
level: err
loggers: ~
test:
storage:
class: sfSessionTestStorage
param:
session_path: %SF_TEST_CACHE_DIR%/sessions
response:
class: sfWebResponse
param:
send_http_headers: false
mailer:
param:
delivery_strategy: none
dev:
mailer:
param:
delivery_strategy: none
all:
routing:
class: sfPatternRouting
param:
generate_shortest_url: true
extra_parameters_as_query_string: true
view_cache_manager:
class: sfViewCacheManager
param:
cache_key_use_vary_headers: true
cache_key_use_host_name: true
rendering: ~
security: ~
soap_parameter:
class: ckSoapParameterFilter
param:
# app_enable_soap_parameter
has to be set to on
so the filter is only enabled in soap mode
condition: %APP_ENABLE_SOAP_PARAMETER%
cache: ~
execution: ~
/**
* An action multiplying two numbers.
* @WSMethod(webservice='MathApi')
*
* @param double $a Factor A
* @param double $b Factor B
*
* @return double The result
*/
public function executeMultiplica($request) {
$factorA = $request->getParameter('a');
$factorB = $request->getParameter('b');
if (is_numeric($factorA) && is_numeric($factorB)) {
$this->result = $factorA + $factorB;
return sfView::SUCCESS;
} else {
return sfView::ERROR;
}
}
When I call the print_r I get:
Array ( [0] => double math_multiply(double $a, double $b) )
Where multiply was the first name that i gave to my function, but then I wanted to change it with the name of Multiplica, as you can see in my actions file. As already said, i called the command:
symfony webservice:generate-wsdl servWeb MathApi http://localhost:9090/
And it generated my wsdl well with the correct name of the function. tHe BaseMathApiHandler.class.php, the module.yml, the MathApi.php are well with the correct name of the function. It seems that there is another file anywhere in the project that keeps the old name of my function.
Any help will be really apreciated, because i dont know what else I can do.
Hi again.
I'm facing an issue with an complex array, the response only says:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.pharmadvisor.com/ws/">
<SOAP-ENV:Body>
<ns1:FichasRepresentanteResponse>
<result/>
</ns1:FichasRepresentanteResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
But I've already declared WSMethod:
/**
* Recupera las fichas del representante
*
* @WSMethod(name="FichasRepresentante", webservice="webservices")
*
* @param string $bd_nombre Nombre de la Base de Datos
* @param string $id_usuario Id del representante
* @return wsFicha[]
*/
public function executeFichas_representante($request){
$arrFichas = array();
...
$fichaMed = new wsFicha();
$fichaMed->id_formato = 1;
$fichaMed->nombre = "Médicos";
$fichaMed->abreviatura = "Med";
$fichaMed->gps_maestro_contacto = 2;
$arrFichas[1] = $fichaMed;
...
$this->result = $arrFichas;
}
And wsFicha is
class wsFicha {
/**
* Id formato de la Ficha
* @var integer
*/
public $id_formato;
/**
* Nombre de la ficha
* @var string
*/
public $nombre;
/**
* Abreviatura
* @var string
*/
public $abreviatura;
/**
* Si la posición GPS depende de la base (1) o del contacto (2)
* @var integer
*/
public $gps_maestro_contacto;
}
Finally, app.yml
stands
classmap:
wsFicha: wsFicha
wsFichaArray: ckGenericArray
What could i'been doing wrong so the webservice doesnt generate my data, also to note that if i put return sfView::ERROR
only for testing, don't works and gets ignored.
Hello
I want that SOAP response uses RPC/literal on body response, instead of use the "href".
There is some kind config that i have to use?
ps: I'm using Symfony 1.4 and Doctrine as ORM.
I have a webservice in ssl protocol. My address in wsdl file is "https://myhost/web.wsdl".
I connect the address and the file is accessed but I can't execute methods that exist in webservice module.
This approach is worked in http protocol well.
please help me.
Dear ,
i create a soap function & it;s return an Array of String, but when i call it, it return an Object of Class stdClass ???
Server Side:
/**
*
* @WSMethod(name='setCountry', webservice='DataApi')
* @param integer $id
* @param string $en_name
* @param string $ar_name
* @param string $updated_at
*
* @return string The result
*/
public function executeSetCountry(sfWebRequest $request)
{
try {
$id = $request->getParameter('id');
$ar_name = $request->getParameter('ar_name');
$en_name = $request->getParameter('en_name');
$updated_at = $request->getParameter('updated_at');
$country = NewCountryPeer::retrieveByPK($id);
if (!$country) {
$country = new NewCountry();
$country->setId($id);
}
$country->setArName($ar_name);
$country->setEnName($en_name);
$country->setUpdatedAt($updated_at);
$country->save();
} catch (Exception $ex) {
throw new SoapFault("Server", $ex->getMessage());
}
//$this->result = array('Status' => '', 'Id' => $id);
$this->result = $country->getEnName();
return sfView::SUCCESS;
}
client Side:
$client = new SoapClient("http://localhost/sync/web/DataApi.php?wsdl");
try {
$result = $client->setCountry(55, 'Ahmad', 'Ahmad', '0001-00-00 00:00:00');
print_r($result);
}
catch (Exception $e)
{
echo 'Caught exception: ', $e->getMessage(), "\n";
}
Can You Help Me?
What I have to configure to use style="document" instead of rpc style.
I haven't seen any option for this.
Is it foreseen to use other the rpc styles of requests and responses?
I try to build a service to send data to SAP. It seems to be that SAP doesn't like the rpc style.
regards
Jarosław
With version 4.0.0 it is only possible to add a 'normal' array (index as numbers).
Could it be possible to add also associative arrays? (index as strings)
Thanks
Or exists a solution to add associative arrays to this 'soap response generator' ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.