Kişisel Sayfaları
İlgi Alanları
İş Tecrubesi
Eğitim Geçmişi
Sertifikalar & Başarılar
Kullanıcıya ait test sonucu bulunmamaktadır.
Dil Becerileri
Son Forum Aktiviteleri
5File U
Merhaba arkadaşlar. Php servea dosya göndermeye çalışıyorum fakat "java.io.FileNotFoundException " hatası almaktayım. Yardımınıza ihityacım var
kodum:
[code]
package com.androidexample.uploadtoserver;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import android.app.Activity;
import android.app.ProgressDialog;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
public class UploadToServer extends Activity {
TextView messageText;
Button uploadButton;
int serverResponseCode = 0;
ProgressDialog dialog = null;
String upLoadServerUri = null;
/********** File Path *************/
final String uploadFilePath = "/mnt/sdcard/";
final String uploadFileName = "service.jpg";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_upload_to_server);
uploadButton = (Button)findViewById(R.id.uploadButton);
messageText = (TextView)findViewById(R.id.messageText);
uploadButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
dialog = ProgressDialog.show(UploadToServer.this, "", "Uploading file...", true);
new Thread(new Runnable() {
public void run() {
runOnUiThread(new Runnable() {
public void run() {
//messageText.setText("uploading started.....");
}
});
doFileUpload();
Log.d("deneme", "buraya geldim i");
}
}).start();
}
});
}
private void doFileUpload() {
HttpURLConnection conn = null;
DataOutputStream dos = null;
DataInputStream inStream = null;
String existingFileName = uploadFilePath+uploadFileName;
// imageView1.setImageURI(Uri.parse(existingFileName));
Log.e("--adress Debug--",existingFileName);
String lineEnd = "\r\n";
String twoHyphens = "--";
String boundary = "*****";
int bytesRead, bytesAvailable, bufferSize;
byte[] buffer;
int maxBufferSize = 1 * 1024 * 1024;
String responseFromServer ="";
String urlString = "http://www.*********.info/test.php";
Log.d("deneme1", "buraya geldim i");
try {
//------------------ CLIENT REQUEST
FileInputStream fileInputStream = new FileInputStream(new File(existingFileName));
// open a URL connection to the Servlet
URL url = new URL(urlString);
// Open a HTTP connection to the URL
conn = (HttpURLConnection) url.openConnection();
// Allow Inputs
conn.setDoInput(true);
// Allow Outputs
conn.setDoOutput(true);
// Don't use a cached copy.
conn.setUseCaches(false);
// Use a post method.
Log.d("deneme2", "buraya geldim i");
conn.setRequestMethod("POST");
conn.setRequestProperty("Connection", "Keep-Alive");
conn.setRequestProperty("Content-Type", "multipart/form-data;boundary=" + boundary);
dos = new DataOutputStream(conn.getOutputStream());
dos.writeBytes(twoHyphens + boundary + lineEnd);
dos.writeBytes("Content-Disposition: form-data; name=\"uploadedfile\";filename=\"" + existingFileName + "\"" + lineEnd);
dos.writeBytes(lineEnd);
// create a buffer of maximum size
Log.d("deneme3", "buraya geldim i");
bytesAvailable = fileInputStream.available();
bufferSize = Math.min(bytesAvailable, maxBufferSize);
buffer = new byte[bufferSize];
// read file and write it into form...
bytesRead = fileInputStream.read(buffer, 0, bufferSize);
Log.e("--burya geldimi --","");
while (bytesRead > 0) {
dos.write(buffer, 0, bufferSize);
bytesAvailable = fileInputStream.available();
bufferSize = Math.min(bytesAvailable, maxBufferSize);
bytesRead = fileInputStream.read(buffer, 0, bufferSize);
Log.e("--b----------------mi --","");
}
Log.d("deneme4", "buraya geldim i");
// send multipart form data necesssary after file data...
dos.writeBytes(lineEnd);
dos.writeBytes(twoHyphens + boundary + twoHyphens + lineEnd);
// close streams
Log.e("Debug", "File is written");
fileInputStream.close();
dos.flush();
dos.close();
} catch (MalformedURLException ex) {
Log.e("Debug0", "error1: " + ex.getMessage(), ex);
} catch (IOException ioe) {
Log.e("Debug1", "error2: " + ioe.getMessage(), ioe);
}
//------------------ read the SERVER RESPONSE
try {
inStream = new DataInputStream(conn.getInputStream());
String str;
while ((str = inStream.readLine()) != null) {
Log.e("Debug2", "Server Response " + str);
}
inStream.close();
} catch (IOException ioex) {
Log.e("Debug3", "error3: " + ioex.getMessage(), ioex);
}
}
}
[/code]
library hatasını nasıl yakalaya birilim
Merhaba arkadaşlar, projemde kütüphane kullanıyorum.
" java.lang.UnsatisfiedLinkError: dlopen failed: could not load library " hatasını nasıl yakala bilirm.
Nereye try/catch koyduysam olmadı. Activity açılır açılmaz program durduruluyor.
SOAP Server did not recognize
Merhaba;
web serverdan verileri çekmeye çalışıyorum fakat bir türlü çekemedim. "Server did not recognize the value of HTTP Header SOAPAction" hatası dönmekte sürekli. Neyi kaçırıyor olabilirim.
[code]
package com.erben.erben_pdks;
import android.os.AsyncTask;
import android.os.Bundle;
import android.app.Activity;
import android.app.Dialog;
import android.app.ProgressDialog;
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.PropertyInfo;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapPrimitive;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
//import com.prgguru.android.MainActivity.AsyncCallWS;
import android.app.Activity;
import android.app.Activity;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ProgressBar;
import android.widget.TextView;
public class Verial extends Activity implements OnClickListener{
private ProgressBar progressBar;
private int progressStatus = 0;
private TextView textView;
private Button button1;
private EditText et;
private TextView tv;
private Handler handler = new Handler();
private final String NAMESPACE = "http://192.168.0.4/pdaservis/";
private final String URL = "http://192.168.0.4/pdaservis/pdaservis.asmx";
private final String SOAP_ACTION = "http://192.168.0.4/pdaservis/pdaservis/GetUser";
private final String METHOD_NAME = "GetUser";
private String[] Liste;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.verial);
progressBar = (ProgressBar) findViewById(R.id.progressBar1);
textView = (TextView) findViewById(R.id.textView1);
button1=(Button)findViewById(R.id.button1);
et=(EditText) findViewById(R.id.editText1);
tv=(TextView)findViewById(R.id.textView2);
button1.setOnClickListener(this);
// Start long running operation in a background thread
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
switch (v.getId()) {
case R.id.button1 :
AsyncCallWS task = new AsyncCallWS();
//Call execute
task.execute();
break;
}
}
private void basla(){
new Thread(new Runnable() {
public void run() {
while (progressStatus < 100) {
progressStatus += 1;
// Update the progress bar and display the current value in the text view
handler.post(new Runnable() {
public void run() {
progressBar.setProgress(progressStatus);
textView.setText(progressStatus+"/"+progressBar.getMax());
}
});
try {
// Sleep for 200 milliseconds. Just to display the progress slowly
Thread.sleep(200);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}).start();
}
public void getWebService(String _State,String _UserName,String _Password ) {
//Create request
//SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
//Property which holds input parameters
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
PropertyInfo parametre1 = new PropertyInfo();
//parametre1.name="_Password";
parametre1.setName("_State");
parametre1.setValue(_State);
//parametre1.type=PropertyInfo.STRING_CLASS;
parametre1.setType(String.class);
request.addProperty(parametre1);
PropertyInfo parametre2 = new PropertyInfo();
//parametre2.name="_UserName";
parametre2.setName("_UserName");
parametre2.setValue(_UserName);
parametre2.setType(String.class);
//parametre2.type=PropertyInfo.STRING_CLASS;
request.addProperty(parametre2);
PropertyInfo parametre3 = new PropertyInfo();
//parametre3.name="_Password";
parametre3.setName("_Password");
parametre3.setValue(_Password);
//parametre3.type=PropertyInfo.STRING_CLASS;
parametre3.setType(String.class);
request.addProperty(parametre3);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
//envelope.bodyOut=request;
envelope.dotNet = true;
//Set output SOAP object
envelope.setOutputSoapObject(request);
//Create HTTP call object
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
//androidHttpTransport.debug = true;
try {
//Invole web service
androidHttpTransport.call(SOAP_ACTION, envelope);
//Get the response
//SoapPrimitive response = (SoapPrimitive) envelope.getResponse();
SoapObject response = (SoapObject) envelope.getResponse();
//Assign it to fahren static variable
Liste = new String[response.getPropertyCount()];
System.out.println("web yaratıldı girdi");
for(int i=0;i<response.getPropertyCount();i++){
System.out.println(response.getProperty(i).toString().trim());
Liste[i] = response.getProperty(i).toString().trim(); //Sırasıyla string cinsinden gelen sonuçları listeye atıyoruz.
}
} catch (Exception e) {
e.printStackTrace();
}
}
private class AsyncCallWS extends AsyncTask<String, Void, Void> {
private ProgressDialog dialog = new ProgressDialog(Verial.this);
protected Void doInBackground(String... params) {
Log.i("----çelmeye çalıyor-----", "String[] doInBackground");
getWebService("1", "Test", "Test123");
return null;
}
@Override
protected void onPostExecute(Void result) {
Log.i("----onPostExecute çalıyor-----", "onPreExecute");
dialog.setMessage("Yükleniyor...");
dialog.show();
tv.setText("Calculating...");
}
@Override
protected void onPreExecute() {
Log.i("----onPreExecute çalıyor-----", "onPreExecute");
}
@Override
protected void onProgressUpdate(Void... values) {
Log.i("----onProgressUpdate çalıyor-----", "onProgressUpdate");
dialog.dismiss();
}
}
}
[/code]
[code]
12-03 22:00:09.340: I/----onPreExecute çalıyor-----(27540): onPreExecute
12-03 22:00:09.350: I/----çelmeye çalıyor-----(27540): String[] doInBackground
12-03 22:00:15.160: W/System.err(27540): SoapFault - faultcode: 'soap:Client' faultstring: 'Server did not recognize the value of HTTP Header SOAPAction: http://192.168.0.4/pdaservis/pdaservis/GetUser.' faultactor: 'null' detail: org.kxml2.kdom.Node@40595058
12-03 22:00:15.160: W/System.err(27540): at org.ksoap2.serialization.SoapSerializationEnvelope.parseBody(SoapSerializationEnvelope.java:112)
12-03 22:00:15.160: W/System.err(27540): at org.ksoap2.SoapEnvelope.parse(SoapEnvelope.java:137)
12-03 22:00:15.160: W/System.err(27540): at org.ksoap2.transport.Transport.parseResponse(Transport.java:63)
12-03 22:00:15.160: W/System.err(27540): at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:100)
12-03 22:00:15.160: W/System.err(27540): at com.erben.erben_pdks.Verial.getWebService(Verial.java:139)
12-03 22:00:15.160: W/System.err(27540): at com.erben.erben_pdks.Verial$AsyncCallWS.doInBackground(Verial.java:161)
12-03 22:00:15.170: W/System.err(27540): at com.erben.erben_pdks.Verial$AsyncCallWS.doInBackground(Verial.java:1)
12-03 22:00:15.170: W/System.err(27540): at android.os.AsyncTask$2.call(AsyncTask.java:185)
12-03 22:00:15.170: W/System.err(27540): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
12-03 22:00:15.170: W/System.err(27540): at java.util.concurrent.FutureTask.run(FutureTask.java:138)
12-03 22:00:15.170: W/System.err(27540): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
12-03 22:00:15.170: W/System.err(27540): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
12-03 22:00:15.170: W/System.err(27540): at java.lang.Thread.run(Thread.java:1019)
12-03 22:00:15.170: I/----onPostExecute çalıyor-----(27540): onPreExecute[/code]
File U
LOGCAT ı
[code]
12-15 21:10:33.599: E/Debug3(9087): error3: http://www.****.info/test.php
12-15 21:10:33.599: E/Debug3(9087): java.io.FileNotFoundException: http://www.*****.info/test.php
12-15 21:10:33.599: E/Debug3(9087): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:521)
12-15 21:10:33.599: E/Debug3(9087): at com.androidexample.uploadtoserver.UploadToServer.doFileUpload(UploadToServer.java:140)
12-15 21:10:33.599: E/Debug3(9087): at com.androidexample.uploadtoserver.UploadToServer.access$0(UploadToServer.java:66)
12-15 21:10:33.599: E/Debug3(9087): at com.androidexample.uploadtoserver.UploadToServer$1$1.run(UploadToServer.java:57)
12-15 21:10:33.599: E/Debug3(9087): at java.lang.Thread.run(Thread.java:1019)
[/code]
SOAP Server did not recognize
evet var, sorunu buldum parametreleri almadığını fark ettim.