Re: Possible/feasible to hook into the wsdl2code code generation?

robertlazarski <[email protected]> Tue, 6 Feb 2024 05:44:09 -1000
Newsgroups gmane.text.xml.axis.user
Message-ID <CABpPLBUuhDbLXsdF3Z11e5xhd03sYKKrhqnAKmWTfO_rsagZNg@mail.gmail.com>
--000000000000ae15db0610b87352
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

I finally found some time to look more at your question.

Also keep in mind that Axis2 uses an older version 3.x of XMLBeans, as the
project was retired then a few years later brought back to life because
Apache POI uses it. 5.2.0 was released recently.

Anyways, I am not familiar with the Extension Interfaces Feature yet I
suggest just adding it then to Axis2 as a new feature if you are so
inclined as I doubt it is hard to do. At a glance, early in the XMLBeans
5.x series that feature had problems but seems to be fixed now.

If you could suggest how we could improve the docs here please send a pull
request to our apache axis2 github repo.

I am trying hard at the moment to wrap up the next Axis2 release soon and
can only say right now that I can get any changes you supply via pull
requests merged into our repo. Anything beyond that which requires help,
please create a Jira.



On Sun, Jan 28, 2024 at 6:56=E2=80=AFAM Steven De Herdt <
[email protected]> wrote:

> Hi Robert
>
> Thanks for your answer.  It took me a while to examine my options here,
> it's a lot more complicated than the acronym "SOAP" suggests...
>
> At first I was looking through the code that does code generation.  It
> seemed rather involved to fork it and make it do exactly what I wanted.
> Then, following your hint about WSDL2Code's command line arguments, I
> discovered '-xsdconfig'.  I am already using the XMLBeans bindings, and
> it turns out there's a feature in there that's exactly what I'm looking
> for:
>
> https://cwiki.apache.org/confluence/display/XMLBEANS/ExtensionInterfacesF=
eature
> .  Nice, and I could get it to work with XMLBeans' scomp utility.  I
> managed to pass the location of the xsdconfig file through my pom.xml --
> not clearly documented, see here:
> https://marc.info/?l=3Daxis-user&m=3D120177766308116.  Apparently though,
> the code in axis2-xmlbeans to parse the xsdconfig does not support this
> Extension Interfaces Feature.  (I also noticed that changing a generated
> class name (qname element) fails with the xsdconfig through Maven, while
> the same xsdconfig through scomp works.)
>
> So back to square one I guess.  Would it be easiest to just fork a
> codegen package and make a quick and dirty hack in the code or a
> stylesheet?
>
> Greetings
> -Steven
>
>
> Op 19/12/2023 om 21:35 schreef robertlazarski:
> > The two things I suggest looking into are the WSDCode java class with
> > ways such as Ant / Maven to tie into it...
> >
> > And the xls code for each data binding - ADB, XMLBeans, JAXB among
> > others - that does the "implements org.apache.axis2.data
> > binding.*" generation that is particular to the binding.
> >
> > Since WSDL2Code supports quite a few line arguments, that'd be the plac=
e
> > I would try to tie into the "implements" part of the interface and clas=
s
> > generation from the WSDL and XSD files.
> >
> > On Mon, Dec 18, 2023 at 6:31=E2=80=AFAM Steven De Herdt
> > <[email protected]> wrote:
> >
> >     Hello
> >
> >     The project I'm working on is a client implementing dozens of WSDL
> >     operations/SOAP call types.  The SOAP bodies involved all follow a
> >     general structure, which is described in as many dozens of XSD's,
> >     differing only in some types several levels deep into the SOAP body=
.
> >     Error representation, bundling requests etc. are all exactly the
> same.
> >
> >     When generating the service stubs, wsdl2code helpfully prepares all
> >     classes and types involved.  These of course also follow the same
> >     structure for each call type, but all those parallel classes are of
> >     unrelated types.  I understand they can't just be the same, but it
> >     would
> >     be nice for code reuse if they each implemented an interface
> describing
> >     common methods.  The names of the methods are already the same,
> return
> >     types declared in the interfaces could be these new interfaces, so =
I
> >     would just need an "implements GenericAnswerType" or some-such in t=
he
> >     generated classes.
> >
> >     Now my question: can I get something like that by plugging into Axi=
s'
> >     code generation?  Or is there perhaps another way to do code
> >     transformation or patching from Maven?  If possible, I'd like to
> avoid
> >     'tampering' manually with the generated sources.
> >
> >     Thanks for any pointers you might give me.
> >     -Steven
> >
> >     -------------------------------------------------------------------=
--
> >     To unsubscribe, e-mail: [email protected]
> >     <mailto:[email protected]>
> >     For additional commands, e-mail: [email protected]
> >     <mailto:[email protected]>
> >
>

--000000000000ae15db0610b87352
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>I finally found some time to look more at your questi=
on. <br></div><div><br></div><div>Also keep in mind that Axis2 uses an olde=
r version 3.x of XMLBeans, as the project was retired then a few years late=
r brought back to life because Apache POI uses it. 5.2.0 was released recen=
tly. <br></div><div><br></div><div>Anyways, I am not familiar with the Exte=
nsion Interfaces Feature yet I suggest just adding it then to Axis2 as a ne=
w feature if you are so inclined as I doubt it is hard to do. At a glance, =
early in the XMLBeans 5.x series that feature had problems but seems to be =
fixed now. <br></div><div><br></div><div>If you could suggest how we could =
improve the docs here please send a pull request to our apache axis2 github=
 repo. <br></div><div><br></div><div>I am trying hard at the moment to wrap=
 up the next Axis2 release soon and can only say right now that I can get a=
ny changes you supply via pull requests merged into our repo. Anything beyo=
nd that which requires help, please create a Jira. <br></div><div><br></div=
><div><br></div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=
=3D"gmail_attr">On Sun, Jan 28, 2024 at 6:56=E2=80=AFAM Steven De Herdt &lt=
;<a href=3D"mailto:[email protected]">steven.deherdt@ritacolleg=
e.be</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"mar=
gin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1=
ex">Hi Robert<br>
<br>
Thanks for your answer.=C2=A0 It took me a while to examine my options here=
, <br>
it&#39;s a lot more complicated than the acronym &quot;SOAP&quot; suggests.=
..<br>
<br>
At first I was looking through the code that does code generation.=C2=A0 It=
 <br>
seemed rather involved to fork it and make it do exactly what I wanted. <br=
>
Then, following your hint about WSDL2Code&#39;s command line arguments, I <=
br>
discovered &#39;-xsdconfig&#39;.=C2=A0 I am already using the XMLBeans bind=
ings, and <br>
it turns out there&#39;s a feature in there that&#39;s exactly what I&#39;m=
 looking <br>
for: <br>
<a href=3D"https://cwiki.apache.org/confluence/display/XMLBEANS/ExtensionIn=
terfacesFeature" rel=3D"noreferrer" target=3D"_blank">https://cwiki.apache.=
org/confluence/display/XMLBEANS/ExtensionInterfacesFeature</a> <br>
.=C2=A0 Nice, and I could get it to work with XMLBeans&#39; scomp utility.=
=C2=A0 I <br>
managed to pass the location of the xsdconfig file through my pom.xml -- <b=
r>
not clearly documented, see here: <br>
<a href=3D"https://marc.info/?l=3Daxis-user&amp;m=3D120177766308116" rel=3D=
"noreferrer" target=3D"_blank">https://marc.info/?l=3Daxis-user&amp;m=3D120=
177766308116</a>.=C2=A0 Apparently though, <br>
the code in axis2-xmlbeans to parse the xsdconfig does not support this <br=
>
Extension Interfaces Feature.=C2=A0 (I also noticed that changing a generat=
ed <br>
class name (qname element) fails with the xsdconfig through Maven, while <b=
r>
the same xsdconfig through scomp works.)<br>
<br>
So back to square one I guess.=C2=A0 Would it be easiest to just fork a <br=
>
codegen package and make a quick and dirty hack in the code or a stylesheet=
?<br>
<br>
Greetings<br>
-Steven<br>
<br>
<br>
Op 19/12/2023 om 21:35 schreef robertlazarski:<br>
&gt; The two things I suggest looking into are the WSDCode java class with =
<br>
&gt; ways such as Ant / Maven to tie into it...<br>
&gt; <br>
&gt; And the xls code for each data binding - ADB, XMLBeans, JAXB among <br=
>
&gt; others - that does the &quot;implements org.apache.axis2.data<br>
&gt; binding.*&quot; generation that is particular to the binding.<br>
&gt; <br>
&gt; Since WSDL2Code supports quite a few line arguments, that&#39;d be the=
 place <br>
&gt; I would try to tie into the &quot;implements&quot; part of the interfa=
ce and class <br>
&gt; generation from the WSDL and XSD files.<br>
&gt; <br>
&gt; On Mon, Dec 18, 2023 at 6:31=E2=80=AFAM Steven De Herdt <br>
&gt; &lt;[email protected]&gt; wrote:<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0Hello<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0The project I&#39;m working on is a client implemen=
ting dozens of WSDL<br>
&gt;=C2=A0 =C2=A0 =C2=A0operations/SOAP call types.=C2=A0 The SOAP bodies i=
nvolved all follow a<br>
&gt;=C2=A0 =C2=A0 =C2=A0general structure, which is described in as many do=
zens of XSD&#39;s,<br>
&gt;=C2=A0 =C2=A0 =C2=A0differing only in some types several levels deep in=
to the SOAP body.<br>
&gt;=C2=A0 =C2=A0 =C2=A0Error representation, bundling requests etc. are al=
l exactly the same.<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0When generating the service stubs, wsdl2code helpfu=
lly prepares all<br>
&gt;=C2=A0 =C2=A0 =C2=A0classes and types involved.=C2=A0 These of course a=
lso follow the same<br>
&gt;=C2=A0 =C2=A0 =C2=A0structure for each call type, but all those paralle=
l classes are of<br>
&gt;=C2=A0 =C2=A0 =C2=A0unrelated types.=C2=A0 I understand they can&#39;t =
just be the same, but it<br>
&gt;=C2=A0 =C2=A0 =C2=A0would<br>
&gt;=C2=A0 =C2=A0 =C2=A0be nice for code reuse if they each implemented an =
interface describing<br>
&gt;=C2=A0 =C2=A0 =C2=A0common methods.=C2=A0 The names of the methods are =
already the same, return<br>
&gt;=C2=A0 =C2=A0 =C2=A0types declared in the interfaces could be these new=
 interfaces, so I<br>
&gt;=C2=A0 =C2=A0 =C2=A0would just need an &quot;implements GenericAnswerTy=
pe&quot; or some-such in the<br>
&gt;=C2=A0 =C2=A0 =C2=A0generated classes.<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0Now my question: can I get something like that by p=
lugging into Axis&#39;<br>
&gt;=C2=A0 =C2=A0 =C2=A0code generation?=C2=A0 Or is there perhaps another =
way to do code<br>
&gt;=C2=A0 =C2=A0 =C2=A0transformation or patching from Maven?=C2=A0 If pos=
sible, I&#39;d like to avoid<br>
&gt;=C2=A0 =C2=A0 =C2=A0&#39;tampering&#39; manually with the generated sou=
rces.<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0Thanks for any pointers you might give me.<br>
&gt;=C2=A0 =C2=A0 =C2=A0-Steven<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0---------------------------------------------------=
------------------<br>
&gt;=C2=A0 =C2=A0 =C2=A0To unsubscribe, e-mail: <a href=3D"mailto:java-user=
[email protected]" target=3D"_blank">java-user-unsubscribe@axis.=
apache.org</a><br>
&gt;=C2=A0 =C2=A0 =C2=A0&lt;mailto:<a href=3D"mailto:java-user-unsubscribe@=
axis.apache.org" target=3D"_blank">[email protected]</a=
>&gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0For additional commands, e-mail: <a href=3D"mailto:=
[email protected]" target=3D"_blank">[email protected]=
e.org</a><br>
&gt;=C2=A0 =C2=A0 =C2=A0&lt;mailto:<a href=3D"mailto:[email protected]=
ache.org" target=3D"_blank">[email protected]</a>&gt;<br>
&gt; <br>
</blockquote></div>

--000000000000ae15db0610b87352--