I am trying to hit your webservice using axis2 from a java application.With that the optinal fields are not working.i.e The optinal fields are made as mandatory in webservices.
I am not able to hit any api with mimimals fields.I have to hit every api api with all the fields as mandatory which is very frustrating for me.Is this the way i have deal with webservices or am i doing anything wrong .I have shared my code.Kindly help me on this ASAP…
But howMany and offset are offsets are working fine.
Code:
FlightXML2Stub stub = null;
try {
HttpTransportProperties.Authenticator auth = new HttpTransportProperties.Authenticator();
auth.setUsername(FlightXmlConstants.USER_NAME);
auth.setPassword(FlightXmlConstants.PASSWORD);
stub = new FlightXML2Stub();
stub._getServiceClient().getOptions().setProperty(HTTPConstants.CHUNKED, false);
stub._getServiceClient().getOptions().setProperty(HTTPConstants.AUTHENTICATE, auth);
} catch (RemoteException x) {
x.printStackTrace();
System.err.println(x);
}
FlightXML2Stub.AirlineFlightSchedulesRequest req3 = new FlightXML2Stub.AirlineFlightSchedulesRequest();
req3.setAirline(“EK”);
req3.setFlightno(“412”);
req3.setStartDate(1441065600);
req3.setEndDate(1441152000);
FlightXML2Stub.AirlineFlightSchedulesRequestE req3e = new FlightXML2Stub.AirlineFlightSchedulesRequestE();
req3e.setAirlineFlightSchedulesRequest(req3);
airlineFlightSchedulesResults = stub.airlineFlightSchedules(req3e).getAirlineFlightSchedulesResults();
Exception:
[http-nio-8080-exec-2] INFO org.apache.axis2.transport.http.HTTPSender - Unable to sendViaPost to url[flightxml.flightaware.com/soap/FlightXML2/op]
org.apache.axis2.AxisFault: origin cannot be null!!
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at org.apache.axis2.transport.http.SOAPMessageFormatter.getBytes(SOAPMessageFormatter.java:108)
at org.apache.axis2.transport.http.AxisRequestEntity.writeRequest(AxisRequestEntity.java:87)
at org.apache.commons.httpclient.methods.EntityEnclosingMethod.writeRequestBody(EntityEnclosingMethod.java:499)
at org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:2114)
at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1096)
at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
at org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:621)
at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:193)
at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:404)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:231)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:443)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:406)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
at org.axis2.FlightXML2Stub.airlineFlightSchedules(FlightXML2Stub.java:5004)