Error while using travelport API

274 Views Asked by At

I am trying to use the api of Travel port Universal to get Flight Details.On Searching in Google they Say to follow mentioned link for implementing this web service .[http://travelport.github.io/travelport-uapi-tutorial/lesson_1-1.html]I have done everything as it says.But Still it is Showing errors.

During execution of my program i am getting following errors

Exception in thread "main" javax.xml.ws.WebServiceException: Could not send Message.
    at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:150)
    at com.sun.proxy.$Proxy46.service(Unknown Source)
    at com.travelport.uapi.unit1.Lesson1.main(Lesson1.java:26)
Caused by: org.apache.cxf.transport.http.HTTPException: HTTP response '401: Unauthorized' when communicating with https://apac.universal-api.pp.travelport.com/B2BGateway/connect/uAPI/SystemService
    at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.doProcessResponseCode(HTTPConduit.java:1600)
    at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1607)
    at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1551)
    at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1348)
    at org.apache.cxf.io.CacheAndWriteOutputStream.postClose(CacheAndWriteOutputStream.java:56)
    at org.apache.cxf.io.CachedOutputStream.close(CachedOutputStream.java:216)
    at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
    at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:651)
    at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
    at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:514)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:423)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:324)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:277)
    at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
    at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:139)
    ... 2 more

I am Using the following Program.

  public class Lesson1 {

        public static void main(String[] argv) {        
            //
            // PING REQUEST
            //
            String payload= "this my payload; there are many like it but this one is mine";
            String someTraceId = "doesntmatter-8176";

            //set up the request parameters into a PingReq object
            PingReq req = new PingReq();
            req.setPayload(payload);
            req.setTraceId(someTraceId);

            try {
                //run the ping request
                WSDLService.sysPing.showXML(true);

                PingRsp rsp = WSDLService.sysPing.get().service(req);
                //print results.. payload and trace ID are echoed back in response
                System.out.println(rsp.getPayload());
                System.out.println(rsp.getTraceId());
                System.out.println(rsp.getTransactionId());
            } catch (SystemFaultMessage e) {
                //usually only the error message is useful, not the full stack
                //trace, since the stack trace in is your address space...
                System.err.println("Error making ping request: "+e.getMessage());
            }
        }
}

Can anyone help me to correct this problem.If i am doing anything wrong can anyone suggest me the correct procedure for using Travel Port API.

0

There are 0 best solutions below