cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeffrey Rodgers <jjrodg...@gmail.com>
Subject Re: CXF w/ .NET Generated Web Service & Complex Datatype
Date Wed, 13 Oct 2010 20:28:03 GMT
I have one @XmlSeeAlso in the SrvSoap SEI, the block as follows:

@WebService(targetNamespace = "http://foo/moo/", name = "SrvSoap")
@XmlSeeAlso({ObjectFactory.class})
public interface SrvSoap {
    @WebResult(name = "GetLatestSubjectsDSResult", targetNamespace = "
http://foo/moo/")
    @RequestWrapper(localName = "GetLatestSubjectsDS", targetNamespace = "
http://foo/moo/", className = "com.srv.GetLatestSubjectsDS")
    @WebMethod(operationName = "GetLatestSubjectsDS", action = "
http://foo/moo/GetLatestSubjectsDS")
    @ResponseWrapper(localName = "GetLatestSubjectsDSResponse",
targetNamespace = "http://foo/moo/", className =
"com.srv.GetLatestSubjectsDSResponse")
    public com.srv.GetLatestSubjectsDSResponse.GetLatestSubjectsDSResult
getLatestSubjectsDS(
        @WebParam(name = "numSubjects", targetNamespace = "http://foo/moo/")
        int numSubjects,
        @WebParam(name = "lastId", targetNamespace = "http://foo/moo/")
        int lastId
    );

The JAXB unmarshaller was the first place I went to earlier, but since _any
is an Object and doesn't want to accept an obvious cast from me, I have not
been able to properly pass it to unmarshall method (maybe I am missing
something very obvious with accessing the innards of that any property).

Thanks,
Jeff

On Wed, Oct 13, 2010 at 4:08 PM, Daniel Kulp <dkulp@apache.org> wrote:

>
> If CXF generated the code for that schema, there should also be an
> @XmlSeeAlso
> annotation on the SEI that points to the OjbectFactory for that schema.
> That SHOULD make it more or less just work.   Can you check to see if the
> XmlSeeAlso is there?
>
> If it IS a DOM, you can always do something along the lines of:
>
>
> JAXBContext.newContext(SubjectsDS.class).createUnmarshaller().unmarshall(dom,
> SubjectsDS.class);
>
>
>
> Dan
>
>
> On Wednesday 13 October 2010 4:02:56 pm Jeffrey Rodgers wrote:
> > Benson,
> >
> > Thanks for the help and back/forth-
> >
> > I'm pretty sure CXF does know the schema though, no?  Part of the WSDL
> has
> > a schema import for that particular s:any namespace in the form of:
> >
> >       <s:import namespace="http://tempuri.org/SubjectsDS.xsd"/>
> >       <s:import schemaLocation="
> > http://localhost:9999/Srv.asmx?schema=SubjectsDS" namespace="
> > http://tempuri.org/SubjectsDS.xsd"/>
> >
> > The schema for that particular object is gigantic, since the owners of
> that
> > web service decided to put everything into a single table back on the DS.
> > It's essentially dozens of ints, strings, a couple timestamps, and some
> > binary data.  CXF's wsdl2java code generation did in fact generate a
> fully
> > featured SubjectsDS to at least contain the schema (equally bloated but
> it
> > is what it is) too.
> >
> > I guess at the most basic level, what's the preferred way to actually
> > access the XML inside that any?  I can likely make the translation and
> > mapping myself, but I can't seem to bust into that abstract object.
> >
> > Jeff
> >
> > On Wed, Oct 13, 2010 at 3:52 PM, Benson Margulies
> <bimargulies@gmail.com>wrote:
> > > The 'any' means that Microsoft knows the structure of this data but
> > > isn't telling us. Since it isn't telling us, we can't do anything
> > > about it. You could ask them what's up with the 'any':-)
> > >
> > > If you could come up with your own XML schema for what shows up in
> > > there, I could offer some suggestions for how to use it.
> > >
> > > On Wed, Oct 13, 2010 at 3:50 PM, Jeffrey Rodgers <jjrodgers@gmail.com>
> > >
> > > wrote:
> > > > Benson,
> > > >
> > > > Yes, that was my suspicion - the xs:any is in fact part of the WSDL.
>  I
> > > > can't seem to crack the nut on how to use that any property or the
> > > > getAny accessor to unmarshall back to the generated java equivalent
> of
> > > > my .NET
> > >
> > > DS
> > >
> > > > (essentially a couple pages of public properties in SubjectsDS.java)
> > > >
> > > > The WSDL for that particular section:
> > > >      <s:element name="GetLatestSubjectsDSResponse">
> > > >
> > > >        <s:complexType>
> > > >
> > > >          <s:sequence>
> > > >
> > > >            <s:element minOccurs="0" maxOccurs="1"
> > > >
> > > > name="GetLatestSubjectsDSResult">
> > > >
> > > >              <s:complexType>
> > > >
> > > >                <s:sequence>
> > > >
> > > >                  <s:any namespace="http://tempuri.org/SubjectsDS.xsd
> "/>
> > > >
> > > >                </s:sequence>
> > > >
> > > >              </s:complexType>
> > > >
> > > >            </s:element>
> > > >
> > > >          </s:sequence>
> > > >
> > > >        </s:complexType>
> > > >
> > > >      </s:element>
> > > >
> > > > Thanks,
> > > > Jeffrey
> > > >
> > > > On Wed, Oct 13, 2010 at 3:41 PM, Benson Margulies
> > > > <bimargulies@gmail.com
> > > >
> > > >wrote:
> > > >> Jefferson,
> > > >>
> > > >> It sounds as if the XML Schema in the WSDL uses an xs:any particle,
> > > >> and that .NET has magic ways of turning this into a DS.
> > > >>
> > > >> All CXF can do with an 'any', by default, is give you the XML DOM
> for
> > > >> whatever arrives.
> > > >>
> > > >> In the data bindings, you can add custom handling, or you can work
> > > >> with the DOM object.
> > > >>
> > > >> Please have a look at the schema and see if I'm right about the
> 'any'.
> > > >>
> > > >> --benson
> > > >>
> > > >>
> > > >> On Wed, Oct 13, 2010 at 2:29 PM, Jeffrey Rodgers <
> jjrodgers@gmail.com>
> > > >>
> > > >> wrote:
> > > >> > Hello,
> > > >> >
> > > >> > I've used the wsdl2java application to generate the following
> > > >> > classes
> > >
> > > for
> > >
> > > >> my
> > > >>
> > > >> > particular WSDL:
> > > >> >
> > > >> > GetLatestSubjectsDS.java
> > > >> > GetLatestSubjectsDSResponse.java
> > > >> > Init.java
> > > >> > InitResponse.java
> > > >> > ObjectFactory.java
> > > >> > package-info.java
> > > >> > SaveSubject.java
> > > >> > SaveSubjectResponse.java
> > > >> > SrvSoap.java
> > > >> > Srv.java
> > > >> > SrvSoap_SrvSoap_Client.java
> > > >> > SrvSoap_SrvSoap12_Client.java
> > > >> > SubjectsDS.java
> > > >> >
> > > >> > Which I then pulled into Eclipse for usage.  The most basic basic
> > > >> > web service calls are working as expected, but I am having
> > > >> > difficulties
> > >
> > > using
> > >
> > > >> > our GetLatestSubjects web service call which should a set of
> > >
> > > "Subjects"
> > >
> > > >> data
> > > >>
> > > >> > to the client, in which I would ideally unmarshalling into a
> > >
> > > SubjectsDS
> > >
> > > >> > object.  We treat this as a dataset in .NET but I understand
that
> > >
> > > won't
> > >
> > > >> be
> > > >>
> > > >> > happening here.  Within SubjectsDS is a multitude of properties
> > > >> > (more
> > > >>
> > > >> than a
> > > >>
> > > >> > dozen).
> > > >> >
> > > >> > As far as I can tell, the only accessors that I can play with
in
> the
> > > >> > GetLatestSubjectsDSResponse is an "any" property which looks
like
> a
> > > >> > DOM-esque object in the debugger (as expected given the web
> > > >> > service's origin).  I'm unsure what to do with this from here,
but
> > > >> > more
> > >
> > > importantly
> > >
> > > >> > may fear that I'm going about this in a wrong way given my
> > >
> > > inexperience
> > >
> > > >> with
> > > >>
> > > >> > CXF.
> > > >> >
> > > >> > Thanks in advance,
> > > >> > Jefferson
>
> --
> Daniel Kulp
> dkulp@apache.org
> http://dankulp.com/blog
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message