ตอนนี้กำลังติดปัญหาค่ะ เรื่อง web service โดยใช้ php ติดต่อไปยัง web service ที่เขียนโดย java
Thread file: ThBarNumber.java
package co.m3tech.ws;
//import java.io.*;
//import java.util.logging.Level;
//import java.util.logging.Logger;
public class ThBarNumber extends Thread{
private String urlbarnumber;
public ThBarNumber(String urlbarnumber) {
this.urlbarnumber = urlbarnumber;
System.out.println(urlbarnumber);
}
@Override
public void run() {
System.out.println("Start proess bar number!");
//open file
//Add file
//Update database
}
}
Date :
2012-03-19 11:43:36
By :
nuttanicha14
file from ที่ รับค่า : VccFileBarNum.tpl
Code (PHP)
<link href="../../../css/backoffice.css" rel="stylesheet" type="text/css" />
<td colspan="2">
<br />
<table width="95%" border="0" align="center" cellpadding="4" cellspacing="4" class="bordertable">
<tr><td width="100%">
<fieldset>
<legend class="txt_module_head">Manage Block Number </legend>
<table width="100%" border="0">
<tr>
<td>
<table border="0" cellspacing="1" cellpadding="1" width="100%" >
<tr bgcolor="#eeddff">
<td bgcolor="#FF6820" class="txt_title_head" height="25px">Add File Bar Number <a href="../../index.html"></a></td>
</tr>
<tr>
<td>
<form action="{$baseUrl}ccallcenter/FileBarNumber" method="post" enctype="multipart/form-data">
<table width="83%" cellpadding="2" cellspacing="1" border="0" align="center">
<tr>
<td align="right" class = "line_dash" width="24%"><div class="txt_module">File Bar Number .:</div></td>
<td align="left" class = "line_dash" width="76%">
<input name="file_bar_number" type="file" id="file_bar_number" size="50" />
<font color="#FF0000"> </font></td>
</tr>
<tr>
<td align="right" class = "line_dash" width="24%"> </td>
<td align="left" class = "line_dash" width="76%">
<input name="cmd" type="submit" id="cmd" value="Add"/> </td>
</tr>
</table>
<p>{if $vassign.content_data.Full_P ne 'Null' }</p>
<p>{$vassign.content_data.Full_P} </p>
<font color="red">Add File Success.......</font><br />
{$vassign.content_data.rtn}
<p>{/if}</p>
</form>
</td>
</tr>
</table></td></tr>
</table>
</fieldset>
</td></tr>
</table>
<br />
</td>
Date :
2012-03-19 11:45:06
By :
nuttanicha14
funion ที่ส่งค่าการติดต่อ web service
Code (JavaScript)
function FileBarNumber(){
$this->load->Model('common/mcommon', 'mcomm');
$loginInfo = $this->session->userdata('loginInfo');
$arrData = array();
$notice = '';
$cmd = $this->input->get('cmd', true); // view for edit
$cmdAct = $this->input->post('cmd'); // command post
$file_bar_number = $this->input->post('file_bar_number');
log_message('info', "command cmdAction[$cmdAct]command[$cmd]");
$dirBarNumber = './uploads/FileBarNumber';
$arrData['Full_P']='Null';
if ($cmdAct == "Add") {
$this->load->library('upload');
$ser = $this->upload->set_upload_path($dirBarNumber);
log_message('error', '>>>>>' . $ser . '***');
$this->upload->set_allowed_types("txt|csv|xls");
if (!is_dir($dirBarNumber)) {
if (!mkdir($dirBarNumber, 0777, true)) {
log_message('info', ">>>>>>>>>>Can\'t crate directory [$dirBarNumber]");
}
}
// JAVA
$url="http://127.0.0.1:8080/BarNumberWs/BarNumberWS?wsdl";
$func="barnumber";
// $fct = '';
if ($this->upload->do_upload('file_bar_number')) {
$data_upload= $this->upload->data();
$Full_P=$data_upload['full_path'];
log_message('info',"pathFile :".$Full_P);
$arrData['Full_P']=$Full_P;
$param = array('urlbarnumber' => $Full_P);
$rtn = $this->mcomm->callws($url,$func,$param); //ติดต่อ web web service ผ่าน ฟังชัน callws ส่งค่าการติดต่อไป
$arrData['rtn'] = $rtn ;
} else {
$error = $this->upload->display_errors();
log_message('error', '>>>>>' . $error . '***');
}// end upload file bar number
}
$this->session->set_userdata('noticeMess', $notice);
$this->session->set_userdata('pagetop', array());
$this->session->set_userdata('stitle', 'view ani stop service');
$this->session->set_userdata('data_content', $arrData);
$this->session->set_userdata('body_content', 'panel/vCCFileBarNum.tpl');
$this->member();
}
Date :
2012-03-19 11:46:40
By :
nuttanicha14
function ติอต่อ web service
function callws($url, $func, $param) { //ฟังชันที่ใช้ติดต่อ web server
$client = new SoapClient($url, array('trace' => 1));
$client->__setLocation($url);
$client->__soapCall($func, array($param));
$rtn= $client->__getLastRequest();
return $rtn;
}
Date :
2012-03-19 11:47:39
By :
nuttanicha14
พอรันแล้วเกิดปัญหา คือ
Fatal error: Uncaught SoapFault exception: [env:Server] Unexpected Error java.lang.NoSuchMethodError: co.m3tech.ws.ThBarNumber: method <init>(Ljava/lang/String;)V not found at co.m3tech.ws.BarNumberWS.barnumber(BarNumberWS.java:35) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.jboss.aop.joinpoint.MethodInvocation.invokeTarget(MethodInvocation.java:122) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:111) at org.jboss.ejb3.EJBContainerInvocationWrapper.invokeNext(EJBContainerInvocationWrapper.java:69) at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.invoke(InterceptorSequencer.java:73) at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.aroundInvoke(InterceptorSequencer.java:59) at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ in D:\xampp\htdocs\SabMobile\application\models\common\mcommon.php on line 69
มีใครพอจะช่วยได้บ้างมั้ยค่ะ
Date :
2012-03-19 11:48:34
By :
nuttanicha14
Load balance : Server 05