⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 messagenotificationserviceskeleton.java

📁 电信sms接口源代码
💻 JAVA
字号:
/**
 * MessageNotificationServiceSkeleton.java
 *
 * This file was auto-generated from WSDL
 * by the Apache Axis2 version: 1.3  Built on : Aug 10, 2007 (04:45:47 LKT)
 */
package cn.com.chinatelecom.www.wsdl.ctcc.multimedia_messaging.notification.v2_2.service;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;

import javax.activation.DataHandler;

import org.apache.axiom.attachments.Attachments;
import org.apache.axis2.context.MessageContext;

import cn.com.chinatelecom.www.schema.ctcc.multimedia_messaging.notification.v2_2.local.NotifyMessageDeliveryReceiptResponse;
import cn.com.chinatelecom.www.schema.ctcc.multimedia_messaging.notification.v2_2.local.NotifyMessageDeliveryReceiptResponse7;
import cn.com.chinatelecom.www.schema.ctcc.multimedia_messaging.notification.v2_2.local.NotifyMessageReceptionResponse;
import cn.com.chinatelecom.www.schema.ctcc.multimedia_messaging.notification.v2_2.local.NotifyMessageReceptionResponse6;
import cn.com.chinatelecom.www.schema.ctcc.multimedia_messaging.v2_2.MessageReference;

/**
 *  MessageNotificationServiceSkeleton java skeleton for the axisService
 */
public class MessageNotificationServiceSkeleton {
    /**
     * Auto generated method signature
     * @param notifyMessageReception
     */
    public cn.com.chinatelecom.www.schema.ctcc.multimedia_messaging.notification.v2_2.local.NotifyMessageReceptionResponse6 notifyMessageReception(
        cn.com.chinatelecom.www.schema.ctcc.multimedia_messaging.notification.v2_2.local.NotifyMessageReception4 notifyMessageReception) {
        //TODO : fill this with the necessary business logic
    	
    	MessageReference msgRef = notifyMessageReception.getNotifyMessageReception().getMessage();

    	//打印消息
    	System.out.println("Get notifyMessageReception message :");
    	System.out.println("RegistrationIdentifier = " + notifyMessageReception.getNotifyMessageReception().getRegistrationIdentifier());
        System.out.println("     MessageIdentifier = " + msgRef.getMessageIdentifier());
        System.out.println("      ActivationNumber = " + msgRef.getMessageServiceActivationNumber());
        System.out.println("         SenderAddress = " + msgRef.getSenderAddress());
        System.out.println("               Subject = " + msgRef.getSubject());
        System.out.println("              Priority = " + msgRef.getPriority().getValue());
        System.out.println("               Message = " + msgRef.getMessage());
    	
    	//保存附件
        try
        {
	    	Attachments attachments = new Attachments();
			MessageContext msgCtx = MessageContext.getCurrentMessageContext();
			attachments = msgCtx.getAttachmentMap();
			String[] content_id = attachments.getAllContentIDs();
			for (int i = 0; i < content_id.length; i++)
			{
				DataHandler dataHandler = attachments.getDataHandler(content_id[i]);

				File file = null;
				if (dataHandler.getContentType().contains("text"))
				{
					file = new File("C:\\test" + i + ".txt");    //文本附件
				}
				else if (dataHandler.getContentType().contains("image"))
				{
					file = new File("C:\\test" + i + ".jpg");    //图片附件
				}
				else
				{
					file = new File("C:\\test" + i + ".dat");
				}

				FileOutputStream fileOutputStream = new FileOutputStream(file);
				dataHandler.writeTo(fileOutputStream);
				fileOutputStream.flush();
				fileOutputStream.close();
			}
        }
        catch (IOException e)
        {
        	e.printStackTrace();
        }
        catch (Exception e)
        {
        	e.printStackTrace();
        }

        NotifyMessageReceptionResponse6 response = new NotifyMessageReceptionResponse6();
    	NotifyMessageReceptionResponse param = new NotifyMessageReceptionResponse();
    	response.setNotifyMessageReceptionResponse(param);

    	return response;
//        throw new java.lang.UnsupportedOperationException("Please implement " +
//            this.getClass().getName() + "#notifyMessageReception");
    }

    /**
     * Auto generated method signature
     * @param notifyMessageDeliveryReceipt
     */
    public cn.com.chinatelecom.www.schema.ctcc.multimedia_messaging.notification.v2_2.local.NotifyMessageDeliveryReceiptResponse7 notifyMessageDeliveryReceipt(
        cn.com.chinatelecom.www.schema.ctcc.multimedia_messaging.notification.v2_2.local.NotifyMessageDeliveryReceipt5 notifyMessageDeliveryReceipt) {
        //TODO : fill this with the necessary business logic
//    	打印消息
    	System.out.println("Get notifyMessageDeliveryStatus message :");
    	System.out.println("    Correlator = " + notifyMessageDeliveryReceipt.getNotifyMessageDeliveryReceipt().getCorrelator());
    	System.out.println("       Address = " + notifyMessageDeliveryReceipt.getNotifyMessageDeliveryReceipt().getDeliveryStatus().getAddress());
    	System.out.println("DeliveryStatus = " + notifyMessageDeliveryReceipt.getNotifyMessageDeliveryReceipt().getDeliveryStatus().getDeliveryStatus().getValue());

    	NotifyMessageDeliveryReceiptResponse7 response = new NotifyMessageDeliveryReceiptResponse7();
    	NotifyMessageDeliveryReceiptResponse param = new NotifyMessageDeliveryReceiptResponse();
    	response.setNotifyMessageDeliveryReceiptResponse(param);

    	return response;
//        throw new java.lang.UnsupportedOperationException("Please implement " +
//            this.getClass().getName() + "#notifyMessageDeliveryReceipt");
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -