移动MISC1.6平台Provision同步接口开发(Tomcat5.5 + AXIS1.2)
来源:互联网 发布:电影人间喜剧 知乎 编辑:程序博客网 时间:2024/06/10 18:03
http://blog.chinaunix.net/u/8202/showart.php?id=34553首页 | 文章 | 相册 | 收藏夹 | 留言
移动MISC1.6平台Provision同步接口开发(Tomcat5.5 + AXIS1.2)移动MISC1.6平台Provision同步接口开发(Tomcat5.5 + AXIS1.2)
----------------------------------------------------------------
/**
* 版权: 雪夜清风 [ Jeansan] 所有 ;
*
* MSN: qingfeng0826@hotmail.com
* QQ : 331999816
*
* */
----------------------------------------------------------------
说明 : 系统采用AXIS 1.2+Tomcat 5.5,如果无axis知识,建议可以到IBM开发者上搜索相关 AXIS 文档浏览
—————————————————————————————————————
1、 配置好AXIS 1.2
2、 将wsdl 文件 copy 到 TOMCAT_HOMEwebappsaxisWEB-INF 下
Wsdl 文件由于MISC提供的不能生成 header ;经过修改以后的新的WSDL文件为:
<definitions xmlns:ws="http://www.monternet.com/dsmp/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.ort/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:dsmp="http://www.monternet.com/dsmp/schemas/" targetNamespace="http://www.monternet.com/dsmp/wsdl/">
<types>
<schema targetNamespace="http://www.monternet.com/dsmp/schemas/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="qualified">
<complexType name="address_info_schema">
<sequence>
<element name="DeviceType" type="xsd:integer"/>
<element name="DeviceID" type="xsd:string"/>
</sequence>
</complexType>
<complexType name="user_id_schema">
<sequence>
<element name="UserIDType" type="xsd:integer"/>
<element name="MSISDN" type="xsd:string"/>
<element name="PseudoCode" type="xsd:base64Binary"/>
</sequence>
</complexType>
<complexType name="service_id_schema">
<sequence>
<element name="ServiceIDType" type="integer"/>
<element name="SPID" type="string"/>
<element name="SPServiceID" type="string"/>
<element name="AccessNo" type="string"/>
<element name="FeatureStr" type="base64Binary"/>
</sequence>
</complexType>
<!-- request & response -->
<element name="TransactionID" type="xsd:string"/>
<element name="SyncOrderRelationReq" type="dsmp:SyncOrderRelationReqType"/>
<complexType name="SyncOrderRelationReqType">
<sequence>
<element name="MsgType" type="xsd:string"/>
<element name="Version" type="xsd:string"/>
<element name="Send_Address" type="dsmp:address_info_schema"/>
<element name="Dest_Address" type="dsmp:address_info_schema"/>
<element name="FeeUser_ID" type="dsmp:user_id_schema"/>
<element name="DestUser_ID" type="dsmp:user_id_schema"/>
<element name="LinkID" type="xsd:string" minOccurs="0"/>
<element name="ActionID" type="xsd:integer"/>
<element name="ActionReasonID" type="xsd:integer"/>
<element name="SPID" type="xsd:string" minOccurs="0"/>
<element name="SPServiceID" type="xsd:string"/>
<element name="AccessMode" type="xsd:integer" minOccurs="0"/>
<element name="FeatureStr" type="xsd:base64Binary" minOccurs="0"/>
</sequence>
</complexType>
<element name="SyncOrderRelationResp" type="dsmp:SyncOrderRelationRespType"/>
<complexType name="SyncOrderRelationRespType">
<sequence>
<element name="MsgType" type="xsd:string"/>
<element name="Version" type="xsd:string"/>
<element name="hRet" type="xsd:integer"/>
</sequence>
</complexType>
<element name="SubscribeServiceReq" type="dsmp:SubscribeServiceReqType"/>
<complexType name="SubscribeServiceReqType">
<sequence>
<element name="Version" type="string"/>
<element name="MsgType" type="string"/>
<element name="Send_Address" type="dsmp:address_info_schema"/>
<element name="Dest_Address" type="dsmp:address_info_schema"/>
<element name="FeeUser_ID" type="dsmp:user_id_schema"/>
<element name="DestUser_ID" type="dsmp:user_id_schema"/>
<element name="Service_ID" type="dsmp:service_id_schema"/>
<element name="FeatureStr" type="base64Binary" minOccurs="0"/>
</sequence>
</complexType>
<element name="SubscribeServiceResp" type="dsmp:SubscribeServiceRespType"/>
<complexType name="SubscribeServiceRespType">
<sequence>
<element name="Version" type="string"/>
<element name="MsgType" type="string"/>
<element name="hRet" type="integer"/>
<element name="LinkID" type="string" minOccurs="0"/>
</sequence>
</complexType>
<element name="UnSubscribeServiceReq" type="dsmp:UnSubscribeServiceReqType"/>
<complexType name="UnSubscribeServiceReqType">
<sequence>
<element name="Version" type="string"/>
<element name="MsgType" type="string"/>
<element name="Send_Address" type="dsmp:address_info_schema"/>
<element name="Dest_Address" type="dsmp:address_info_schema"/>
<element name="FeeUser_ID" type="dsmp:user_id_schema"/>
<element name="DestUser_ID" type="dsmp:user_id_schema"/>
<element name="Service_ID" type="dsmp:service_id_schema"/>
</sequence>
</complexType>
<element name="UnSubscribeServiceResp" type="dsmp:UnSubscribeServiceRespType"/>
<complexType name="UnSubscribeServiceRespType">
<sequence>
<element name="Version" type="string"/>
<element name="MsgType" type="string"/>
<element name="hRet" type="integer"/>
</sequence>
</complexType>
</schema>
</types>
<message name="ma.SyncOrderRelationReq">
<part name="SyncOrderRelationInput" element="dsmp:SyncOrderRelationReq"/>
<part name="TransactionIDInput" element="dsmp:TransactionID"/>
</message>
<message name="ma.SyncOrderRelationResp">
<part name="SyncOrderRelationOutput" element="dsmp:SyncOrderRelationResp"/>
<part name="TransactionIDOut" element="dsmp:TransactionID"/>
</message>
<message name="ma.SubscribeServiceReq">
<part name="SubscribeServiceInput" element="dsmp:SubscribeServiceReq"/>
<part name="TransactionIDInput" element="dsmp:TransactionID"/>
</message>
<message name="ma.SubscribeServiceResp">
<part name="SubscribeServiceOutput" element="dsmp:SubscribeServiceResp"/>
<part name="TransactionIDOut" element="dsmp:TransactionID"/>
</message>
<message name="ma.UnSubscribeServiceReq">
<part name="UnSubscribeServiceInput" element="dsmp:UnSubscribeServiceReq"/>
<part name="TransactionIDInput" element="dsmp:TransactionID"/>
</message>
<message name="ma.UnSubscribeServiceResp">
<part name="UnSubscribeServiceOutput" element="dsmp:UnSubscribeServiceResp"/>
<part name="TransactionIDOut" element="dsmp:TransactionID"/>
</message>
<portType name="maPort">
<operation name="SyncOrderRelation">
<input message="ws:ma.SyncOrderRelationReq"/>
<output message="ws:ma.SyncOrderRelationResp"/>
</operation>
<operation name="SubscribeService">
<input message="ws:ma.SubscribeServiceReq"/>
<output message="ws:ma.SubscribeServiceResp"/>
</operation>
<operation name="UnSubscribeService">
<input message="ws:ma.UnSubscribeServiceReq"/>
<output message="ws:ma.UnSubscribeServiceResp"/>
</operation>
</portType>
<binding name="maPortBinding" type="ws:maPort">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="SubscribeService">
<soap:operation soapAction="sim.SubscribeService" style="document"/>
<input>
<soap:body use="literal" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://10.1.2.122/misc/dsmp.xsd"/>
<soap:header message="ws:ma.SubscribeServiceReq" part="TransactionIDInput" use="literal" encodingStyle="http://schemas.xmlsoap.org/soap/encoding" namespace="http://10.1.2.122/misc/dsmp.xsd"/>
</input>
<output>
<soap:body use="literal" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://10.1.2.122/misc/dsmp.xsd"/>
<soap:header message="ws:ma.SubscribeServiceResp" part="TransactionIDOut" use="literal" encodingStyle="http://schemas.xmlsoap.org/soap/encoding" namespace="http://10.1.2.122/misc/dsmp.xsd"/>
</output>
</operation>
<operation name="SyncOrderRelation">
<soap:operation soapAction="sim.SyncOrderRelation" style="document"/>
<input>
<soap:body use="literal" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://10.1.2.122/misc/dsmp.xsd"/>
<soap:header message="ws:ma.SyncOrderRelationReq" part="TransactionIDInput" use="literal" encodingStyle="http://schemas.xmlsoap.org/soap/encoding" namespace="http://10.1.2.122/misc/dsmp.xsd"/>
</input>
<output>
<soap:body use="literal" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://10.1.2.122/misc/dsmp.xsd"/>
<soap:header message="ws:ma.SyncOrderRelationResp" part="TransactionIDOut" use="literal" encodingStyle="http://schemas.xmlsoap.org/soap/encoding" namespace="http://10.1.2.122/misc/dsmp.xsd"/>
</output>
</operation>
<operation name="UnSubscribeService">
<soap:operation soapAction="sim.UnSubscribeService" style="document"/>
<input>
<soap:body use="literal" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://10.1.2.122/misc/dsmp.xsd"/>
<soap:header message="ws:ma.UnSubscribeServiceReq" part="TransactionIDInput" use="literal" encodingStyle="http://schemas.xmlsoap.org/soap/encoding" namespace="http://10.1.2.122/misc/dsmp.xsd"/>
</input>
<output>
<soap:body use="literal" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://10.1.2.122/misc/dsmp.xsd"/>
<soap:header message="ws:ma.UnSubscribeServiceResp" part="TransactionIDOut" use="literal" encodingStyle="http://schemas.xmlsoap.org/soap/encoding" namespace="http://10.1.2.122/misc/dsmp.xsd"/>
</output>
</operation>
</binding>
<service name="dsmp">
<port name="maPort" binding="ws:maPortBinding">
<soap:address location="http://localhost:8080/axis/services/maPort"/>
</port>
</service>
</definitions>
3、 生成客户端,服务端代码:
使用命令:Java -Djava.ext.dirs=lib org.apache.axis.wsdl.WSDL2Java --server-side --skeletonDeploy true dsmp.wsdl
4、 deploy.wsdd 用来发布service
MaPortBindingImpl.java 服务短编程使用
MaPortBindingStub.java 客户端编程使用
5、 建立服务:
使用命令 :java org.apache.axis.utils.Admin client|server deploy.wsdd
建立服务端和客户端的服务。
如果建立服务不成功,可以直接将commonternetwwwdsmpwsdl下的deploy.wsdd中的<service>...</service>之间的文字直接拷贝到server-config.wsdd文件中。
查看服务,如果没有发布成功是因为没有生成相关的class文件,可以先编译MaPortBindingSkeleton.java文件,然后查看是否发布。
6、 编写测试代码:
package com.misc.client;
import java.math.BigInteger;
import java.net.URL;
import javax.xml.rpc.holders.StringHolder;
import com.monternet.www.dsmp.schemas.Address_info_schema;
import com.monternet.www.dsmp.schemas.SyncOrderRelationReqType;
import com.monternet.www.dsmp.schemas.SyncOrderRelationRespType;
import com.monternet.www.dsmp.schemas.User_id_schema;
import com.monternet.www.dsmp.schemas.holders.SyncOrderRelationRespTypeHolder;
import com.monternet.www.dsmp.wsdl.MaPortBindingStub;
//import com.monternet.www.dsmp.*;
/*
* 移动MISC系统升级,SP客户端测试环境
*/
public class miscClient {
private static BigInteger msg;
public static void main(String[] args) {
MaPortBindingStub binding = null;
SyncOrderRelationRespType resp = null;
SyncOrderRelationReqType req=new SyncOrderRelationReqType();
SyncOrderRelationRespTypeHolder syncOrderRelationOutput = new SyncOrderRelationRespTypeHolder();
StringHolder transactionIDOut = new StringHolder();
/**
*
* TransactionID 由返回的provision包里面的对应字段来决定,然后放到响应包里面的对应字段
* TransactionID不是sp生成的
*
*/
// 根据 - 数据业务管理平台接口规范-1.5.1 定义。可以参考schemas 下的类文件
BigInteger devicetypeSend_Address = BigInteger.valueOf(201);
BigInteger devicetypeDest_Address = BigInteger.valueOf(0);
BigInteger UserIDTypeFeeUser_ID = BigInteger.valueOf(1);
BigInteger ActionID = BigInteger.valueOf(1);
BigInteger ActionReasonID = BigInteger.valueOf(1);
BigInteger AccessMode = BigInteger.valueOf(3);
byte[] pseudoCode = new byte[]{};
// 对于一些固定的值来决定
Address_info_schema Send_Address = new Address_info_schema();
Send_Address.setDeviceID("misc");
Send_Address.setDeviceType(devicetypeSend_Address);
Address_info_schema Dest_Address = new Address_info_schema();
Dest_Address.setDeviceID("1212");
Dest_Address.setDeviceType(devicetypeDest_Address);
User_id_schema FeeUser_ID = new User_id_schema();
FeeUser_ID.setMSISDN("13583153328");
FeeUser_ID.setUserIDType(UserIDTypeFeeUser_ID);
FeeUser_ID.setPseudoCode(pseudoCode);
User_id_schema DestUser_ID = new User_id_schema();
DestUser_ID.setMSISDN("13583153328");
DestUser_ID.setUserIDType(UserIDTypeFeeUser_ID);
DestUser_ID.setPseudoCode(pseudoCode);
/**
* 给请求赋值
*/
req.setMsgType("SubscribeServiceReq");
req.setVersion("1.5.0");
req.setSend_Address(Send_Address);
req.setDest_Address(Dest_Address);
req.setFeeUser_ID(FeeUser_ID);
req.setDestUser_ID(DestUser_ID);
req.setLinkID(""); // 可选
req.setActionID(ActionID);
req.setActionReasonID(ActionReasonID);
req.setSPID("082601");
req.setSPServiceID("dz");
req.setAccessMode(AccessMode);
try {
URL endpoint = new URL("http://localhost:8080/axis/services/maPort"); //详细见说明1 和说明 2 说明3
binding = (MaPortBindingStub) new com.monternet.www.dsmp.wsdl.DsmpLocator().getmaPort(endpoint);
binding.setTimeout(60000);
binding.syncOrderRelation(req,"00240301806870",syncOrderRelationOutput,transactionIDOut);
resp = syncOrderRelationOutput.value;
String tranID = transactionIDOut.value;
System.out.println(tranID);
System.out.println(resp.getMsgType());
System.out.println(resp.getVersion());
System.out.println(resp.getHRet());
if((resp.getHRet()).equals("0")){
System.out.println("Transact Success!");
}
}
catch (Exception e) {
e.printStackTrace();
}
}
}
说明1、 该URL是在真实环境中提交给 MISC平台的地址;
说明2、 该URL指向本地的服务地址,一定要保证 访问该URL时候提示为:
maPort
Hi there, this is an AXIS service!
Perhaps there will be a form for invoking the service here...
说明3 、本出URL
- 移动MISC1.6平台Provision同步接口开发(Tomcat5.5 + AXIS1.2)
- 浙江移动MISC1.6平台的Provision接口(短信定制关系同步接口)
- 浙江移动MISC1.6平台反向取消接口(取消短信定制关系)
- MISC1.6平台介绍
- 移动的provision接口
- .net开发Provision接口
- 威狼移动Provision接口(ASP.NET)
- 移动MISC平台provision开发 4 (补充说明)-webservise(axis)
- webservice+axis1.4接口开发
- java webservice开发和调用(jdk1.5+eclipse3.4 + tomcat5.5+axis1.4+xfire1.2.6)
- provision接口
- SP 短信开发-PROVISION接口实现1
- 移动MISC 1.6平台Provison同步接口开发(Tomcat 5.5 + AXIS 1.2)
- Python2.6 MISC1
- SP 短信开发-PROVISION接口实现-反向取消实例代码
- SP 短信开发-PROVISION接口实现-正向订购实例代码
- PROVISION接口规范说明
- 中国移动misc provision接口程序 v1.6 绿色
- ++obj与obj++
- Java 多种文件读写方式
- ZedGraph用法
- 写dos程序发现的一个fwrite的问题
- 应用程序框架设计之前言
- 移动MISC1.6平台Provision同步接口开发(Tomcat5.5 + AXIS1.2)
- 关于Hibernate3的escape解决方法
- [转]走进GPU通用计算的世界:专访NVIDIA亚太区技术市场经理邓培智
- javascript中的表单验证
- asp.net的AutoEventWireup标签起什么作用
- 深入BCB理解VCL的消息机制
- 详细解说STL string
- 六个经典的英语面试问题
- 浅谈hibernate性能优化的几点建议