package com.botwave.sms.webservice.impl;
import java.util.Date;
import javax.annotation.Resource;
import javax.jws.WebService;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.xml.ws.WebServiceContext;
import javax.xml.ws.handler.MessageContext;
import org.apache.cxf.message.Message;
import org.apache.cxf.transport.http.AbstractHTTPDestination;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@WebService
public class SendSMSImpl implements SendSMS{
private Logger log = LoggerFactory.getLogger(this.getClass());
@Resource
private WebServiceContext context;
@Override
public ResultObj sendSMSInfo(String username, String password,
String smsContent, String sendStartDt,
String sendEndDt, String spName, String businessId,
String streamNo) {
String ip = getIp();
return obj;
}
public String getIp(){
try{
MessageContext ctx = context.getMessageContext();
HttpServletRequest request = (HttpServletRequest)
ctx.get(AbstractHTTPDestination.HTTP_REQUEST);
String ip=request.getRemoteAddr();
return ip ;
} catch(Exception e){
return "获取ip失败" ;
}
}
}
阅读(3322) | 评论(0) | 转发(0) |