java微信公眾平台開發
⑴ 如何使用java開發微信公眾平台介面
1、首先,要在微信公眾平台給你的賬號申請到「高級功能」 ;前台也就是菜單要想個性化設置必須要有這個功能,不然你只能添加菜單和關閉,但不能刪除,還有自動回復也是。
2、後台要看你自己了。
⑵ 如何使用jsp開發微信公眾平台,或者使用java語言開發公眾平台
一碧桐句話 按照微信的規定開發:網路微信公眾號開API ; 申請伺服器 ; 申請公眾號 ;綁定 ,開通許可權等 ;我們一直茄扒在用 jsp 、顫慧昌java開發。
⑶ 微信公眾平台自定義菜單java開發
不是訪問你自己的服務么?追問是自己的伺服器,感覺自定義菜單是應該在微信的伺服器里運行才可以回答自定義的菜單
微信里只是一個鏈接
調用的是你自己的服務
你要自己部署一個伺服器
有對外的訪問ip追問那是菜單設置完成後考慮的事,鏈接,公網ip我都有,現在只差這個菜單設置了回答哦
終於搞懂了
那個是微信提供了一個管理的界面啊
可以設置菜單名稱
鏈接之類的追問怪我沒說明白,我現在有介面代碼,問題是不知道怎麼讓它部署運行回答tomcat部署服務?是少這個么追問不是,微信公眾平台開發者模式首先需要介面來鏈接你自己的伺服器,這個介面我已經用web工程部署運行了,現在可以開發了,就是開發自定義的菜單,我網上找了點代碼,現在不知道這些代碼該放在web工程的哪裡才能運行,上面的介面我是用的servlet,我把代碼放到servlet的post方法里執行不了,不知道為何回答那這個跟微信有什麼關系
你自己啟動一個服務運行不了
這里就涉及到你用的什麼框架等等一堆問題
但都是你自己的事,與微信無關追問no,no,no
⑷ java微信公眾號怎麼做
這個問題太廣泛了,只能簡單和您說明一下。首先注冊微信公眾號,然後使用java開發伺服器並與微信後台伺服器完成驗證。根據實際的需求與微信開發文檔即可進行功能開發
⑸ 怎麼搭建微信公眾平台java開發環境
這個比較復雜,首先需要申請一個微信公眾的訂閱好或服務號,還要開通各種介面,然後在本地安裝java開發環境,包括開發工具如eclipse,myeclipse。最重要的是能在公網有一個地址映射到本地,如果是在區域網,則需要藉助第三方工具,推薦使用花生殼、nat123,其中nat123是個比較好的工具,很好的解決了運營商80埠封鎖的問題,因為微信公眾平台配置伺服器的URL只能是80埠。
⑹ Java 開發 微信公眾平台開發 URL驗證
和訂閱號和服務號不一樣,企業號只有企業通信錄員工才能關
注,同時,一個企業號可以配置多個類似的服務號應用,發送信息
的條數無限制,還能對信息進行安全設置,確保信息的安全性和私密
性。
企業號申請和訂閱號以及服務號申請的前期准備和步驟相
同。比如,准備好一個注冊郵箱,然後進行郵箱驗證。但是從驗證之後
的申請步驟就有所區別了。在郵箱激活後,用戶進入選擇賬號類型,選
擇點擊「企業號」,會彈出溫馨提示對話框,提醒選擇企業號後不可更
改,是否繼續操作,點擊「確認」,進入用戶信息登記頁面。
⑺ 微信公眾平台 java開發 能用oracle資料庫嗎
微信公眾平台是可以開發java調用oracle這類型的介面的,一般通過MyBatis連接Oracle資料庫。
舉例如下:
1、先建立一個資料庫表,名為PERSON_INFO,建表sql如下:
createTABLEPERSON_INFO
(
idnumber(12,0)PRIMARYKEY,
namevarchar2(20)NOTNULL,
genderchar(1)DEFAULT'',
remarkvarchar2(1000),
input_datenumber(10,0)DEFAULTto_number(to_char(sysdate,'yyyymmdd')),
input_timenumber(10,0)DEFAULTto_number(to_char(sysdate,'hh24miss'))
);
2、編寫java程序,項目中文件的上下級關系如圖:
5、建立對應的Java類:PersonInfo,其中各屬性對應於數據表PERSON_INFO中的各欄位
publicclassPersonInfo{
Longid;
Stringname;
Stringgender;
Stringremark;
LonginputDate;
LonginputTime;
publicLonggetId(){
returnid;
}
publicvoidsetId(Longid){
this.id=id;
}
publicStringgetName(){
returnname;
}
publicvoidsetName(Stringname){
this.name=name;
}
publicStringgetGender(){
returngender;
}
publicvoidsetGender(Stringgender){
this.gender=gender;
}
publicStringgetRemark(){
returnremark;
}
publicvoidsetRemark(Stringremark){
this.remark=remark;
}
publicLonggetInputDate(){
returninputDate;
}
publicvoidsetInputDate(LonginputDate){
this.inputDate=inputDate;
}
publicLonggetInputTime(){
returninputTime;
}
publicvoidsetInputTime(LonginputTime){
this.inputTime=inputTime;
}
}
6、建立對應的Java類:PersonInfoMapper
importjava.util.List;
{
List<PersonInfo>selectAllPersonInfo();
7、建立一個類MyBatisTest用於存放main函數,查詢PERSON_INFO表中所有的數據並列印
importjava.io.InputStream;
importjava.util.List;
importorg.apache.ibatis.io.Resources;
importorg.apache.ibatis.session.SqlSession;
importorg.apache.ibatis.session.SqlSessionFactory;
importorg.apache.ibatis.session.SqlSessionFactoryBuilder;
/**
*MyBatis使用測試
*@author pieryon
*@date2016年4月1日
*@time下午21:47:01
*@remark
*
*/
publicclassMyBatisTest{
publicstaticvoidmain(String[]args){
try{
Stringresource="mybatis-config.xml";
InputStreaminputStream=Resources.getResourceAsStream(resource);
=newSqlSessionFactoryBuilder().build(inputStream);
SqlSessionsession=sqlSessionFactory.openSession();
try{
PersonInfoMappermapper=session.getMapper(PersonInfoMapper.class);
List<PersonInfo>personInfos=mapper.selectAllPersonInfo();
if(personInfos==null){
System.out.println("Theresultisnull.");
}else{
for(PersonInfopersonInfo:personInfos){
System.out.println("---PersonInfo---");
System.out.println("name:"+personInfo.name);
System.out.println("gender:"+personInfo.gender);
System.out.println("remark:"+personInfo.remark);
System.out.println("inputDate:"+personInfo.inputDate);
System.out.println("inputTime:"+personInfo.inputTime);
System.out.println();
}
}
}finally{
session.close();
}
}catch(Exceptionex){
ex.printStackTrace();
}
}
}
8、運行main函數,控制台輸出結果如下:
---PersonInfo---
name:Tsybius
gender:m
remark:-
inputDate:20160229
inputTime:225703
---PersonInfo---
name:Galatea
gender:f
remark:-
inputDate:20160228
inputTime:123456
⑻ 微信公眾平台開發需要什麼語言_微信用什麼語言開發的
根據你滲毀緩自己的具體情況,php、叢模java、jsp、asp都可以,但php是用的余嫌最多的,官方給的實例demo也是php的
⑼ 求java微信公眾號開發積分商城源碼模板
費用多少?主要分備配銷為兩種開發方式:
一、模板賣液開發,功能已經開發完成了,直接套用模板就能生成帶直播、分銷、社區團購等功能的小程序商城了,這種方式上線時間快,基本3-7天就能上線成功、進行直播。性價比也較高,幾千就能做超50營銷功能的小程序了。
二、定製開發,是由開發公司根據你的需求來一個個開發的,因為耗時會比較長,幾個月到半年,主要還是看你的需求復雜程度,仿游費用大概是3萬起步,上不封頂的。
⑽ 如何用java開發微信
說明:
本次的教程主要是對微信公眾平台開發者模式的講解,網路上很多類似文章,但很多都讓初學微信開發的人一頭霧水,所以總結自己的微信開發經驗,將微信開發的整個過程系統的列出,並對主要代碼進行講解分析,讓初學者盡快上手。
在閱讀本文之前,應對微信公眾平台的官方開發文檔有所了解,知道接收和發送的都是xml格式的數據。另外,在做內容回復時用到了圖靈機器人的api介面,這是一個自然語言解析的開放平台,可以幫我們解決整個微信開發過程中最困難的問題,此處不多講,下面會有其詳細的調用方式。
1.1 在登錄微信官方平台之後,開啟開發者模式,此時需要我們填寫url和token,所謂url就是我們自己伺服器的介面,用WechatServlet.java來實現,相關解釋已經在注釋中說明,代碼如下:
[java]view plain
packagedemo.servlet;
importjava.io.BufferedReader;
importjava.io.IOException;
importjava.io.InputStream;
importjava.io.InputStreamReader;
importjava.io.OutputStream;
importjavax.servlet.ServletException;
importjavax.servlet.http.HttpServlet;
importjavax.servlet.http.HttpServletRequest;
importjavax.servlet.http.HttpServletResponse;
importdemo.process.WechatProcess;
/**
*微信服務端收發消息介面
*
*@authorpamchen-1
*
*/
{
/**
*ThedoGetmethodoftheservlet.<br>
*
*.
*
*@paramrequest
*
*@paramresponse
*
*@throwsServletException
*ifanerroroccurred
*@throwsIOException
*ifanerroroccurred
*/
publicvoiddoGet(HttpServletRequestrequest,HttpServletResponseresponse)
throwsServletException,IOException{
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
/**讀取接收到的xml消息*/
StringBuffersb=newStringBuffer();
InputStreamis=request.getInputStream();
InputStreamReaderisr=newInputStreamReader(is,"UTF-8");
BufferedReaderbr=newBufferedReader(isr);
Strings="";
while((s=br.readLine())!=null){
sb.append(s);
}
Stringxml=sb.toString();//次即為接收到微信端發送過來的xml數據
Stringresult="";
/**判斷是否是微信接入激活驗證,只有首次接入驗證時才會收到echostr參數,此時需要把它直接返回*/
Stringechostr=request.getParameter("echostr");
if(echostr!=null&&echostr.length()>1){
result=echostr;
}else{
//正常的微信處理流程
result=newWechatProcess().processWechatMag(xml);
}
try{
OutputStreamos=response.getOutputStream();
os.write(result.getBytes("UTF-8"));
os.flush();
os.close();
}catch(Exceptione){
e.printStackTrace();
}
}
/**
*ThedoPostmethodoftheservlet.<br>
*
*
*post.
*
*@paramrequest
*
*@paramresponse
*
*@throwsServletException
*ifanerroroccurred
*@throwsIOException
*ifanerroroccurred
*/
publicvoiddoPost(HttpServletRequestrequest,HttpServletResponseresponse)
throwsServletException,IOException{
doGet(request,response);
}
}
<?xmlversion="1.0"encoding="UTF-8"?>
<web-appversion="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<servlet>
<description></description>
<display-name></display-name>
<servlet-name>WechatServlet</servlet-name>
<servlet-class>demo.servlet.WechatServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>WechatServlet</servlet-name>
<url-pattern>/wechat.do</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
packagedemo.process;
importjava.util.Date;
importdemo.entity.ReceiveXmlEntity;
/**
*微信xml消息處理流程邏輯類
*@authorpamchen-1
*
*/
publicclassWechatProcess{
/**
*解析處理xml、獲取智能回復結果(通過圖靈機器人api介面)
*@paramxml接收到的微信數據
*@return最終的解析結果(xml格式數據)
*/
publicStringprocessWechatMag(Stringxml){
/**解析xml數據*/
ReceiveXmlEntityxmlEntity=newReceiveXmlProcess().getMsgEntity(xml);
/**以文本消息為例,調用圖靈機器人api介面,獲取回復內容*/
Stringresult="";
if("text".endsWith(xmlEntity.getMsgType())){
result=newTulingApiProcess().getTulingResult(xmlEntity.getContent());
}
/**此時,如果用戶輸入的是「你好」,在經過上面的過程之後,result為「你也好」類似的內容
*因為最終回復給微信的也是xml格式的數據,所有需要將其封裝為文本類型返回消息
**/
result=newFormatXmlProcess().formatXmlAnswer(xmlEntity.getFromUserName(),xmlEntity.getToUserName(),result);
returnresult;
}
}
packagedemo.entity;
/**
*接收到的微信xml實體類
*@authorpamchen-1
*
*/
publicclassReceiveXmlEntity{
privateStringToUserName="";
privateStringFromUserName="";
privateStringCreateTime="";
privateStringMsgType="";
privateStringMsgId="";
privateStringEvent="";
privateStringEventKey="";
privateStringTicket="";
privateStringLatitude="";
privateStringLongitude="";
privateStringPrecision="";
privateStringPicUrl="";
privateStringMediaId="";
privateStringTitle="";
privateStringDescription="";
privateStringUrl="";
privateStringLocation_X="";
privateStringLocation_Y="";
privateStringScale="";
privateStringLabel="";
privateStringContent="";
privateStringFormat="";
privateStringRecognition="";
publicStringgetRecognition(){
returnRecognition;
}
publicvoidsetRecognition(Stringrecognition){
Recognition=recognition;
}
publicStringgetFormat(){
returnFormat;
}
publicvoidsetFormat(Stringformat){
Format=format;
}
publicStringgetContent(){
returnContent;
}
publicvoidsetContent(Stringcontent){
Content=content;
}
publicStringgetLocation_X(){
returnLocation_X;
}
publicvoidsetLocation_X(StringlocationX){
Location_X=locationX;
}
publicStringgetLocation_Y(){
returnLocation_Y;
}
publicvoidsetLocation_Y(StringlocationY){
Location_Y=locationY;
}
publicStringgetScale(){
returnScale;
}
publicvoidsetScale(Stringscale){
Scale=scale;
}
publicStringgetLabel(){
returnLabel;
}
publicvoidsetLabel(Stringlabel){
Label=label;
}
publicStringgetTitle(){
returnTitle;
}
publicvoidsetTitle(Stringtitle){
Title=title;
}
publicStringgetDescription(){
returnDescription;
}
publicvoidsetDescription(Stringdescription){
Description=description;
}
publicStringgetUrl(){
returnUrl;
}
publicvoidsetUrl(Stringurl){
Url=url;
}
publicStringgetPicUrl(){
returnPicUrl;
}
publicvoidsetPicUrl(StringpicUrl){
PicUrl=picUrl;
}
publicStringgetMediaId(){
returnMediaId;
}
publicvoidsetMediaId(StringmediaId){
MediaId=mediaId;
}
publicStringgetEventKey(){
returnEventKey;
}
publicvoidsetEventKey(StringeventKey){
EventKey=eventKey;
}
publicStringgetTicket(){
returnTicket;
}
publicvoidsetTicket(Stringticket){
Ticket=ticket;
}
publicStringgetLatitude(){
returnLatitude;
}
publicvoidsetLatitude(Stringlatitude){
Latitude=latitude;
}
publicStringgetLongitude(){
returnLongitude;
}
publicvoidsetLongitude(Stringlongitude){
Longitude=longitude;
}
publicStringgetPrecision(){
returnPrecision;
}
publicvoidsetPrecision(Stringprecision){
Precision=precision;
}
publicStringgetEvent(){
returnEvent;
}
publicvoidsetEvent(Stringevent){
Event=event;
}
publicStringgetMsgId(){
returnMsgId;
}
publicvoidsetMsgId(StringmsgId){
MsgId=msgId;
}
publicStringgetToUserName(){
returnToUserName;
}
publicvoidsetToUserName(StringtoUserName){
1.2 相應的web.xml配置信息如下,在生成WechatServlet.java的同時,可自動生成web.xml中的配置。前面所提到的url處可以填寫例如:http;//伺服器地址/項目名/wechat.do
[html]view plain
1.3 通過以上代碼,我們已經實現了微信公眾平台開發的框架,即開通開發者模式並成功接入、接收消息和發送消息這三個步驟。
下面就講解其核心部分——解析接收到的xml數據,並以文本類消息為例,通過圖靈機器人api介面實現智能回復。
2.1 首先看一下整體流程處理代碼,包括:xml數據處理、調用圖靈api、封裝返回的xml數據。
[java]view plain
2.2 解析接收到的xml數據,此處有兩個類,ReceiveXmlEntity.java和ReceiveXmlProcess.java,通過反射的機制動態調用實體類中的set方法,可以避免很多重復的判斷,提高代碼效率,代碼如下:
[java]view plain