<!-- https://mvnrepository.com/artifact/org.apache.axis/axis -->
<dependency>
<groupId>org.apache.axis</groupId>
<artifactId>axis</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>javax.xml.rpc</groupId>
<artifactId>javax.xml.rpc-api</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>commons-discovery</groupId>
<artifactId>commons-discovery</artifactId>
<version>0.4</version>
</dependency>
import org.apache.axis.client.Service;
import javax.xml.namespace.QName;
import org.apache.axis.client.Call;
import javax.xml.rpc.ParameterMode;
import javax.xml.rpc.encoding.XMLType;
import java.security.cert.TrustAnchor;
public class WebServiceClient {
static String inputXmlRis = "<Request>" +
"<RequestType>GetDGExamInfo</RequestType>" +
"<RequestInfo>" +
"<Hospital_Code>" + 1 + "</Hospital_Code>" +
"<BeginDate>" + 1 + "</BeginDate>" +
"<EndDate>" + 1 + "</EndDate>" +
"<AccessNo>" + 1 +"</AccessNo>" +
"</RequestInfo>" +
"</Request>";
public static void doSelectRiskReportForm(){
try {
String url = "http://localhost/TMEasyRis/Services.asmx";
String namespace="http://tempuri.org/";
String methodName="tmEasyRisService";
String soapActionURI = "http://tempuri.org/TMEasyRisService";
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(url);
call.setUseSOAPAction(true);
call.setSOAPActionURI(soapActionURI);
String parametersName = "inputXml";
call.setOperationName(new QName(namespace, methodName));
call.addParameter(parametersName, XMLType.XSD_STRING, ParameterMode.IN);
call.setReturnType(XMLType.XSD_STRING);
String result = (String) call.invoke(new Object[] { inputXmlRis });
System.out.println("result is " + result);
} catch (Exception e) {
System.err.println(e.toString());
}
}
public static void main(String[] args) {
doSelectRiskReportForm();
}
}