Yii Framework Forum: CWsdlGenerator enhancement - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

CWsdlGenerator enhancement Rate Topic: -----

#1 User is offline   soso 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 45
  • Joined: 24-February 10

Posted 29 September 2011 - 03:39 AM

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.
0

#2 User is offline   zoltanpazsit 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 12-July 11

Posted 07 October 2011 - 03:49 AM

View Postsoso, on 29 September 2011 - 03:39 AM, said:

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
0

#3 User is offline   soso 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 45
  • Joined: 24-February 10

Posted 10 October 2011 - 02:22 AM

View Postzoltanpazsit, on 07 October 2011 - 03:49 AM, said:

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...
0

#4 User is offline   PazsitZ 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 28-July 11
  • Location:Hungary

Posted 14 October 2011 - 01:53 AM

View Postsoso, on 10 October 2011 - 02:22 AM, said:

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...


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.
0

#5 User is offline   jorgito_ml 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 12
  • Joined: 01-June 12

Posted 01 June 2012 - 01:27 PM

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!
0

#6 User is offline   Bynton 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 20
  • Joined: 09-July 12

Posted 22 July 2012 - 02:56 PM

Well you can make it better by creating WebService function to call an extended CWebService.
0

#7 User is offline   DerKaktus 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 05-February 11

Posted 25 March 2013 - 01:58 AM

View Postjorgito_ml, on 01 June 2012 - 01:27 PM, said:

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!


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.
0

#8 User is offline   jorgito_ml 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 12
  • Joined: 01-June 12

Posted 25 March 2013 - 06:33 AM

View PostDerKaktus, on 25 March 2013 - 01:58 AM, said:

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.
0

#9 User is offline   DerKaktus 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 05-February 11

Posted 28 March 2013 - 09:42 AM

View Postjorgito_ml, on 25 March 2013 - 06:33 AM, said:

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.


Hi jorgito_ml, thank you, did you put this html code inside the WebService? how?
0

#10 User is offline   jorgito_ml 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 12
  • Joined: 01-June 12

Posted 02 April 2013 - 05:46 AM

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.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users