The simplest thing to do is to flip JAXB into it's "simple" mode. Create a
binding file of:
<jaxws:bindings wsdlLocation="http://ts2.nbs-us.com/TestWS/Service.asmx?WSDL"
xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
jaxb:extensionBindingPrefixes="xjc"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc">
<jaxws:bindings node="wsdl:definitions/wsdl:types/xsd:schema">
<jaxb:globalBindings
jaxb:version="2.0">
<xjc:simple />
</jaxb:globalBindings>
</jaxws:bindings>
</jaxws:bindings>
and pass that into wsdl2java. That should allow it to generate the code that
should work for you.
Dan
On Tuesday, November 22, 2011 4:55:47 PM David Brown wrote:
> Hello Daniel, thanks for the speedy reply. The WSDL is public so it is
> quite easy with only a handfull of operations exposed:
>
> http://ts2.nbs-us.com/TestWS/Service.asmx?WSDL
>
> I can make everything work except the method:
>
> getTableData
>
> by commenting out the offending extra attribute: 'any'.
>
> I tried using this XSD as follows but the wsdl2java and the wsimport
> just claims the result will be an empty node: /xs:schema.
>
> ********************************************************************
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> <jaxb:bindings version="2.0"
> xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
> xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
> <jaxb:bindings schemaLocation="bindings.xsd" node="/xs:schema">
> <jaxb:schemaBindings>
> <jaxb:package name="com.sexingtechnologies.TestWS"/>
> </jaxb:schemaBindings>
>
> <jaxb:bindings node=".//xs:attribute[@name='any']">
> <jaxb:property name="anyAttribute" />
> </jaxb:bindings>
> </jaxb:bindings>
> </jaxb:bindings>
> *********************************************************************
>
> Please advise, David.
>
> On Tue, 2011-11-22 at 16:54 -0500, Daniel Kulp wrote:
> > The jaxb binding file is really the only way, but they can be very
> > tricky to get right. Can you post a sample project with a stripped
> > down wsdl or something?
> >
> > Dan
> >
> > On Tuesday, November 22, 2011 11:07:59 AM David Brown wrote:
> > > Hello cxfers, I have the dubious task of consuming a .NET 2.0
> > > generated
> > > WSDL using our internally developed SOAP client. The .NET WS is
> > > public
> > > and we have no control over the generation of the WSDL.
> > >
> > > Therefore, we must have a solution in the binding or the WSDL
> > > itself.
> > >
> > > I am currently running the wsdl2java against the WSDL as a file
> > > protocol instead of HTTP.
> > >
> > > The invoking commandline follows:
> > >
> > > ~/dev/apache-cxf-2.5.0/bin/wsdl2java -autoNameResolution -compile
> > > -client -d . -p com.sexingtechnologies.TestWS -frontend jaxws21
> > > TestWS/TestWS.wsdl
> > >
> > > The error condition returned is as follows:
> > >
> > > WSDLToJava Error: Thrown by JAXB:
> > > Thrown by JAXB:
> > > Property "Any" is already defined. Use <jaxb:property> to resolve
> > > this
> > > conflict.
> > >
> > > ******************************************************************
> > >
> > > I have tried all of the jaxb binding and xsd tricks I could find on
> > > Google to change the element attribute name (any) to something other
> > > but this to date has not worked.
> > >
> > > ******************************************************************
> > >
> > > Using the service-repository.com SOAP client:
> > >
> > > http://www.service-repository.com/client/start
> > >
> > > the target WSDL functions perfectly.
> > >
> > > So, there must be some on-the-fly trick way of making errant WSDLs
> > > behave.
> > >
> > > Any suggestions rants or raves welcomed.
> > >
> > > Please advise, David.
--
Daniel Kulp
[email protected] - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com