receive output from java DataOutputStream in a php page -


i have java applet using send file server - on server end want receive on php page.

below java code doing sending, on php side of things have checked global arrays , have data passed url, not file data. have searched , scratched on 1 appreciated.

string strurl = sendtourl + "?action=post&len=" + imgbytes.length + "&fname=picture.png";     try{         url urlservlet = new url(strurl);         urlconnection scon = urlservlet.openconnection();         scon.setdoinput(true);         scon.setdooutput(true);         if (scon.getallowuserinteraction()) {             scon.setallowuserinteraction(true);         }         scon.setusecaches(false);         scon.setdefaultusecaches(false);         scon.setrequestproperty("content-type", "text/html");         scon.setrequestproperty("connection", "keep-alive");         scon.setconnecttimeout(transfertimeout);         scon.setreadtimeout(transfertimeout);         dataoutputstream out = new dataoutputstream(scon.getoutputstream());          int index = 0;         size = 1024;         {             if (index + size > imgbytes.length) {                 size = imgbytes.length - index;             }             out.write(imgbytes, index, size);             index += size;         } while (index < imgbytes.length);          out.write(imgbytes);         out.flush();         out.close(); 

solved - happens 1 posts question after days of battling , mere minutes later solution presents.

i got thinking after comment using soap remembered using curl transferring xml data once before. few searches later , came across simpler , elegant solution.

http://www.lornajane.net/posts/2008/accessing-incoming-put-data-from-php

basically can access put data in php using

file_get_contents("php://input") 

so works awesomely

i used lot of times soap messages data php java works fine

so use php webservice , communicate via soap

setup wsdl file

generate java stubs , skeletons http://download.oracle.com/javase/6/docs/technotes/tools/share/wsimport.html

load wsdl php skript http://www.php.net/manual/de/book.soap.php

   $soapclient = new soapclient("blahblah.wsdl");  

and logic in php

then use java stubs call server , transmit data


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -