Any other ideas?
David Robison
Bill Keicher wrote:
Hey David,
I don't know if this will work for you, but it has worked for me... Instead of: ABCWSSoap mbsSoap = mbsSoapService.getABCWSSoap(serviceURL); ((ABCWSSoapStub)mbsSoap).setUsername("orci"); ((ABCWSSoapStub)abcSoap).setPassword("orci");
Try something like: ABCWSSoap mbsSoap = mbsSoapService.getABCWSSoap(serviceURL); ((Stub)mbsSoap)._setProperty(Stub.USERNAME_PROPERTY, "orci"); ((Stub)mbsSoap)._setProperty(Stub.PASSWORD_PROPERTY, "orci");
Another thing you can do is try to access the service from a web browser and see if you can connect that way through your user name and pw...to make sure that is working correctly.
-bill
-----Original Message----- From: David Robison [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 21, 2004 1:01 PM To: [EMAIL PROTECTED] Subject: Problem getting HTTP Basic Authentication working
I'm having trouble getting HTTP basic authentication working. I've used the wsdl2java compiler to compile a 3rd party wsdl. Here is my client code:
try {
ABCWS mbsSoapService = new ABCWSLocator();
URL serviceURL = new URL("http://abc.com/ABCinterface/mbs.asmx");
ABCWSSoap mbsSoap = mbsSoapService.getABCWSSoap(serviceURL);
((ABCWSSoapStub)mbsSoap).setUsername("orci");
((ABCWSSoapStub)abcSoap).setPassword("orci");
SerialResponse rsp = abcSoap.startSerialStream(encoderId, "127.0.0.1", myGUID.toString(), portCode);
macAddress = rsp.getMacAddress();
LOG.info("startSerialStream result = " + rsp.getCode());
if (rsp.getCode() != 0) throw new IOException("startSerialStream error: " + rsp.getCode());
} catch (MalformedURLException e) {
LOG.error("Error connecting to SOAP service: " + e);
} catch (ServiceException e) {
LOG.error("Error connecting to SOAP service: " + e);
} catch (Exception e) {
LOG.error("Error connecting to SOAP service: " + e);
}
When the call is made, the following is some of the debug:
DEBUG org.apache.axis.transport.http.HTTPSender - POST /MBSinterface HTTP/1.0
Content-Type: text/xml; charset=utf-8
Accept: application/soap+xml, application/dime, multipart/related, text/*
User-Agent: Axis/1.2beta3
Host: mbs03.trafficland.com
Cache-Control: no-cache
Pragma: no-cache
SOAPAction: "schemas.rccny.com/MBS/StopSerialStream"
Content-Length: 375
however, the server responds with
AxisFault faultCode: {http://xml.apache.org/axis/}HTTP faultSubcode: faultString: (401)Access Denied faultActor: faultNode: faultDetail: {}:return code: 401
Any ideas? Thanks in advanced, David Robison
--
David R Robison Open Roads Consulting, Inc. 708 S. Battlefield Blvd., Chesapeake, VA 23322 phone: (757) 546-3401 e-mail: [EMAIL PROTECTED] web: http://openroadsconsulting.com