日期:2014-05-20  浏览次数:20891 次

调用webservice出错。。。。在线等待高手
完整类;
package com.creaway.blackout.schedule;

import java.net.MalformedURLException;
import java.rmi.RemoteException;

import javax.xml.rpc.ServiceException;
import javax.xml.namespace.QName;

public class test {

static org.apache.axis.client.Call call=null;
static java.net.URL url=null;
static Object o = null;

static{
try {
url=new java.net.URL("http://10.96.0.216:9734/2EC66A60-24CF-0131-983C-00505696004F?wsdl");
} catch (MalformedURLException e) {
e.printStackTrace();
}
}


//调用接口
public static String getjkXML(String strXML){
try {
org.apache.axis.client.Service service =new org.apache.axis.client.Service();
call = (org.apache.axis.client.Call) service.createCall();
call.setTargetEndpointAddress(url);
call.setOperationName(new QName("http://www.tbi.ydtf.com.cn/","exec"));
call.addParameter("Request", org.apache.axis.Constants.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
call.setReturnType(org.apache.axis.Constants.XSD_STRING);
o = call.invoke(new Object[]{strXML}); 
 System.out.println(o);
} catch (ServiceException e) {
e.printStackTrace();
} catch (RemoteException e) {
e.printStackTrace();
}
return o.toString();
}

public static void main(String[] args) {
String strXML="<?xml version="1.0" encoding="UTF-8"?><RESULT><ZDHXXS><ZDHXX><DYBM>182</DYBM><TDJSRQ>20131106</TDJSRQ><SBBH>10000790</SBBH><JLDH>8077214</JLDH><XLBH>14584</XLBH><TDKSRQ>20131106</TDKSRQ><TDJSSJ>073000</TDJSSJ><YHBH>3000232264</YHBH><TDXC>1</TDXC><TDSC>270</TDSC><JGBM>302</JGBM><ZDBH>63000458</ZDBH><TDKSSJ>030000</TDKSSJ><SBBZ>2</SBBZ><PCBH>520</PCBH></ZDHXX><RECORDCOUNT>1</RECORDCOUNT></ZDHXXS></RESULT>";
System.out.println(getjkXML(strXML));
}
}
错误信息:
AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode: 
 faultString: org.xml.sax.SAXException: Bad envelope tag:  definitions
 faultActor: 
 faultNode: 
 faultDetail: 
{http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXException: Bad envelope tag:  definitions
at org.apache.axis.message.EnvelopeBuilder.startElement(EnvelopeBuilder.java:71)
at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1048)
at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
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.creaway.blackout.schedule.test.getjkXML(test.java:33)
at com.creaway.blackout.schedule.test.main(test.java:45)

{http://xml.apache.org/axis/}hostname:chuangwe-c432c6

org.xml.sax.SAXException: Bad envelope tag:  definitions
at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:701)
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.creaway.blackout.schedule.test.getjkXML(test.java:33)
at com.creaway.blackout.schedule.test.main(test.java:45)
Caused by: org.xml.sax.SAXException: Bad envelope tag:  definitions