Java 带Web服务的SMSlib
我正在使用SMSlib使用串行gsm调制解调器发送消息。我需要使用同一应用程序多次发送SMS。我运行了SMSlib示例,没有出现问题,它运行得很好。但是当我尝试在Web服务下使用相同的代码时,它只能使用一次。当第二次尝试使用时,会出现以下错误。我使用了python客户端Java 带Web服务的SMSlib,java,python,web-services,smslib,Java,Python,Web Services,Smslib,我正在使用SMSlib使用串行gsm调制解调器发送消息。我需要使用同一应用程序多次发送SMS。我运行了SMSlib示例,没有出现问题,它运行得很好。但是当我尝试在Web服务下使用相同的代码时,它只能使用一次。当第二次尝试使用时,会出现以下错误。我使用了python客户端 C:\Users\k4n\Desktop\web>python SendSMS.py No handlers could be found for logger "suds.client" Traceback (most
C:\Users\k4n\Desktop\web>python SendSMS.py
No handlers could be found for logger "suds.client"
Traceback (most recent call last):
File "SendSMS.py", line 16, in <module>
result = client.doIt()
File "SendSMS.py", line 8, in doIt
return self.client.service.doIt("Testing")
File "build\bdist.win32\egg\suds\client.py", line 542, in __call__
File "build\bdist.win32\egg\suds\client.py", line 602, in invoke
File "build\bdist.win32\egg\suds\client.py", line 649, in send
File "build\bdist.win32\egg\suds\client.py", line 702, in failed
File "build\bdist.win32\egg\suds\bindings\binding.py", line 265, in get_fault
suds.WebFault: Server raised fault: 'Comm library exception: java.lang.RuntimeException:
javax.comm.PortInUseException: Port currently owned by org.smslib'
Web服务(实现)
端点发布器
package com.k4n.webservice;
import javax.xml.ws.Endpoint;
import com.k4n.webservice.GetURLImpl;
//Endpoint publisher
public class GetURLPublisher{
public static void main(String[] args) {
Endpoint.publish("http://localhost:9999/ws/hello", new GetURLImpl());
System.out.println("Now the web service is up...");
}
}
这是第二次发送短信时发出的短信
Example: Send message from a serial gsm modem.
SMSLib: A Java API library for sending and receiving SMS via a GSM modem or other supported gateways.
This software is distributed under the terms of the Apache v2.0 License.
Web Site: http://smslib.org
Version: 3.5.0
[pool-1-thread-1] INFO smslib - Queue directory not defined. Queued messages will not be saved to filesystem.
[Thread-16] INFO smslib - GTW: modem.com1: Starting gateway, using Huawei (Generic) AT Handler.
[Thread-16] INFO smslib - GTW: modem.com1: Opening: COM12 @115200
[Thread-15] INFO smslib - GTW: modem.com1: Starting gateway, using Huawei (Generic) AT Handler.
[Thread-15] INFO smslib - GTW: modem.com1: Opening: COM12 @115200
[Thread-15] INFO smslib - GTW: modem.com1: Closing: COM12 @115200
SEND :(27)
[pool-1-thread-1] INFO smslib - GTW: modem.com1: Stopping gateway...
[pool-1-thread-1] INFO smslib - GTW: modem.com1: Closing: COM12 @115200
[pool-1-thread-1] INFO smslib - GTW: modem.com1: Gateway stopped.
[pool-1-thread-1] INFO smslib - GTW: modem.com1: Stopping gateway...
SEND :+++
[pool-1-thread-1] INFO smslib - GTW: modem.com1: Closing: COM12 @115200
[Thread-16] INFO smslib - GTW: modem.com1: Closing: COM12 @115200
[pool-1-thread-1] INFO smslib - GTW: modem.com1: Gateway stopped.
为什么我会犯这个错误?我如何解决这个问题?得到答案了吗
停止服务后卸下网关
String message1 = url;
OutboundMessage msg = new OutboundMessage("mygroup", message1);
Service.getInstance().sendMessage(msg);
System.out.println(msg);
Service.getInstance().stopService();
Service.getInstance().removeGateway(gateway);//remove the gateway
这对我很有用。与论坛网站不同,我们不使用“谢谢”或“感谢任何帮助”或签名。顺便说一句,这是“提前感谢”,而不是“提前感谢”。
Example: Send message from a serial gsm modem.
SMSLib: A Java API library for sending and receiving SMS via a GSM modem or other supported gateways.
This software is distributed under the terms of the Apache v2.0 License.
Web Site: http://smslib.org
Version: 3.5.0
[pool-1-thread-1] INFO smslib - Queue directory not defined. Queued messages will not be saved to filesystem.
[Thread-16] INFO smslib - GTW: modem.com1: Starting gateway, using Huawei (Generic) AT Handler.
[Thread-16] INFO smslib - GTW: modem.com1: Opening: COM12 @115200
[Thread-15] INFO smslib - GTW: modem.com1: Starting gateway, using Huawei (Generic) AT Handler.
[Thread-15] INFO smslib - GTW: modem.com1: Opening: COM12 @115200
[Thread-15] INFO smslib - GTW: modem.com1: Closing: COM12 @115200
SEND :(27)
[pool-1-thread-1] INFO smslib - GTW: modem.com1: Stopping gateway...
[pool-1-thread-1] INFO smslib - GTW: modem.com1: Closing: COM12 @115200
[pool-1-thread-1] INFO smslib - GTW: modem.com1: Gateway stopped.
[pool-1-thread-1] INFO smslib - GTW: modem.com1: Stopping gateway...
SEND :+++
[pool-1-thread-1] INFO smslib - GTW: modem.com1: Closing: COM12 @115200
[Thread-16] INFO smslib - GTW: modem.com1: Closing: COM12 @115200
[pool-1-thread-1] INFO smslib - GTW: modem.com1: Gateway stopped.
String message1 = url;
OutboundMessage msg = new OutboundMessage("mygroup", message1);
Service.getInstance().sendMessage(msg);
System.out.println(msg);
Service.getInstance().stopService();
Service.getInstance().removeGateway(gateway);//remove the gateway