概述
webservice 客户端编写,saop
webservice 根据wsdl编写代码
package ttttttt;
import java.rmi.RemoteException;
import javax.xml.namespace.QName;
import javax.xml.rpc.ServiceException;
import org.apache.axis.AxisEngine;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.constants.Style;
import org.apache.axis.constants.Use;
import org.apache.axis.description.OperationDesc;
import org.apache.axis.description.ParameterDesc;
import org.apache.axis.soap.SOAPConstants;
import org.junit.Test;
public class TestCord {
@Test
public void test() {
ApprovalLogDAO dao = new ApprovalLogDAO();
dao.setCONTRACT_NO("9192011222231211");
dao.setNUMBER_TYPE("1");
dao.setAPPROVALS("");
dao.setSTATUS("S");
dao.setAPPROVER("李娜");
dao.setAPPROVAL_DATE("2019-03-03");
dao.setAPPROVAL_TIME("15:20:22");
dao.setDEPARTMENT("业务部");
dao.setAPPLY_CONTENT("业务部审批审核意见");
dao.setAPPLY_NUM(5);
dao.setAPPROVAL_UP(1);
dao.setAPPROVAL_TYPE(1);
dao.setAPPLY_NUMBER(1);
dao.setCUST_ID(11111L);
Service service = new Service();
Call call = null;
try {
call = (Call) service.createCall();
} catch (ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String endpoint = "http://125.89.66.5:58080/services/apiServiceApprovalProcess";
call.setTargetEndpointAddress(endpoint);
OperationDesc oper = new OperationDesc();
oper.setName("apiServiceApprovalLog");
ParameterDesc param = new ParameterDesc(new QName("", "arg0"), ParameterDesc.IN,
new QName("http://services.approvalprocess.biz.itonghui.com/", "approvalLogDAO"), ApprovalLogDAO.class,
false, false);
oper.addParameter(param);
oper.setReturnType(new QName("http://www.w3.org/2001/XMLSchema", "string"));
oper.setReturnClass(String.class);
oper.setReturnQName(new QName("", "return"));
oper.setStyle(Style.WRAPPED);
oper.setUse(Use.LITERAL);
call.setOperation(oper);
//call.setReturnType(XMLType.XSD_STRING);
call.setUseSOAPAction(true);
call.setSOAPActionURI("");
call.setEncodingStyle(null);
call.setProperty(Call.SEND_TYPE_ATTR, Boolean.FALSE);
call.setProperty(AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
call.setSOAPVersion(SOAPConstants.SOAP11_CONSTANTS);
call.setOperationName(new QName("http://services.approvalprocess.biz.itonghui.com/", "apiServiceApprovalLog"));
try {
String result = (String) call.invoke(new Object[] { dao });
System.out.println(result);
} catch (RemoteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} // 远程调用
}
}
/**
* ApprovalLogDAO.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
*/
package ttttttt;
import javax.xml.namespace.QName;
import org.apache.axis.description.ElementDesc;
import org.apache.axis.description.TypeDesc;
import org.apache.axis.encoding.Deserializer;
import org.apache.axis.encoding.Serializer;
import org.apache.axis.encoding.ser.BeanDeserializer;
import org.apache.axis.encoding.ser.BeanSerializer;
public class ApprovalLogDAO implements java.io.Serializable {
private String APPLY_CONTENT;
private Integer APPLY_NUM;
private Integer APPLY_NUMBER;
private String APPROVALS;
private String APPROVAL_DATE;
private String APPROVAL_TIME;
private Integer APPROVAL_TYPE;
private Integer APPROVAL_UP;
private String APPROVER;
private String CONTRACT_NO;
private Long CUST_ID;
private String DEPARTMENT;
private String NUMBER_TYPE;
private String STATUS;
public ApprovalLogDAO() {
}
public ApprovalLogDAO(String APPLY_CONTENT, Integer APPLY_NUM, Integer APPLY_NUMBER, String APPROVALS,
String APPROVAL_DATE, String APPROVAL_TIME, Integer APPROVAL_TYPE, Integer APPROVAL_UP, String APPROVER,
String CONTRACT_NO, Long CUST_ID, String DEPARTMENT, String NUMBER_TYPE, String STATUS) {
this.APPLY_CONTENT = APPLY_CONTENT;
this.APPLY_NUM = APPLY_NUM;
this.APPLY_NUMBER = APPLY_NUMBER;
this.APPROVALS = APPROVALS;
this.APPROVAL_DATE = APPROVAL_DATE;
this.APPROVAL_TIME = APPROVAL_TIME;
this.APPROVAL_TYPE = APPROVAL_TYPE;
this.APPROVAL_UP = APPROVAL_UP;
this.APPROVER = APPROVER;
this.CONTRACT_NO = CONTRACT_NO;
this.CUST_ID = CUST_ID;
this.DEPARTMENT = DEPARTMENT;
this.NUMBER_TYPE = NUMBER_TYPE;
this.STATUS = STATUS;
}
public String getAPPLY_CONTENT() {
return APPLY_CONTENT;
}
public void setAPPLY_CONTENT(String aPPLY_CONTENT) {
APPLY_CONTENT = aPPLY_CONTENT;
}
public Integer getAPPLY_NUM() {
return APPLY_NUM;
}
public void setAPPLY_NUM(Integer aPPLY_NUM) {
APPLY_NUM = aPPLY_NUM;
}
public Integer getAPPLY_NUMBER() {
return APPLY_NUMBER;
}
public void setAPPLY_NUMBER(Integer aPPLY_NUMBER) {
APPLY_NUMBER = aPPLY_NUMBER;
}
public String getAPPROVALS() {
return APPROVALS;
}
public void setAPPROVALS(String aPPROVALS) {
APPROVALS = aPPROVALS;
}
public String getAPPROVAL_DATE() {
return APPROVAL_DATE;
}
public void setAPPROVAL_DATE(String aPPROVAL_DATE) {
APPROVAL_DATE = aPPROVAL_DATE;
}
public String getAPPROVAL_TIME() {
return APPROVAL_TIME;
}
public void setAPPROVAL_TIME(String aPPROVAL_TIME) {
APPROVAL_TIME = aPPROVAL_TIME;
}
public Integer getAPPROVAL_TYPE() {
return APPROVAL_TYPE;
}
public void setAPPROVAL_TYPE(Integer aPPROVAL_TYPE) {
APPROVAL_TYPE = aPPROVAL_TYPE;
}
public Integer getAPPROVAL_UP() {
return APPROVAL_UP;
}
public void setAPPROVAL_UP(Integer aPPROVAL_UP) {
APPROVAL_UP = aPPROVAL_UP;
}
public String getAPPROVER() {
return APPROVER;
}
public void setAPPROVER(String aPPROVER) {
APPROVER = aPPROVER;
}
public String getCONTRACT_NO() {
return CONTRACT_NO;
}
public void setCONTRACT_NO(String cONTRACT_NO) {
CONTRACT_NO = cONTRACT_NO;
}
public Long getCUST_ID() {
return CUST_ID;
}
public void setCUST_ID(Long cUST_ID) {
CUST_ID = cUST_ID;
}
public String getDEPARTMENT() {
return DEPARTMENT;
}
public void setDEPARTMENT(String dEPARTMENT) {
DEPARTMENT = dEPARTMENT;
}
public String getNUMBER_TYPE() {
return NUMBER_TYPE;
}
public void setNUMBER_TYPE(String nUMBER_TYPE) {
NUMBER_TYPE = nUMBER_TYPE;
}
public String getSTATUS() {
return STATUS;
}
public void setSTATUS(String sTATUS) {
STATUS = sTATUS;
}
// Type metadata
private static TypeDesc typeDesc = new TypeDesc(ApprovalLogDAO.class, true);
static {
typeDesc.setXmlType(new QName("http://services.approvalprocess.biz.itonghui.com/", "approvalLogDAO"));
ElementDesc elemField = new ElementDesc();
elemField.setFieldName("APPLY_CONTENT");
elemField.setXmlName(new QName("", "APPLY_CONTENT"));
elemField.setXmlType(new QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setMinOccurs(0);
elemField.setNillable(false);
typeDesc.addFieldDesc(elemField);
elemField = new ElementDesc();
elemField.setFieldName("APPLY_NUM");
elemField.setXmlName(new QName("", "APPLY_NUM"));
elemField.setXmlType(new QName("http://www.w3.org/2001/XMLSchema", "int"));
elemField.setMinOccurs(0);
elemField.setNillable(false);
typeDesc.addFieldDesc(elemField);
elemField = new ElementDesc();
elemField.setFieldName("APPLY_NUMBER");
elemField.setXmlName(new QName("", "APPLY_NUMBER"));
elemField.setXmlType(new QName("http://www.w3.org/2001/XMLSchema", "int"));
elemField.setMinOccurs(0);
elemField.setNillable(false);
typeDesc.addFieldDesc(elemField);
elemField = new ElementDesc();
elemField.setFieldName("APPROVALS");
elemField.setXmlName(new QName("", "APPROVALS"));
elemField.setXmlType(new QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setMinOccurs(0);
elemField.setNillable(false);
typeDesc.addFieldDesc(elemField);
elemField = new ElementDesc();
elemField.setFieldName("APPROVAL_DATE");
elemField.setXmlName(new QName("", "APPROVAL_DATE"));
elemField.setXmlType(new QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setMinOccurs(0);
elemField.setNillable(false);
typeDesc.addFieldDesc(elemField);
elemField = new ElementDesc();
elemField.setFieldName("APPROVAL_TIME");
elemField.setXmlName(new QName("", "APPROVAL_TIME"));
elemField.setXmlType(new QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setMinOccurs(0);
elemField.setNillable(false);
typeDesc.addFieldDesc(elemField);
elemField = new ElementDesc();
elemField.setFieldName("APPROVAL_TYPE");
elemField.setXmlName(new QName("", "APPROVAL_TYPE"));
elemField.setXmlType(new QName("http://www.w3.org/2001/XMLSchema", "int"));
elemField.setMinOccurs(0);
elemField.setNillable(false);
typeDesc.addFieldDesc(elemField);
elemField = new ElementDesc();
elemField.setFieldName("APPROVAL_UP");
elemField.setXmlName(new QName("", "APPROVAL_UP"));
elemField.setXmlType(new QName("http://www.w3.org/2001/XMLSchema", "int"));
elemField.setMinOccurs(0);
elemField.setNillable(false);
typeDesc.addFieldDesc(elemField);
elemField = new ElementDesc();
elemField.setFieldName("APPROVER");
elemField.setXmlName(new QName("", "APPROVER"));
elemField.setXmlType(new QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setMinOccurs(0);
elemField.setNillable(false);
typeDesc.addFieldDesc(elemField);
elemField = new ElementDesc();
elemField.setFieldName("CONTRACT_NO");
elemField.setXmlName(new QName("", "CONTRACT_NO"));
elemField.setXmlType(new QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setMinOccurs(0);
elemField.setNillable(false);
typeDesc.addFieldDesc(elemField);
elemField = new ElementDesc();
elemField.setFieldName("CUST_ID");
elemField.setXmlName(new QName("", "CUST_ID"));
elemField.setXmlType(new QName("http://www.w3.org/2001/XMLSchema", "long"));
elemField.setMinOccurs(0);
elemField.setNillable(false);
typeDesc.addFieldDesc(elemField);
elemField = new ElementDesc();
elemField.setFieldName("DEPARTMENT");
elemField.setXmlName(new QName("", "DEPARTMENT"));
elemField.setXmlType(new QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setMinOccurs(0);
elemField.setNillable(false);
typeDesc.addFieldDesc(elemField);
elemField = new ElementDesc();
elemField.setFieldName("NUMBER_TYPE");
elemField.setXmlName(new QName("", "NUMBER_TYPE"));
elemField.setXmlType(new QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setMinOccurs(0);
elemField.setNillable(false);
typeDesc.addFieldDesc(elemField);
elemField = new ElementDesc();
elemField.setFieldName("STATUS");
elemField.setXmlName(new QName("", "STATUS"));
elemField.setXmlType(new QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setMinOccurs(0);
elemField.setNillable(false);
typeDesc.addFieldDesc(elemField);
}
/**
* Return type metadata object
*/
public static TypeDesc getTypeDesc() {
return typeDesc;
}
/**
* Get Custom Serializer
*/
public static Serializer getSerializer(String mechType, Class _javaType, QName _xmlType) {
return new BeanSerializer(_javaType, _xmlType, typeDesc);
}
/**
* Get Custom Deserializer
*/
public static Deserializer getDeserializer(String mechType, Class _javaType, QName _xmlType) {
return new BeanDeserializer(_javaType, _xmlType, typeDesc);
}
}
最后
以上就是迷路白猫为你收集整理的webservice 客户端代码编写(一)的全部内容,希望文章能够帮你解决webservice 客户端代码编写(一)所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复