users@jaxb.java.net

Re: How to consume CAML Formatted Response with JAXB?

From: lsacco <occasl_at_gmail.com>
Date: Tue, 8 Sep 2009 22:57:37 -0700 (PDT)

Agreed, but I'm beholden to what has been provided by Microsoft which is the
<s:any/>. The question is how to unmarshall that for Java to use.

After digging into the response object, there is way to do this but it isn't
pretty. Basically, all you have is a DOM Element that you can parse with
XPath to pull the results you want. It looks like this is what I'll have to
do in this case since I can't really define the XMLSchema with something
more descriptive.

Lou


Wolfgang Laun-2 wrote:
>
> Beg your pardon, but no, it does not. <s:any/> is just saying, "anything
> goes, but I'm not telling what".
> -W
>
>
> On Tue, Sep 8, 2009 at 9:39 PM, lsacco <occasl_at_gmail.com> wrote:
>
>>
>> No, it does. Here's a sampling:
>>
>> <wsdl:types>
>> <s:schema elementFormDefault="qualified"
>> targetNamespace="http://schemas.microsoft.com/sharepoint/soap/">
>> <s:import namespace="http://www.w3.org/2001/XMLSchema" />
>> <s:import namespace="http://microsoft.com/wsdl/types/" />
>> <s:element name="GetList">
>> <s:complexType>
>> <s:sequence>
>> <s:element minOccurs="0" maxOccurs="1" name="listName"
>> type="s:string" />
>> </s:sequence>
>> </s:complexType>
>> </s:element>
>> <s:element name="GetListResponse">
>> <s:complexType>
>> <s:sequence>
>> <s:element minOccurs="0" maxOccurs="1" name="GetListResult">
>> <s:complexType mixed="true">
>> <s:sequence>
>> <s:any />
>> </s:sequence>
>> </s:complexType>
>> </s:element>
>> </s:sequence>
>> </s:complexType>
>> </s:element>
>>
>>
>>
>> Wolfgang Laun-2 wrote:
>> >
>> > It seems to me that the wsdl XML which should contain an XML schema
>> > precisely describing the contents of <List> fails to do just that.
>> > -W
>> >
>> > On Wed, Sep 2, 2009 at 9:20 PM, lsacco <occasl_at_gmail.com> wrote:
>> >
>> >>
>> >> We would like to connect a Java Web services CXF client to the
>> SharePoint
>> >> List service. After overcoming the NTLM issue, we see that the
>> response
>> >> is
>> >> not being properly unmarshalled by the client (it returns null). We
>> used
>> >> the Maven cxf-codegen-plugin wsdl2java to create the client stub
>> classes
>> >> that would represent the results but we get back NULL every time.
>> >>
>> >> Here's the code to make the call and return the result (this all works
>> >> except for the return value is an empty list):
>> >>
>> >> public static GetListCollectionResult
>> >> getListCollection(NTLMAuthenticator
>> >> auth, String endPoint) {
>> >> Lists lists = new Lists();
>> >> ListsSoap stub = lists.getListsSoap();
>> >>
>> >> BindingProvider bindProvider = (BindingProvider) stub;
>> >> bindProvider.getRequestContext().put(
>> >>
>> BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
>> >> endPoint);
>> >> Authenticator.setDefault(auth);
>> >> setConduit(stub);
>> >> return stub.getListCollection();
>> >> }
>> >>
>> >> Here is the sample output that repeats the List element that we can
>> >> retrieve
>> >> using C#:
>> >>
>> >> <Lists xmlns="http://schemas.microsoft.com/sharepoint/soap/">
>> >> <List DocTemplateUrl="" DefaultViewUrl="/Lists/Audited Root
>> Task
>> >> List/AllItems.aspx"
>> >> MobileDefaultViewUrl=""
>> >> ID="{AAAABEE6-CSDD-4C70-8AD0-567372066760}"
>> >> Title="Audited Root Task List" Description=""
>> >> ImageUrl="/_layouts/images/ittask.gif"
>> >> Name="{AAAABEE6-CSDD-4C70-8AD0-567372066760}"
>> >> BaseType="0"
>> >> FeatureId="00bfea71-a83e-497e-9ba0-7a5c597d0107"
>> >> ServerTemplate="107" Created="20090805 06:31:27"
>> >> Modified="20090818
>> >> 06:09:13"
>> >> LastDeleted="20090805 07:23:22" Version="35"
>> >> Direction="none"
>> >> ThumbnailSize="" WebImageWidth="" WebImageHeight=""
>> >> Flags="549457920"
>> >> ItemCount="5" AnonymousPermMask="0" RootFolder=""
>> >> ReadSecurity="1"
>> >> WriteSecurity="1" Author="55" EventSinkAssembly=""
>> >> EventSinkClass=""
>> >> EventSinkData="" EmailInsertsFolder="" EmailAlias=""
>> >> WebFullUrl="/"
>> >> WebId="2bdcc5a2-563f-477c-b6d9-cf26c0067b36"
>> >> SendToLocation=""
>> >> ScopeId="ca78103c-95d7-4ffd-8cf1-77eb3b9a37ae"
>> >> MajorVersionLimit="0"
>> >> MajorWithMinorVersionsLimit="0" WorkFlowId=""
>> >> HasUniqueScopes="False"
>> >> AllowDeletion="True" AllowMultiResponses="False"
>> >> EnableAttachments="True"
>> >> EnableModeration="False" EnableVersioning="False"
>> >> Hidden="False"
>> >> MultipleDataList="False" Ordered="False"
>> ShowUser="True"
>> >> EnableMinorVersion="False" RequireCheckout="False" />
>> >> ...
>> >>
>> >> Here is the generated wsdl2java class for JAXB binding of the
>> response:
>> >>
>> >> @XmlAccessorType(XmlAccessType.FIELD)
>> >> @XmlType(name = "", propOrder = {
>> >> "getListCollectionResult"
>> >> })
>> >> @XmlRootElement(name = "GetListCollectionResponse")
>> >> public class GetListCollectionResponse {
>> >>
>> >> @XmlElement(name = "GetListCollectionResult")
>> >> protected GetListCollectionResponse.GetListCollectionResult
>> >> getListCollectionResult;
>> >>
>> >> public GetListCollectionResponse.GetListCollectionResult
>> >> getGetListCollectionResult() {
>> >> return getListCollectionResult;
>> >> }
>> >>
>> >> public void
>> >>
>> >>
>> setGetListCollectionResult(GetListCollectionResponse.GetListCollectionResult
>> >> value) {
>> >> this.getListCollectionResult = value;
>> >> }
>> >>
>> >> @XmlAccessorType(XmlAccessType.FIELD)
>> >> @XmlType(name = "", propOrder = {
>> >> "content"
>> >> })
>> >> public static class GetListCollectionResult {
>> >>
>> >> @XmlMixed
>> >> @XmlAnyElement(lax = true)
>> >> protected List content;
>> >>
>> >> public List getContent() {
>> >> if (content == null) {
>> >> content = new ArrayList();
>> >> }
>> >> return this.content;
>> >> }
>> >> }
>> >> }
>> >>
>> >> Any ideas on how to bind the CAML formatted output from the SP Web
>> >> service
>> >> so the response can be unmarshalled properly by JAXB?
>> >>
>> >> TIA!
>> >> Lou
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/How-to-consume-CAML-Formatted-Response-with-JAXB--tp25264026p25264026.html
>> >> Sent from the java.net - jaxb users mailing list archive at
>> Nabble.com.
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
>> >> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/How-to-consume-CAML-Formatted-Response-with-JAXB--tp25264026p25352704.html
>> Sent from the java.net - jaxb users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
>> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>>
>>
>
>

-- 
View this message in context: http://www.nabble.com/How-to-consume-CAML-Formatted-Response-with-JAXB--tp25264026p25359022.html
Sent from the java.net - jaxb users mailing list archive at Nabble.com.