When I am trying to consume a web service by sending a SOAP message as input using Apache Axis I am getting the following error.
当我尝试通过使用Apache Axis发送SOAP消息作为输入来使用Web服务时,我收到以下错误。
Code Snippet :
代码片段:
Calendar calendar = Calendar.getInstance();
SimpleDateFormat simpledateformat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
byte[] fileBytes = null;
fileBytes=getZipBytes(s); //get the zipped bytes
SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
Date d=formatter.parse(formatter.format(calendar.getTime()));
UUID uuid = UUID.randomUUID();
String uid=trimUUID(uuid.toString());
String ETIN="11111";
String EFIN="111111";
String msgID= ETIN+getJulian7FromDate(d)+uid;
String timeStamp=simpledateformat.format(calendar.getTime());
WebServiceLocator fsetlocator=new WebServiceLocator();
SendSubmissions servicesoap=fsetlocator.getSendSubmissions(s4);
SOAPHeaderElement soapheaderelement_1 = new SOAPHeaderElement("http://xyz.org", "userHeader"); //Sample URL
SOAPElement node1 = soapheaderelement_1.addChildElement("Username");
node1.addTextNode("admin");
SOAPElement node2 = soapheaderelement_1.addChildElement("Password");
node2.addTextNode("pwd");
SOAPHeaderElement soapheaderelement_2 = new SOAPHeaderElement("http://www.abc.com/GatewayService", "msgHeader"); //Sample URL
SOAPElement node3 = soapheaderelement_2.addChildElement("message");
node3.addTextNode(msgID);
SOAPElement node4 = soapheaderelement_2.addChildElement("job");
node4.addTextNode("Submit");
SOAPElement node5 = soapheaderelement_2.addChildElement("Timestamp");
node5.addTextNode(timeStamp);
SOAPElement node8 = soapheaderelement_2.addChildElement("Process");
node8.addTextNode("T");
((Stub) servicesoap).setHeader(soapheaderelement_1);
((Stub) servicesoap).setHeader(soapheaderelement_2);
SubmissionDataListType submissiondatalisttype=new SubmissionDataListType();
String submissionsCount = getCount(s); // returns a count value
System.out.println("Count : "+submissionsCount);
submissiondatalisttype.setCount(new PositiveInteger(submissionsCount));
int cnt=Integer.parseInt(submissionsCount);
SubmissionDataListTypeSubmissionData submissiondata[] = new SubmissionDataListTypeSubmissionData[cnt];
for (int i=0 ; i<cnt ; i++){
submissiondata[i]=new SubmissionDataListTypeSubmissionData();
UUID uuid1 = UUID.randomUUID();
submissiondata[i].setSubmissionId ( EFIN + getJulian7FromDate(d) + trimUUID(uuid1.toString()));
Calendar calendar1 = Calendar.getInstance();
submissiondata[i].setElectronicPostmark(calendar1);
submissiondata[i].setCategory(CategoryType.StateWH);
}
submissiondatalisttype.setSubmissionData(submissiondata);
SubmissionDataListType subdatalist=new SubmissionDataListType(new PositiveInteger(submissionsCount),submissiondata);
SubmissionRecieptListType submissionreceiptlisttype =servicesoap.sendSubmissions(submissiondatalisttype, fileBytes);
SubmissionRecieptListTypeSubmissionReceipt receipt[] = submissionreceiptlisttype.getSubmissionReceipt();
FileOutputStream fileoutputstream = new FileOutputStream("Transmit.txt");
PrintStream printstream = new PrintStream(fileoutputstream);
for(int i=0; i<cnt;i++){
printstream.println(receipt[i].getSubmissionId());
}
printstream.close();
} catch(Exception exception)
{
System.out.println(exception.getMessage());
throw exception;
}
java.lang.NumberFormatException: Invalid positiveInteger: 0 at org.apache.axis.encoding.ser.SimpleDeserializer.onEndElement(SimpleDeserializer.java:176) at org.apache.axis.encoding.DeserializerImpl.endElement(DeserializerImpl.java:502) at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087) at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:171) at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141) at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:236) at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384) at org.apache.axis.client.Call.invoke(Call.java:2467) at org.apache.axis.client.Call.invoke(Call.java:2366) at org.apache.axis.client.Call.invoke(Call.java:1812)
java.lang.NumberFormatException:无效positiveInteger:0在org.apache.axis.encoding.ser.SimpleDeserializer.onEndElement(SimpleDeserializer.java:176)在org.apache.axis.encoding.DeserializerImpl.endElement(DeserializerImpl.java:502)在org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)在org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:171)在org.apache.axis.message.MessageElement.publishToHandler (MessageElement.java:1141)在org.apache.axis.message.RPCElement.deserialize(RPCElement.java:236)在org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)在org.apache。 axis.client.Call.invoke(Call.java:2467)在org.apache.axis.client.Call.invoke(Call.java:2366)在org.apache.axis.client.Call.invoke(Call.java: 1812)
Exception in thread "main" AxisFault faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException faultSubcode: faultString: java.lang.NumberFormatException: Invalid positiveInteger: 0 faultActor: enter code herefaultNode:
faultDetail: {http://xml.apache.org/axis/}stackTrace:java.lang.NumberFormatException: Invalid positiveInteger: 0 at org.apache.axis.encoding.ser.SimpleDeserializer.onEndElement(SimpleDeserializer.java:176) at org.apache.axis.encoding.DeserializerImpl.endElement(DeserializerImpl.java:502) at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087) at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:171) at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141) at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:236) at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384) at org.apache.axis.client.Call.invoke(Call.java:2467) at org.apache.axis.client.Call.invoke(Call.java:2366) at org.apache.axis.client.Call.invoke(Call.java:1812)线程“main”中的异常AxisFault faultCode:{http://schemas.xmlsoap.org/soap/envelope/}Server.userException faultSubcode:faultString:java.lang.NumberFormatException:无效的positiveInteger:0 faultActor:输入代码herefaultNode:faultDetail: {http://xml.apache.org/axis/}stackTrace:java.lang.NumberFormatException:org中的org.apache.axis.encoding.ser.SimpleDeserializer.onEndElement(SimpleDeserializer.java:176)中的positiveInteger:0无效。 org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)中的apache.axis.encoding.DeserializerImpl.endElement(DeserializerImpl.java:502)位于org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder。 java:171)org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141)位于org.apache.axis.message的org.apache.axis.message.RPCElement.deserialize(RPCElement.java:236)位于org.apache.axis的org.apache.axis.client.Call.invoke(Call.java:2467)的.RPCElement.getParams(RPCElement.java:384)。 client.Call.invoke(Call.java:2366)at org.apache.axis.client.Call.invoke(Call.java:1812)
I am creating a a Custom SOAP Header and the SOAP Body contains MTOM attachement (zipped XML content in bytes) and an Id(Positive integer value) . I tried to check whether the Id is positive.
我正在创建一个自定义SOAP标头,SOAP Body包含MTOM附件(以字节为单位的压缩XML内容)和一个Id(正整数值)。我试图检查Id是否为正。
1 个解决方案
#1
0
Zero is not a positive integer, it is unsigned. Positive integers start with one and go up from there.
零不是正整数,它是无符号的。正整数从一开始,然后从那里开始。
#1
0
Zero is not a positive integer, it is unsigned. Positive integers start with one and go up from there.
零不是正整数,它是无符号的。正整数从一开始,然后从那里开始。