0
我使用Axis2 RPCServiceClient來調用Web服務。所有對該服務的調用都必須包含3個參數:UserName,Password和reqID。 reqID是由我生成的GUID參數。如何將參數添加到標題中,我通過axis2調用webservice
reqID需要放入標題。
當我使用soapUI測試服務時,通過Http分析器,我可以發現reqID包含在帶有SOAPAction,Content-type,User-Agent和Authorization的請求標頭中。
如何將reqID添加到標頭中?
`RPCServiceClient client = new RPCServiceClient();
Options option = client.getOptions();
option.setAction("http://localhost:8080/api/Getbooks");
EndpointReference erf = new EndpointReference(serviceAddress);
option.setTo(erf);
HttpTransportProperties.Authenticator auth = new HttpTransportProperties.Authenticator();
auth.setUsername("test");
auth.setPassword("test");
auth.setPreemptiveAuthentication(true);
option.setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE, auth);'
[![this is request headers][1]][1]