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]