初步估计是实例化soapHeader时,命名空间不对。
是否需要根据wsdl生成命名空间?该如何使用wsdl生成soapHeader的命名空间?详细的问题描述如下:小妹在使用在eclipse中使用wsdl实例化客户端后,
需要添加soapHeader验证信息。
接口文档定义的soap header参数如下:
SpId xsd:string
SpPassword xsd:string
TimeStamp xsd:string 小妹在网上查找了好多信息,按各前辈介绍的方法,
在*soapStub.java中找到了createCall()方法,
在return _call()前添加代码如下:
SOAPFactory soapFactory = SOAPFactory.newInstance();
org.apache.axis.message.SOAPHeaderElement soapHeader
= new SOAPHeaderElement(service.getServiceNam());
soapHeader.addAttribute(soapFactory.createName("SpId"), SpID);
soapHeader.addAttribute(soapFactory.createName("SpPassword"), SpPassword);
soapHeader.addAttribute(soapFactory.createName("TimeStamp"), timeStamp);
_call.addHeader(soapHeader); 报错:
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.generalException
faultSubcode:
faultString: System.Web.Services.Protocols.SoapException: ServiceException:请教各位。谢谢!
是否需要根据wsdl生成命名空间?该如何使用wsdl生成soapHeader的命名空间?详细的问题描述如下:小妹在使用在eclipse中使用wsdl实例化客户端后,
需要添加soapHeader验证信息。
接口文档定义的soap header参数如下:
SpId xsd:string
SpPassword xsd:string
TimeStamp xsd:string 小妹在网上查找了好多信息,按各前辈介绍的方法,
在*soapStub.java中找到了createCall()方法,
在return _call()前添加代码如下:
SOAPFactory soapFactory = SOAPFactory.newInstance();
org.apache.axis.message.SOAPHeaderElement soapHeader
= new SOAPHeaderElement(service.getServiceNam());
soapHeader.addAttribute(soapFactory.createName("SpId"), SpID);
soapHeader.addAttribute(soapFactory.createName("SpPassword"), SpPassword);
soapHeader.addAttribute(soapFactory.createName("TimeStamp"), timeStamp);
_call.addHeader(soapHeader); 报错:
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.generalException
faultSubcode:
faultString: System.Web.Services.Protocols.SoapException: ServiceException:请教各位。谢谢!
可以参考下http://www.chinaaspx.com/Comm/Dotnetbbs/Showtopic.aspx?Forum_ID=44&Id=124803
为什么用eclipse就没有生成这段代码?
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server
faultSubcode:
faultString: System.Web.Services.Protocols.SoapException: Server was unable to
process request. ---> System.NullReferenceException: Object reference not set
to an instance of an object.
at HouseImportService.Function.HouseImport.GetSalePropertyHouseVilla(XmlNode
node, CityBase CitySite, MagentConEntity mce, List`1& photoinfolist, Int32&a
mp; totalScore, VillaSaleEntity& house)
at HouseImportService.Function.HouseImport.DealImportHouseVilla(XmlDocument x
mlDoc, String businessType, String& msg, Cache pcache, CityBase CitySite, In
t32 userid)
at HouseImportService.ServiceVilla.Import(String userName, String pwd, String
businessType, String xmlContent)
--- End of inner exception stack trace ---
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:System.Web.Services.Protocols.So
apException: Server was unable to process request. ---> System.NullReferenceE
xception: Object reference not set to an instance of an object.
at HouseImportService.Function.HouseImport.GetSalePropertyHouseVilla(XmlNode
node, CityBase CitySite, MagentConEntity mce, List`1& photoinfolist, Int32&a
mp; totalScore, VillaSaleEntity& house)
at HouseImportService.Function.HouseImport.DealImportHouseVilla(XmlDocument x
mlDoc, String businessType, String& msg, Cache pcache, CityBase CitySite, In
t32 userid)
at HouseImportService.ServiceVilla.Import(String userName, String pwd, String
businessType, String xmlContent)
--- End of inner exception stack trace ---
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(Deserializ
ationContext.java:1087)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endEleme
nt(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImp
l.scanEndElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImp
l$FragmentContentDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(U
nknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next
(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImp
l.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(U
nknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(U
nknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown So
urce)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Un
known Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.p
arse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.apache.axis.encoding.DeserializationContext.parse(Deserialization
Context.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(MustUnders
tandChecker.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 这是我程序里面报的