我正在尝试使用Travel port Universal的api来获取Flight Details.On在Google中搜索他们说要按照提到的链接来实现这个Web服务。[http://travelport.github.io/travelport-uapi-tutorial/lesson_1-1.html]I已经完成了所有内容。但仍然它显示错误。
在执行我的程序时,我遇到以下错误
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
我正在使用以下程序。
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());
}
}
}
任何人都可以帮我纠正这个问题。如果我做错了什么可以建议我使用Travel Port API的正确程序。