iteye_9242
iteye_9242
2013-10-24 13:57
浏览 580
已采纳

WeService重复调用出现异常的问题

由于WebService接口是按照分页来获取数据,所以当需要获取全部数据时,就需要循环获取多次!但是在循环调用的过程中,执行到302次时,就出现了异常:
异常信息如下:
[code="java"]AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: java.lang.NullPointerException
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}hostname:WWW-C09C0AC6275

java.lang.NullPointerException
at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)
at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at com.peaksport.service.client.StockGoodsinfoClient.update2Goodsinfo(StockGoodsinfoClient.java:57)
at com.peaksport.service.client.StockGoodsinfoClient.main(StockGoodsinfoClient.java:71)[/code]调用WebService客户端的代码如下:[code="java"]public void update2Goodsinfo(Integer count) {
DBManager.prepare4UpdateGoodsinfo();
Service service = new Service();
Call call;
try {
call = (Call) service.createCall();
call.setOperationName("getLJStockGoodsinfo");
URL url = new URL(SERVER_URL);
call.setTargetEndpointAddress(url);
if (count != 0) {
List bgs = null;
String result = null;
for (int i = 1; i <= count; i++) {
System.out.println(i);
if(i==302){
System.out.println("toggle");
}
result = (String) call.invoke(new Object[] { VERYFY_CODE,
new String("" + i), PAGESIZE });
bgs = JSONParser.parseGoodsJson2List(result);// 解析成List集合
DBManager.update2Goodsinfo(bgs);

            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}[/code]提示是在[code="java"]result = (String) call.invoke(new Object[] { VERYFY_CODE,
                        new String("" + i), PAGESIZE });[/code]出现的异常!
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • wanghuanqiufly
    wanghuanqiufly 2013-10-25 11:03
    已采纳

    你这条数据有问题吧,应该是服务端查找这条数据时报错了

    点赞 评论

相关推荐