Friday, December 18, 2009

How to return multiple tag with Nusoap

How to create web service in php using the nusoap
With writting this blog please first read what is web service and how make with nusoap.
You can download and for tutorial for basic http://www.scottnichol.com/soap.htm
I am here to write how to send the multiple tag in response


First we have create the complex data type that you want to send client but little different way.

$server->wsdl->addComplexType( 'business','complexType','array','all','',
array(
'tagname'=>array('name'=>'tagname','type'=>'xsd:string'));

This the code for adding complex data type.
  1. $server this the object of NuSOAP .
  2. business is name data type that you want to create.
  3. complexType the type of new data is complex
  4. array there two type of data one struct and another array.we will use array
  5. tagname this the name of tag that you can send inside the array.
Then you have create new datatype that contails the array of above data type.

$server->wsdl->addComplexType('array_business','complexType', 'array', '',
'SOAP-ENC:Array', //this tell the ENC is type of array
array(),
array(
array('ref' => 'SOAP-ENC:arrayType', //now check in WSDL
'wsdl:arrayType' => 'tns:business[]')//the complex data array
),
'tns:business' //the name of complex data that
);



The above code explain that data array_business contains the array of business that given in "tns:"
Now just one thing to do is set the return type in function is "business".
Each array is an item tag,and each array element is child of item.




Thanks.
Have Dream Day.




Image POST with jquery

To post image to server we can not it directly like set variable name post it, that we do in $.ajax
for that you need to make iframe then make form tag so that the request contains the header with all file details like name,size,type etc.
Jquery make it simple by plug-in named 'ajax_postup' just download call to your page,
you can also find documentation download but i also write down here.

$.ajax_postup({url:'imagepost.php',//server url
file_ele_ids:['x_thumbnailimage'],//just give file name id
success:function(return_data)
{
//write down code for callback
}
});


The above code i think explain all things,
you can also pass other variable with code just write down before the 'file_ele_ids'
the syntax is data:{'var_name':'var_value', 'var_name':'var_value'},

On server side if you are using the PHP than you can access directly by
  1. $_FILE['filename_id']['name'] to access the file name same way
  2. $_FILE['filename_id']['type']
  3. $_FILE['filename_id']['size]
  4. $_FILE['filename_id']['tmp_name'] for server temp location file name.

Thanks
Have Dream Day

Wednesday, December 16, 2009

Zend Error 404

I have great problem during installation of Zend Framework into my PC,the Index controller and index action work fine but with the other action it show the error 404 .

Solution was that simple just open http.conf and search for tag just change the
AllowOverride None
to
AllowOverride All

please also check to the mod_write module is not commented.
I try it in
1.Zend Studio 0.7
2.Zend Framework 1.9
3.Zend Server 4.0

Thanks
Have Dream Day