I have a client that was generated by CXF using the local wsdl file. The client connects to OK, and I get the expected 401 error from the web server.
The problem I encountered is not able to properly configure proactive auth in the client.
I tried several things to no avail. Most of the examples on the Internet seem to focus on Spring, but on a simple old Java approach.
I include the bulk of the client. If anyone can give me an example of how this should be configured, I would appreciate it. Notice that I'm not looking for anything out of the ordinary. I just need to be able to authenticate and call services.
public final class ServiceNowSoap_ServiceNowSoap_Client { private static final QName SERVICE_NAME = new QName( "http://www.service-now.com/foo", "ServiceNow_foo"); private ServiceNowSoap_ServiceNowSoap_Client() { } public static void main(String args[]) throws java.lang.Exception { URL wsdlURL = ServiceNowCmdbCiComm.WSDL_LOCATION; if (args.length > 0 && args[0] != null && !"".equals(args[0])) { File wsdlFile = new File(args[0]); try { if (wsdlFile.exists()) { wsdlURL = wsdlFile.toURI().toURL(); } else { wsdlURL = new URL(args[0]); } } catch (MalformedURLException e) { e.printStackTrace(); } } ServiceNowFoo ss = new ServiceNowFoo(wsdlURL, SERVICE_NAME); ServiceNowSoap port = ss.getServiceNowSoap(); { System.out.println("Invoking deleteRecord..."); java.lang.String _deleteRecord_sysId = ""; java.lang.String _deleteRecord__return = port .deleteRecord(_deleteRecord_sysId); System.out.println("deleteRecord.result=" + _deleteRecord__return); } System.exit(0); } }
source share