I think you can supply the authentication username and password like this:
java.net.Authenticator.setDefault(
 new java.net.Authenticator()
 {
  protected java.net.PasswordAuthentication getPasswordAuthentication()
  {
   return new java.net.PasswordAuthentication(
    "username", "password".toCharArray()); // Use your name/password
  }
 }
);

I think that should work regardless of how you invoke the service (Call,
proxy, etc.).

Andrew

Andy Pahne wrote:
> 
> I discovered the Users guide and the code examples. They all use Call.
> But I find that a bit arkward, because then I'd have to deal with XSD
> types, return types and such things.
> 
> If I compare with
>>ClsVacancy result =
>>  service.getVacancy(rentalObjectID, checkIn, checkOut, ENVIRONMENT);
> that seems very complicated.
> 
> In the end, Axis generated all those objects like ClsVacancy for me and
> I hoped not to have to deal with XML/XSD/SOAP details.
> 
> Andy
> 
> 
> 
> 
> 
> 
> 
> Andy Pahne schrieb:
>>
>> Hello,
>>
>> I am currently having my first experiences with web services and axis,
>> so this may be newbie questions.
>>
>> I generated a client from WSDL that consumes one of our partner's web
>> services. (I used EclipseWTP to do so, but that part was easy and
>> succeeded, I think). EclipseWTP currently uses Axis 1, so the exact
>> version is 1.3.0.
>>
>> I was playing around with a unit test:
>>
>>     public void testRawConnection_no_authentication() throws Exception {
>>
>>         // get Service
>>         PartnerWebServiceLocator locator = new
>> PartnerWebServiceLocator();
>>         PartnerWebServiceSoap service =
>> locator.getPartnerWebServiceSoap();
>>
>>
>>         try {
>>
>>             // Aufruf "under test"
>>             @SuppressWarnings("unused")
>>             ClsVacancy result =
>>                 service.getVacancy(rentalObjectID, checkIn, checkOut,
>> ENVIRONMENT);
>>
>>             fail("expected RemoteException was NOT thrown");
>>
>>         } catch (RemoteException expected) {
>>
>>             assertNotNull(expected);
>>             assertTrue(expected.getMessage().contains("Anonymous login
>> not allowed"));
>>
>>         }
>>
>>
>>     }
>>
>>
>>
>>
>>
>> That test suceeds, because the Web Service is protected by basic http
>> authentication. But at least I am confident that I succesfully
>> connected to the service, because the recieved error message comes
>> from the remote system and not from Axis itself.
>>
>>
>> Here are my questions:
>>
>>
>> 1. Is it correct to obtain the service proxy like this:
>>
>>         // get Service
>>         PartnerWebServiceLocator locator = new
>> PartnerWebServiceLocator();
>>         PartnerWebServiceSoap service =
>> locator.getPartnerWebServiceSoap();
>>
>>
>>   I think it is correct, but can you confirm?
>>
>>
>>
>>
>> 2. And how do I use basic http authentication when I have a password
>> and a username?
>>    I googled around and found a code snippet that used the Call class
>> (Interface ?), but I am not sure if that is the correct direction. And
>> the snippet also was not complete. I did not find anything apropriate
>> in  the FAQ.
>>
>>
>> Thanks,
>> Andy Pahne
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

-- 
Andrew Martin
Computer Programmer
Regenstrief Institute, Inc.
410 West 10th Street, Suite 2000
Indianapolis, IN 46202-3012
Phone: (317) 423-5542
Fax: (317) 423-5695
[EMAIL PROTECTED]


Confidentiality Notice: The contents of this message and any files
transmitted with it may contain confidential and/or privileged
information and are intended solely for the use of the named
addressee(s). Additionally, the information contained herein may have
been disclosed to you from medical records with confidentiality
protected by federal and state laws. Federal regulations and State laws
prohibit you from making further disclosure of such information without
the specific written consent of the person to whom the information
pertains or as otherwise permitted by such regulations. A general
authorization for the release of medical or other information is not
sufficient for this purpose.

If you have received this message in error, please notify the sender by
return e-mail and delete the original message. Any retention,
disclosure, copying, distribution or use of this information by anyone
other than the intended recipient is strictly prohibited.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to