Hey kids,
I am trying to write a web service client in java to consume an SM 7.11 web service. I can't for the life of me figure out where the heck to put the username and password. The example code found in "<SM HOME>\webservices\sample\sm7webservices\Axis2Sampl e" uses method found in ServiceUtility.java:
Doing some searching of the other files, this method is called as so:Code:public static void initServiceAuthentication(Stub servicePort, Map arguments) { String username = (String) arguments.get(ARGUMENT_USERNAME); String password = (String) arguments.get(ARGUMENT_PASSWORD); HttpTransportProperties.Authenticator authenticator = new Authenticator(); List<String> auth = new ArrayList<String>(); auth.add(Authenticator.BASIC); authenticator.setAuthSchemes(auth); authenticator.setUsername(username); authenticator.setPassword(password); authenticator.setPreemptiveAuthentication(true); servicePort._getServiceClient().getOptions().setProperty( HTTPConstants.AUTHENTICATE, authenticator); }
Ok, sweet. But wtf is an IncidentManagementStub? Obviously that is not a native object and I can only find imports and references of this object.Code:IncidentManagementStub stub = new IncidentManagementStub(address); // set connection: close Header hdr = new Header(HTTPConstants.HEADER_CONNECTION, HTTPConstants.HEADER_CONNECTION_CLOSE); ArrayList<Header> headers = new ArrayList<Header>(); headers.add(hdr); stub._getServiceClient().getOptions().setProperty(HTTPConstants.HTTP_HEADERS, headers); stub._getServiceClient().getOptions().setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE); ServiceUtility.initServiceAuthentication(stub, arguments);
Any ideas on where this is coming from?
Has anyone else found a different way of doing authentication with java and SM 7.11?
I know with SOAPUI in SM 7.11 you have to set the basic authentication in the header. But I don't see any available objects that have anything to do with authentication.
Ideas?![]()


Reply With Quote

Bookmarks