Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2008

Tip: Looking for answers? Try searching our database.

basic authentication in axis wsdl2java generated client code

Thread view: 
bill turner - 06 Mar 2008 16:53 GMT
I am writing my first webservice client. I ran wsdl2java to generate
the client code and have been following the documentation provided at
the axis website. However, my service requires that I do basic
authentication. This seems like it should be simple enough, but I
cannot seem to figure it out. The Service class doesn't seem to
provide what I need, at least that I can see. Nor do there seem to be
obvious methods on the port object returned from the service object.
Reading through the API docs hasn't helped and my google searches
haven't really provided any clues (the results of the searches seem to
return irrelevant results). Any help would be appreciated! My code is
below.

public class Tester {

    public static void main(String[] args) {
       // Make a service
        Z_YXG_SIMPLE_INPUT_TEST_WSServiceLocator service = new
Z_YXG_SIMPLE_INPUT_TEST_WSServiceLocator();
        System.out.println("service.getServiceName()=" +
service.getServiceName().toString());

       try {
           // Now use the service to get a stub which implements the SDI
(Service Definition Interface).
            Z_YXG_SIMPLE_INPUT_TEST_WS port =
service.getZ_YXG_SIMPLE_INPUT_TEST_WSSoapBinding();

            TABLE_OF_BAPIRET2Holder bapiRet2TableHolder = new
TABLE_OF_BAPIRET2Holder();
           Integer IN_NO_ROW = new Integer(4);
           String IN_TEXT = "my test";

           // Make the actual call
            port.z_YXG_SIMPLE_INPUT_TEST(bapiRet2TableHolder, IN_NO_ROW,
IN_TEXT);

            // Do some actual work here...
        } catch (RemoteException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (ServiceException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }
}

What obvious thing am I missing?

Thanks!

bill
bill turner - 06 Mar 2008 17:14 GMT
> I am writing my first webservice client. I ran wsdl2java to generate
> the client code and have been following the documentation provided at
[quoted text clipped - 50 lines]
>
> bill

Never mind. I figured it out. After getting the handle to my port, I
needed to cast my port object to Stub and then call the appropriate
methods, as below.

            ((Stub) port).setUsername("myUserId");
            ((Stub) port).setPassword("myPassword");

Thanks to anyone who looked at this!

bill


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.