首先先查看接口通不通
如果如下图:
则说明接口没有问题,可以调用。
代码如下:
package com.web.client;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.PostMethod;
import org.springframework.http.HttpStatus;
import com.web.client.DatecodeLot;
import com.fasterxml.jackson.databind.ObjectMapper;
import net.sf.json.JSONArray;
public class WebServiceClient {
public static void main(String args[]) throws IOException {
String str =
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
+ "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n"
+ " <soap:Body>\n"
+ " <GetDCLOTByREFDESInfo xmlns=\"http://tempuri.org/\">\n"
+ " <ISN>C7H01970QF3L73WAD,C7H01970QF4L73WAC,C7H01970QF5L73WAB,C7H01970QF6L73WAA</ISN>\n"
+ " <refdes>L2750,L2740</refdes>\n"
+ " </GetDCLOTByREFDESInfo>\n"
+ " </soap:Body>\n"
+ "</soap:Envelope>";
System.out.println(str);
// WebServiceClient.cl6(str);
WebServiceClient.cl3();
}
public static void cl6(String xml) throws IOException {