Skip to main content

help for query sharepoint web service listitems rs:data

3 replies [Last post]
big_lupus
Offline
Joined: 2007-05-28

Hi all,

I use AXIS2 to retrieve sharepoint wss web services and I test it using "getListItems" and get the response, but I do not know how to retrieve the value(ex: ows_LinkTitle) from the response shown below.

Thanks a looot for any help!!

The response as follows:

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
lbouchard
Offline
Joined: 2007-07-12

I am currently playing around with this as well. I am using Axiom OM service client. I can communicate with methods that don't have parameters but can't seem to get the payload straight for passing parameters. If anyone has any pointers, I would love to get them. The error I get is:
org.apache.axis2.AxisFault: Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.
at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:434)

This is not very revealing...Any ideas?

lbouchard
Offline
Joined: 2007-07-12

Well, I finally got the syntax right. For those of you wanting to use Axis2 Axiom Client to hit a Sharepoint Webservice here is the main code needed for the client class:

private static EndpointReference targetEPR = new EndpointReference(
"https://www.yourhost.com/_vti_bin/SiteData.asmx");

//client main method:
Authenticator auth = new HttpTransportProperties.Authenticator();
auth.setDomain("yourdomain");
auth.setUsername("youruser");
auth.setPassword("yourpwd");
auth.setHost("www.yourhost.com");
Options options = new Options();
options.setTo(targetEPR);
options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
options.setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE, auth);
options.setAction("http://schemas.microsoft.com/sharepoint/soap/GetList");
ServiceClient serviceClient = new ServiceClient();
serviceClient.setOptions(options);
//This is the GUID for the Events List
OMElement listPayload = getListPayload("{D1705A93-D796-472C-A5BB-02B5861B67F7}");
OMElement result = serviceClient.sendReceive(listPayload);

//getListPayLoad method:
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNs1 = fac.createOMNamespace(
"http://schemas.microsoft.com/sharepoint/soap/", "");
OMElement method = fac.createOMElement("GetList", omNs1);
OMElement listId = fac.createOMElement("strListName",omNs1);
listId.setText(listName);
method.addChild(listId);
return method;

duncant
Offline
Joined: 2007-04-06

I realize it's been a while since you posted this, but in case you still are working on this...

Hint 1 - process the returned value from the Sharepoint web services using Java XML Domain Object Model (DOM). In short - cast the returned value as an Element or Node using the org.w3c.dom api.

Hint 2 - capture the returned XML (you've done that) and view it in some handy dandy XML viewer to get an idea how to parse through it, using the DOM operations on the XML node - you can get attributes, node value, child nodes, etc.

I can show you some code, but it won't be directly applicable, because I'm using JAX-WS and netbeans, not Axis.

If you're willing to share your code, I'd like to see how you built the arguments for GetListItems - I can't seem to get it right.

Please e-mail me directly: duncant at mitre.org

Thanks,

Duncan