Java开发中webservice接口调用

本文介绍了在Java开发中如何调用WebService接口,包括需要账号密码验证和无需验证的两种情况,通过导入.wsdl文件生成本地类来实现与ERP或CRM系统的数据交互。
摘要由CSDN通过智能技术生成

webservice接口:

在两个项目中都有webservice接口,实现与第三方的erp或crm系统进行数据交互,两个项目接口的区别是一个需要头文件的账号密码验证,另一个不需要。

一、本地导入.wsdl文件,生成本地类;

package com.wxbusiness.utils;

import com.wxbusiness.webservice.customer.CustomerDTO;
import com.wxbusiness.webservice.customer.CustomerResult;
import com.wxbusiness.webservice.customer.CustomerService_PortType;
import com.wxbusiness.webservice.customer.CustomerService_Service;
import com.wxbusiness.webservice.customer.CustomerService_ServiceLocator;
/**
 * WebService接口
 */
public class WebService {
	/**
	 * 功能模块初始化
	 */	
	/**
	 * 初始化数据 crm模块
	 */
	public static CustomerService_PortType customerCp(){
		//crm模块
		CustomerService_ServiceLocator css = new CustomerService_ServiceLocator();
		css.setCustomerSoapServiceImplPortEndpointAddress("http://"+IP+"/crm/customerservice");
		CustomerService_Service cs = css;
		//接口集
		CustomerService_PortType cp;
		try {
			cp = cs.getCustomerSoapServiceImplPort();
			return cp;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}
	/**
	 * 具体方法
	 */
	public s
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值