问题描述
publicstaticvoidmain(String[]args){Stringid="123";Stringpassword="123";StringserviceEpr="http://192.168.0.8:8081/Seed/services/Sperson?wsdl";Stringrest=callWebServiceByAixs(id,password,serviceEpr);System.out.println(rest);}publicstaticStringcallWebServiceByAixs(StringpersonNo,Stringpassword,StringUrl){try{Serviceservice=newService();Callcall=(Call)service.createCall();call.setTargetEndpointAddress(newjava.net.URL(Url));//服务名call.setOperationName(newQName(Url,"login"));//定义入口参数和参数类型call.addParameter(newQName(Url,"personNo"),XMLType.XSD_STRING,ParameterMode.IN);call.addParameter(newQName(Url,"password"),XMLType.XSD_STRING,ParameterMode.IN);call.setUseSOAPAction(true);//Action地址call.setSOAPActionURI(Url);//定义返回值类型call.setReturnType(XMLType.XSD_INT);//调用服务获取返回值Stringresult=String.valueOf(call.invoke(newObject[]{personNo,password}));System.out.println("返回值:"+result);returnresult;}catch(ServiceExceptione){e.printStackTrace();}catch(RemoteExceptione){e.printStackTrace();}catch(MalformedURLExceptione){e.printStackTrace();}returnnull;}报错信息AxisFaultfaultCode:{http://schemas.xmlsoap.org/soap/envelope/}ClientfaultSubcode:faultString:Unexpectedwrapperelement{http://192.168.0.8:8081/Seed/services/Sperson?wsdl}loginfound.Expected{http://webservice.seed.com/}login.faultActor:faultNode:faultDetail:{http://xml.apache.org/axis/}stackTrace:Unexpectedwrapperelement{http://192.168.0.8:8081/Seed/services/Sperson?wsdl}loginfound.Expected{http://webservice.seed.com/}login.atorg.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)atorg.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)atorg.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)atcom.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(UnknownSource)atcom.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(UnknownSource)atcom.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(UnknownSource)atcom.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(UnknownSource)atcom.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(UnknownSource)atcom.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(UnknownSource)atcom.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(UnknownSource)atcom.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(UnknownSource)atcom.sun.org.apache.xerces.internal.parsers.XMLParser.parse(UnknownSource)atcom.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(UnknownSource)atcom.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(UnknownSource)atcom.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(UnknownSource)atorg.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)atorg.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)atorg.apache.axis.Message.getSOAPEnvelope(Message.java:435)atorg.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:796)atorg.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:144)atorg.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)atorg.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)atorg.apache.axis.SimpleChain.invoke(SimpleChain.java:83)atorg.apache.axis.client.AxisClient.invoke(AxisClient.java:165)atorg.apache.axis.client.Call.invokeEngine(Call.java:2784)atorg.apache.axis.client.Call.invoke(Call.java:2767)atorg.apache.axis.client.Call.invoke(Call.java:2443)atorg.apache.axis.client.Call.invoke(Call.java:2366)atorg.apache.axis.client.Call.invoke(Call.java:1812)atcom.laie.comment.caClient.callWebServiceByAixs(caClient.java:45)atcom.laie.comment.caClient.main(caClient.java:26){http://xml.apache.org/axis/}hostname:USER-20140706LEUnexpectedwrapperelement{http://192.168.0.8:8081/Seed/services/Sperson?wsdl}loginfound.Expected{http://webservice.seed.com/}login.atorg.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)atorg.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)atorg.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)atcom.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(UnknownSource)atcom.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(UnknownSource)atcom.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(UnknownSource)atcom.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(UnknownSource)atcom.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(UnknownSource)atcom.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(UnknownSource)atcom.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(UnknownSource)atcom.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(UnknownSource)atcom.sun.org.apache.xerces.internal.parsers.XMLParser.parse(UnknownSource)atcom.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(UnknownSource)atcom.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(UnknownSource)atcom.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(UnknownSource)atorg.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)atorg.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)atorg.apache.axis.Message.getSOAPEnvelope(Message.java:435)atorg.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:796)atorg.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:144)atorg.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)atorg.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)atorg.apache.axis.SimpleChain.invoke(SimpleChain.java:83)atorg.apache.axis.client.AxisClient.invoke(AxisClient.java:165)atorg.apache.axis.client.Call.invokeEngine(Call.java:2784)atorg.apache.axis.client.Call.invoke(Call.java:2767)atorg.apache.axis.client.Call.invoke(Call.java:2443)atorg.apache.axis.client.Call.invoke(Call.java:2366)atorg.apache.axis.client.Call.invoke(Call.java:1812)atcom.laie.comment.caClient.callWebServiceByAixs(caClient.java:45)atcom.laie.comment.caClient.main(caClient.java:26)null
解决方案
解决方案二:
有大神帮忙吗急急急!