With a single generated SOAP class I am getting a NonRepeatableRequestException and have no idea how to solve it.
I have one single class generated by wsdl2java
.\axis2-1.8.2\bin\wsdl2java.bat --output output.axis --test-case --package com.mycompany.axis --sync -uri zws_monthly_invoice.wsdl
I consume the service like this to authenticate the user (otherwise I receive 401 Error: Unauthorized)
ZWS_MONTHLY_INVOICEStub stub = new ZWS_MONTHLY_INVOICEStub();
Options options = stub._getServiceClient().getOptions();
HttpTransportPropertiesImpl.Authenticator auth = new HttpTransportPropertiesImpl.Authenticator();
auth.setPreemptiveAuthentication(true);
auth.setPassword("myPassword");
auth.setUsername("myUser");
options.setProperty(HTTPConstants.AUTHENTICATE,auth);
ZWS_MONTHLY_INVOICEStub.Z_OMA_FAKT_AUFTRAG_CREATE payload = new ZWS_MONTHLY_INVOICEStub.Z_OMA_FAKT_AUFTRAG_CREATE();
ZWS_MONTHLY_INVOICEStub.ZAUF_FAKT_POS_IF_OMEGA_T items = new ZWS_MONTHLY_INVOICEStub.ZAUF_FAKT_POS_IF_OMEGA_T();
payload.setIT_INVOICE_ITEMS(items);
ZWS_MONTHLY_INVOICEStub.Z_OMA_FAKT_AUFTRAG_CREATEResponse x = stub.z_OMA_FAKT_AUFTRAG_CREATE(payload);
System.out.println("Z_OMA_FAKT_AUFTRAG_CREATEResponse=" + x.toString());
when I run it, I get following exceptions:
[main] INFO org.apache.axis2.transport.http.HTTPSender -- Unable to send to url[http://mycompany.com:8050/sap/..../500/.../zws_monthly_invoice]
org.apache.http.client.ClientProtocolException: null
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:187)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56)
at org.apache.axis2.transport.http.impl.httpclient4.RequestImpl.execute(RequestImpl.java:210)
at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:194)
at org.apache.axis2.transport.http.AbstractHTTPTransportSender.writeMessageWithCommons(AbstractHTTPTransportSender.java:386)
at org.apache.axis2.transport.http.AbstractHTTPTransportSender.invoke(AbstractHTTPTransportSender.java:214)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:431)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:399)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:225)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:150)
at com.mycompany.axis.ZWS_MONTHLY_INVOICEStub.z_OMA_FAKT_AUFTRAG_CREATE(ZWS_MONTHLY_INVOICEStub.java:181)
at com.mycompany.axis.SoapAxisStaticMainTest.testz_OMA_FAKT_AUFTRAG_CREATE(SoapAxisStaticMainTest.java:82)
at com.mycompany.axis.SoapAxisStaticMainTest.main(SoapAxisStaticMainTest.java:38)
Caused by: org.apache.http.client.NonRepeatableRequestException: Cannot retry request with a non-repeatable request entity.
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:225)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
... 13 common frames omitted
Exception in thread "main" org.apache.axis2.AxisFault
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:431)
at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:266)
at org.apache.axis2.transport.http.AbstractHTTPTransportSender.writeMessageWithCommons(AbstractHTTPTransportSender.java:386)
at org.apache.axis2.transport.http.AbstractHTTPTransportSender.invoke(AbstractHTTPTransportSender.java:214)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:431)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:399)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:225)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:150)
at com.mycompany.axis.ZWS_MONTHLY_INVOICEStub.z_OMA_FAKT_AUFTRAG_CREATE(ZWS_MONTHLY_INVOICEStub.java:181)
at com.mycompany.axis.SoapAxisStaticMainTest.testz_OMA_FAKT_AUFTRAG_CREATE(SoapAxisStaticMainTest.java:82)
at com.mycompany.axis.SoapAxisStaticMainTest.main(SoapAxisStaticMainTest.java:38)
Caused by: org.apache.http.client.ClientProtocolException
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:187)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56)
at org.apache.axis2.transport.http.impl.httpclient4.RequestImpl.execute(RequestImpl.java:210)
at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:194)
... 9 more
Caused by: org.apache.http.client.NonRepeatableRequestException: Cannot retry request with a non-repeatable request entity.
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:225)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
... 13 more
Some write it is the broken authentication, but I thing problem ist somewhat different.
Guys in NonRepeatableRequestException after adding Basic Auth write, with one liner, but where do I put that line?
post.setEntity(new BufferedHttpEntity(new InputStreamEntity(input)));
Thanx for your help
I could solve my problem by replacing the Authentication with Authorisation with the following code: