webService-客户端,服务端

1.服务端

首先,像平常方法一样。开发方法

   
public class OSSProcessSheetService {
   /** * XX接口 * @return */ public String checkinWorkSheet(int sheetType, int serviceType, String serialNo, String serSupplier, String serCaller, String callerPwd, String callTime, String attachRef, String opPerson, String opCorp, String opDepart, String opContact, String opTime, String opDetail) {

      return "";
}
}

开发完成后,直接在wsdd文件发布就可以了

    <service name="OSSProcessSheetService" provider="java:RPC">
     <!-- 要开放的接口路径 --> <parameter name="className" value="com.ztesoft.oss.gx.mobile.ws.esop.OSSProcessSheetService"/>
    <!-- 要开放的方法,多个方法用逗号隔开 --> <parameter name="allowedMethods" value="checkinWorkSheet"/>
<!-- 开放的方法的参数 --> <operation name="checkinWorkSheet" qname="operNS:checkinWorkSheet" xmlns:operNS="??http://sheetservice.webservice.bboss.asiainfo.com" returnQName="checkinWorkSheetReturn" returnType="rtns:string" xmlns:rtns="http://schemas.xmlsoap.org/soap/encoding/" soapAction="" > <parameter qname="sheetType" type="tns:int" xmlns:tns="http://www.w3.org/2001/XMLSchema"/> <parameter qname="serviceType" type="tns:int" xmlns:tns="http://www.w3.org/2001/XMLSchema"/> <parameter qname="serialNo" type="tns:string" xmlns:tns="http://schemas.xmlsoap.org/soap/encoding/"/> <parameter qname="serSupplier" type="tns:string" xmlns:tns="http://schemas.xmlsoap.org/soap/encoding/"/> <parameter qname="serCaller" type="tns:string" xmlns:tns="http://schemas.xmlsoap.org/soap/encoding/"/> <parameter qname="callerPwd" type="tns:string" xmlns:tns="http://schemas.xmlsoap.org/soap/encoding/"/> <parameter qname="callTime" type="tns:string" xmlns:tns="http://schemas.xmlsoap.org/soap/encoding/"/> <parameter qname="attachRef" type="tns:string" xmlns:tns="http://schemas.xmlsoap.org/soap/encoding/"/> <parameter qname="opPerson" type="tns:string" xmlns:tns="http://schemas.xmlsoap.org/soap/encoding/"/> <parameter qname="opCorp" type="tns:string" xmlns:tns="http://schemas.xmlsoap.org/soap/encoding/"/> <parameter qname="opDepart" type="tns:string" xmlns:tns="http://schemas.xmlsoap.org/soap/encoding/"/> <parameter qname="opContact" type="tns:string" xmlns:tns="http://schemas.xmlsoap.org/soap/encoding/"/> <parameter qname="opTime" type="tns:string" xmlns:tns="http://schemas.xmlsoap.org/soap/encoding/"/> <parameter qname="opDetail" type="tns:string" xmlns:tns="http://schemas.xmlsoap.org/soap/encoding/"/> </operation> </service>

 

2.客户端

客户端直接用axis调用即可

关于WSClient的创建 可以百度axis的相关知识

            String url = "http://10.184.233.80:18020/IomInterface/services/OSSProcessSheetService?wsdl";
            String methodName = "checkinWorkSheet";
            WSClient client = new WSClient(url);
            String result = client.invoke(methodName, new Object[] { sheetType,
                    serviceType, serialNo, serSupplier, serCaller, callerPwd,
                    callTime, attachRef, opPerson, opCorp, opDepart, opContact,
                    opTime, opDetail });

 或者:

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;

        Service service = new Service();
        Call call = (Call)service.createCall();
        call.setTargetEndpointAddress(eomsUrl);
        call.setUseSOAPAction(true);
        call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
        call.setOperationName(new QName("",method));
        String result = (String)call.invoke(objs);
        return result;

 

posted @ 2018-04-15 16:44  林被熊烟岛  阅读(174)  评论(0)    收藏  举报