Skip to main content

Accessing Sharepoint webservices from java client

2 replies [Last post]
harish_kanuri
Offline
Joined: 2009-07-10
Points: 0

Hi,

I am new to WebServices and currently working on JAX WS 2.1 to access Sharepoint webservices. I need to access the data in the Lists of sharepoint site, so I used /_vti_bin/lists.asmx. I am using NetBeans 6.5 to generate the WebService References and could access Sharepoint (without any authentication issues). I found that I am getting a response object, however I am unable to extract the data from the response object. I found that the result (response object) consists of a list of objects of type ElementNSImpl and again each of them consisted of list of ElementNSImpl objects. Found that some contained text objects which contained some weird values, numbers. I could know exactly how to extract the data from the result. I really appreciate your help and please throw some light on how to retrieve data from result object. Also let me know if you need more details

Below is the generated code from NetBeans for the WebService Refernce(Made changes to access sharepoint, didnt have to add any code for authentication):

URL baseUrl = com.microsoft.schemas.sharepoint.soap.Lists.class.getResource(".");
try { // Call Web Service Operation
com.microsoft.schemas.sharepoint.soap.Lists service = new com.microsoft.schemas.sharepoint.soap.Lists(new URL(baseUrl, "http://website/sites/itarchitecture/ssr/webservicetest/_vti_bin/lists.asmx?wsdl"), new QName("http://schemas.microsoft.com/sharepoint/soap/", "Lists"));
com.microsoft.schemas.sharepoint.soap.ListsSoap port = service.getListsSoap12();
// TODO initialize WS operation arguments here
java.lang.String listName = "testList";
// TODO process result here
com.microsoft.schemas.sharepoint.soap.GetListResponse.GetListResult result = port.getList(listName);
System.out.println("Result = "+result);
} catch (Exception ex) {
// TODO handle custom exceptions here
}

Thanks in advance!

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
vinodsingh
Offline
Joined: 2004-04-16
Points: 0

Client side stubs must have all necessary POJOs to extract the info from web service.

harish_kanuri
Offline
Joined: 2009-07-10
Points: 0

Thanks so much for the response!

I believe that all the POJOs (referred in your response) would be created while building the client side artifacts (using wsimport- based on the provided wsdl link) in NetBeans. Do we have to create any more POJOs for extracting the data from the result/response of the service?

Can you provide me any example client obtaining data of complex type from a web service?

Thanks and greatly appreciate your time :)