我正在 STS 中开发一个 Web 应用程序。在其中将调用一个 Web 服务并显示结果。我使用 STS 本身从 wsdl 生成了 Web 服务客户端。我创建了一个示例 java 文件,该文件向该 Web 服务发送请求并返回结果。以下是代码:
public final class Client {
static Answer answerObj;
private Client() {
}
public static Answer webCall() throws Exception {
// START SNIPPET: client
Question questionObj = new Question();
questionObj.setName("t");
questionObj.setNameStartsWith(true);
questionObj.setDistrict("kob");
questionObj.setHouseNo("0");
questionObj.setPhone("0");
questionObj.setStreet("hai");
questionObj.setStreetStartsWith(false);
//questionObj.setAccountantName("")
questionObj.setCvrNo(1);
//questionObj.setDistrict("Soendergade 2C ");
//Like this set all the values here .
/*System.getProperties().put("proxySet", "true");
System.getProperties().put("https.proxyHost", "");
System.getProperties().put("https.proxyPort",80 );*/
answerObj =nne_PortTypeProxyObj.search(questionObj, 10, 10, 0, "");
System.out.println(answerObj.getCompanyBasic().length);
return answerObj;
// END SNIPPET: client
}
}
现在我的问题是,当我在 Web 服务中调用方法搜索时,会发生以下异常:
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Client
faultSubcode:
faultString: caught exception while handling request: deserialization error: java.lang.NumberFormatException: For input string: ""
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:caught exception while handling request: deserialization error: java.lang.NumberFormatException: For input string: ""
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(AbstractSAXParser.java:601)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1774)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2930)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
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.transport.http.HTTPSender.readFromSocket(HTTPSender.java:796)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:144)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
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 net.stibo.com.nne._3_1.PortTypeBindingStub.search(PortTypeBindingStub.java:1446)
at net.stibo.com.nne._3_1PortTypeProxy.search(PortTypeProxy.java:188)
at com.sapienter.jbilling.server.util.Client.webCall(Client.java:51)
at com.sapienter.jbilling.server.util.Client$webCall.call(Unknown Source)
我在stackoverflow中搜索了相同的内容,发现: multiRef in generated xml sent by WS
我认为这是问题所在,因为我使用搜索方法尝试了各种参数。但是没有找到好的解决方案。任何人都可以帮助我吗?PLZZZ 帮助....