一、联通vac请求报文
<?xml version="1.0" encoding="utf-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV ="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC ="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi ="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd ="http://www.w3.org/2001/XMLSchema" xmlns:m0 ="http://req.sync.soap.bossagent.vac.unicom.com" xmlns:m1 ="http://schemas.xmlsoap.org/soap/encoding/" >
<SOAP-ENV:Body >
<m:orderRelationUpdateNotify xmlns:m ="http://soap.bossagent.vac.unicom.com" SOAP-ENV:encodingStyle ="http://schemas.xmlsoap.org/soap/encoding/" >
<orderRelationUpdateNotifyRequest xsi:type ="m0:OrderRelationUpdateNotifyRequest" >
<recordSequenceId > 201806251813057005</recordSequenceId >
<userIdType > 1</userIdType >
<userId > 18627818645</userId >
<serviceType > 90</serviceType >
<spId > 44494</spId >
<productId > 9071992401</productId >
<updateType > 1</updateType >
<updateTime > 20180625180931</updateTime >
<updateDesc > 106553574</updateDesc >
<linkId />
<content > Y</content >
<effectiveDate > 20180625181000</effectiveDate >
<expireDate > 21001231000000</expireDate >
<time_stamp > 0625181305</time_stamp >
<encodeStr > 1862781864590719924010625181305</encodeStr >
</orderRelationUpdateNotifyRequest >
</m:orderRelationUpdateNotify >
</SOAP-ENV:Body >
</SOAP-ENV:Envelope >
二、maven依赖
<properties >
<project.build.sourceEncoding > UTF-8</project.build.sourceEncoding >
<spring-version > 4.3.7.RELEASE</spring-version >
<cxf.version > 3.1.8</cxf.version >
</properties >
<dependencies >
<dependency >
<groupId > org.springframework</groupId >
<artifactId > spring-context</artifactId >
<version > ${spring-version}</version >
</dependency >
<dependency >
<groupId > org.springframework</groupId >
<artifactId > spring-web</artifactId >
<version > ${spring-version}</version >
</dependency >
<dependency >
<groupId > org.apache.cxf</groupId >
<artifactId > cxf-core</artifactId >
<version > ${cxf.version}</version >
</dependency >
<dependency >
<groupId > org.apache.cxf</groupId >
<artifactId > cxf-rt-transports-http</artifactId >
<version > ${cxf.version}</version >
</dependency >
<dependency >
<groupId > org.apache.cxf</groupId >
<artifactId > cxf-rt-frontend-jaxws</artifactId >
<version > ${cxf.version}</version >
</dependency >
</dependencies >
三、配置web.xml
<context-param >
<param-name > contextConfigLocation</param-name >
<param-value > classpath:spring-cxf.xml</param-value >
</context-param >
<listener >
<listener-class > org.springframework.web.context.ContextLoaderListener</listener-class >
</listener >
<servlet >
<servlet-name > CXFServlet</servlet-name >
<servlet-class > org.apache.cxf.transport.servlet.CXFServlet</servlet-class >
<load-on-startup > 1</load-on-startup >
</servlet >
<servlet-mapping >
<servlet-name > CXFServlet</servlet-name >
<url-pattern > /*</url-pattern >
</servlet-mapping >
四、配置spring-cxf.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns ="http://www.springframework.org/schema/beans"
xmlns:context ="http://www.springframework.org/schema/context"
xmlns:aop ="http://www.springframework.org/schema/aop" xmlns:xsi ="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws ="http://cxf.apache.org/jaxws"
xsi:schemaLocation ="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd"
default-autowire ="byType" default-lazy-init ="true" >
<description > Apache CXF的WebService配置</description >
<jaxws:endpoint id ="orderRelationUpdateNotify"
implementor ="com.unicom.vac.bossagent.soap.OrderRelationUpdateNotifyImpl"
address ="/orderRelationUpdateNotifyService" />
</beans >
五、创建对应的包和java文件
5.1 创建包com.unicom.vac.bossagent.soap
5.2 创建OrderRelationUpdateNotifyRequest
/**
* sp请求参数 . <br>
*
* @author hkb <br>
*/
public class OrderRelationUpdateNotifyRequest {
/** 流水号 */
private String recordSequenceId;
/** 用户ID类型 */
private Integer userIdType;
/** 用户手机号码或伪码 */
private String userId;
/** 业务类型 */
private String serviceType;
/** SP标识 */
private String spId;
/** 产品标识 */
private String productId;
/** 更新操作的类型 */
private Integer updateType;
/** 更新时间 */
private String updateTime;
/** 更新操作的详细描述 */
private String updateDesc;
/** 事务关联ID */
private String linkId;
/** 内容 */
private String content;
/** 订购关系生效时间 */
private String effectiveDate;
/** 订购关系失效时间 */
private String expireDate;
/** 时间戳由VAC生成 */
private String time_stamp;
/** */
private String encodeStr;
}
5.3 创建Response
/**
* sp返回结果 . <br>
*
* @author hkb <br>
*/
public class Response {
/** 流水号 */
private String recordSequenceId;
/** 结果标识: 0-正确,1-错误 */
private int resultCode;
}
5.4 创建OrderRelationUpdateNotifyService
/**
* sp接口 . <br>
*
* @author hkb <br>
*/
@WebService (targetNamespace = "http://soap.bossagent.vac.unicom.com" )
public interface OrderRelationUpdateNotifyService {
@WebMethod (operationName = "orderRelationUpdateNotify" )
public Response orderRelationUpdateNotify (
@WebParam (name = "orderRelationUpdateNotifyRequest" ) OrderRelationUpdateNotifyRequest orderRelationUpdateNotifyRequest);
}
5.5 创建OrderRelationUpdateNotifyImpl
/**
* sp实现类 . <br>
*
* @author hkb <br>
*/
@WebService
public class OrderRelationUpdateNotifyImpl implements OrderRelationUpdateNotifyService {
@Override
public Response orderRelationUpdateNotify (OrderRelationUpdateNotifyRequest orderRelationUpdateNotifyRequest) {
Response response = new Response();
response.setRecordSequenceId(orderRelationUpdateNotifyRequest.getRecordSequenceId());
response.setResultCode(0 );
return response;
}
}
六、运行项目和测试
6.2 测试结果