Prompt for timeout when calling WebService using Axis

15 Views Asked by At

This is the code I wrote,I am sure there is no problem with the address and request parameters set here. The request parameters are of XML type

      String result = "";
        try {
            String encodingStyle = "utf-8";
            //WSDL的地址
            String endpoint = emrClientConfig.getWsdlUrl();
            System.out.println(endpoint);
            //命名空间,在WSDL中对应的标签是:参见说明第3条
            String targetNamespace = "http://www.kedauis.com";
            //具体方法的调用URI,在WSDL中对应的标签是:参见说明第4条
            String soapActionURI = targetNamespace + "/call";
            //具体调用的方法名,在WSDL中对应的标签是:参见说明第5条
            String method = "call";
            //调用接口的参数的名字
            String[] paramNames = {"header","content"};
            //调用接口的参数的值
            StringBuffer headerTemp = new StringBuffer();


            Service service = new Service();
            Call call = (Call) service.createCall();
            //设置超时时间
            call.setTimeout(new Integer(60000));
            call.setSOAPActionURI(soapActionURI);
            //设置目标接口的地址
            call.setTargetEndpointAddress(new URL(endpoint));
            //设置传入服务端的字符集格式如utf-8等
            call.setEncodingStyle(encodingStyle);
            //具体方法名
            call.setOperationName(new QName(targetNamespace,method));
            call.setUseSOAPAction(true);
            call.addParameter(new QName(targetNamespace,paramNames[0]),
                    XMLType.XSD_STRING,
                    ParameterMode.IN);
            call.addParameter(new QName(targetNamespace,paramNames[1]),
                    XMLType.XSD_STRING,
                    ParameterMode.IN);
            call.setReturnType(XMLType.XSD_STRING);
            //设置协议版本
            call.setSOAPVersion(SOAPConstants.SOAP11_CONSTANTS);
            String header = WebServiceUtil.form

However, the error result is as follows. This issue has been bothering me for a long time, and I can't be sure if the boss wants to fire me anymore

AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode:
 faultString: java.net.SocketTimeoutException: Read timed out
 faultActor:
 faultNode:
 faultDetail:
        {http://xml.apache.org/axis/}stackTrace:java.net.SocketTimeoutException: Read timed out
        at java.net.SocketInputStream.socketRead0(Native Method)
        at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
        at java.net.SocketInputStream.read(SocketInputStream.java:171)
        at java.net.SocketInputStream.read(SocketInputStream.java:141)
        at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
        at java.io.BufferedInputStream.read(BufferedInputStream.java:265)

I tried to set the timeout and protocol type, but none of them were possible

0

There are 0 best solutions below