soso
(Soso Pub)
September 29, 2011, 8:39am
1
Hello,
I’d like to add another type to CWsdlGenerator, xsd:base64Binary, but I don’t seem to find how to properly extend CWsdlGenerator.
This class is used by CWebService but it is hardcoded, at line 140:
$generator=new CWsdlGenerator
Wouldn’t make sense to create a new public property $generator which defaults to CWsdlGenerator?
public $generator = 'CWsdlGenerator';
// and later in the method
$generator = new $this->generator;
Thus we can easily create a new wsdl generator and tell the service to use it.
Thanks.
soso:
Hello,
I’d like to add another type to CWsdlGenerator, xsd:base64Binary, but I don’t seem to find how to properly extend CWsdlGenerator.
This class is used by CWebService but it is hardcoded, at line 140:
$generator=new CWsdlGenerator
Wouldn’t make sense to create a new public property $generator which defaults to CWsdlGenerator?
public $generator = 'CWsdlGenerator';
// and later in the method
$generator = new $this->generator;
Thus we can easily create a new wsdl generator and tell the service to use it.
Thanks.
A little bit more work, but an alternative:
You can define the an extended CWebServiceAction, overwrite the CWebServiceAction::createWebService function to call an extended CWebService.
So define and pass through the $generator variable and overwrite the CWebService::generateWsdl function
soso
(Soso Pub)
October 10, 2011, 7:22am
3
zoltanpazsit:
A little bit more work, but an alternative:
You can define the an extended CWebServiceAction, overwrite the CWebServiceAction::createWebService function to call an extended CWebService.
So define and pass through the $generator variable and overwrite the CWebService::generateWsdl function
Hi,
Already did this. But the whole implementation is rigid. For example I had to add another type (base64) but the types are hardcoded inside a private method, had to copy-paste the entire class just for this…
PazsitZ
(Pazsitz)
October 14, 2011, 6:53am
4
Maybe the base64 type could be handled as a non-primitive user-class-defined type.
But don’t get me wrong, I don’t say that your feature request is not a good point.
Did you solved it?
I need to download an image stored as a blob in the database using a webservice…and i remmember that with NuSoap the blob field was mapped as "xsd:base64Binary"
Thx!
bynton
(Micheal Kolman)
July 22, 2012, 7:56pm
6
Well you can make it better by creating WebService function to call an extended CWebService.
derkaktus
(Ealanisg)
March 25, 2013, 6:58am
7
Hi - How did you solve this to base64binary? i’m having the same problem, currently i’m using string containing a base64_encode() result as string.
It worked for me:
echo '<div align="center"><img class="detailimage" src="data:'.$model_resurce->mimeType.';base64,' . base64_encode($model_resurce->resource ) . '" /></div>';
Hope it helps.
derkaktus
(Ealanisg)
March 28, 2013, 2:42pm
9
Hi jorgito_ml, thank you, did you put this html code inside the WebService? how?
First you have to store the image contents in the database (I use a LongBlob field):
protected function beforeValidate()
{
if($this->auxFile =CUploadedFile::getInstance($this,'uploadedFile'))
{
$this->mimeType=$this->auxFile->type;
$this->uploadedFile=file_get_contents($this->auxFile->tempName);
$this->resource=$this->uploadedFile;
}
return parent::beforeValidate();
}
Then use the above code to show the image.