< 返回技术文档列表

JAVA调用C# WebService代码示例

发布时间:2022-11-17 22:59:34⊙投诉举报

package sample;

import java.net.URL;

import javax.xml.namespace.QName;

import javax.xml.rpc.ParameterMode;

import org.apache.axis.client.Call;

import org.apache.axis.client.Service;

import org.apache.axis.encoding.XMLType;

public class Sample {

    public static void main(String [] args) throws Exception {

        Call call = (Call)new Service().createCall();

        call.setTargetEndpointAddress(new URL("http://xxxx/interface/Dispatch.asmx"));

        call.setOperationName(new QName("http://tempuri.org/","GetSress3"));

        call.setUseSOAPAction(true);

        call.setSOAPActionURI("http://tempuri.org/GetSress3");

        call.addParameter(new QName("http://tempuri.org/", "User"),XMLType.XSD_STRING, ParameterMode.IN);

        call.addParameter(new QName("http://tempuri.org/", "Pass"),XMLType.XSD_STRING, ParameterMode.IN);

        call.addParameter(new QName("http://tempuri.org/", "MobilePhone"),XMLType.XSD_STRING, ParameterMode.IN);

        call.addParameter(new QName("http://tempuri.org/", "Type"),XMLType.XSD_STRING, ParameterMode.IN);

        call.setReturnType(XMLType.XSD_STRING);

        Object result = call.invoke(new String[]{"Ha", "124443", "1233443123122", "14"});

        System.out.println(result);

    }

}


/template/Home/Zkeys/PC/Static