You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by "seba.wagner@gmail.com" <se...@gmail.com> on 2011/08/21 12:10:53 UTC

Axis2 Spring integration Issues

Hi,

we are trying to inject Spring Services into an Axis2 Service Class.
Unfortunately the Spring application Context is loaded AFTER Webapp
initializes the Axis2 Servlet.

My first approach was to use a SpringInit-Java Class that gets the
application-Context:
http://code.google.com/p/openmeetings/source/browse/branches/dev/injection/src/userservice/org/openmeetings/axis/services/SpringInit.java

and in the services.xml I defined the initialization like that:
<service name="SpringInit"
class="org.openmeetings.axis.services.SpringInit">
    <description>Init Spring Framework</description>
    <parameter
name="ServiceClass">org.openmeetings.axis.services.SpringInit</parameter>
    <parameter name="ServiceTCCL">composite</parameter>
    <parameter name="load-on-startup">true</parameter>
    <operation name="springInit">
      <messageReceiver
class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
    </operation>
  </service>

=> The problem is: Spring initializes *TWO TIMES*:
1) When my Axis2 SpringInit class initializes, it loads the
applicationContext
2) When the Serlvet Container also has a hook (that one I cannot change)
that loads the webapp.

2. Approache without the SpringInit in the services.xml
If I simply do specify a service like that:
  <service name="UserService" >
    <description>User Service</description>
    <parameter name="ServiceObjectSupplier"
locked="false">org.apache.axis2.extensions.spring.receivers.SpringAppContextAwareObjectSupplier</parameter>
    <parameter name="SpringBeanName"
locked="false">userServiceSoap</parameter>
    <messageReceivers>
        <messageReceiver
            mep="http://www.w3.org/2004/08/wsdl/in-only"

class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"/>
        <messageReceiver
            mep="http://www.w3.org/2004/08/wsdl/in-out"
            class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
    </messageReceivers>
    <parameter name="ServiceClass"
locked="xsd:false">org.openmeetings.axis.services.UserService</parameter>
  </service>

Source code of Service.xml:
http://code.google.com/p/openmeetings/source/browse/branches/dev/injection/src/META-INF/services.xml

WITHOUT loading additionally with SpringInit I do get: UserService?WSDL =>
is generated fine.
BUT when I do invoek any method in the Service I do get an exception:
*Axis2 Can't find Spring's ApplicationContext*

Who can help me with that?
Is there a way to initialize the SpringInit AFTER the webapp is loaded
somehow? I mean I cannot be the only person that has a Spring aware
Web-Application and simply want's to inject the SpringBeans into Axis2 but
WITHOUT Axis2 actually STARTING Spring cause Spring is already loaded via
the Web-Container.


Thanks a lot
Sebastian Wagner

-- 
Sebastian Wagner
http://www.webbase-design.de
http://openmeetings.googlecode.com
http://www.wagner-sebastian.com
seba.wagner@gmail.com

Re: Axis2 Spring integration Issues

Posted by "seba.wagner@gmail.com" <se...@gmail.com>.
okay full stop:

*operations :* If the service impl class is Java, then all the public
methods in that service will be exposed. If the user wants to override it,
he has to add the "operation" tag and override it. In a non-Java scenario or
if you do not have a service class, then all the operations the user wants
to expose by the service has to be indicated in the services.xml. It is
specified as follows:

=> so the operation tag is only needed if I want to OVERRIDE sth.

But the thing is => I don't want to override anything. I want to make
exactly what is written down:
*public methods in that service will be exposed*

If I am using the sample with NO "operation" => Zero methods are exposed but
there are 10 or more public methods available.

That seems to me like exactly I tried to initially describe:
Axis2 is not able to read the Bean. So it could not get the Methods
That was why I was trying with the SpringInit to load the Spring Application
Context
That resultet in having the Application Context loaded twice, one time by
Axis2 and one time by the Servlet Context.

So actually I am at the start again.

Sebastian

2011/8/22 seba.wagner@gmail.com <se...@gmail.com>

> Well but out of curiosity:
>
> Is the "operation" TAG needed to make a method available via Axis2: YES or
> NO?
>
> There must be one definitive answer to that isn't it?
>
> I am quite sure there is NO information regarding that on the documentation
> in the wiki.
>
> I am using Axis2 sind it was called Axis. I don't want to complain but I
> was quite happy since they eliminated the deploy.wsdd + undeploy.wsdd files.
> Now it seems to me a bit tricky again to get some simple methods available
> via SOAP.
>
> Anyway, still thankful for your response, at least my results are open
> sourced so maybe someone else will find it helpful.
>
> Sebastian
>
>
> 2011/8/22 robert lazarski <ro...@gmail.com>
>
>> On Mon, Aug 22, 2011 at 4:09 PM, seba.wagner@gmail.com
>> <se...@gmail.com> wrote:
>> > Hi Robert,
>> >
>> > no the "useOriginalwsdl" doesn't work for me. What should it do
>> actually? I
>> > mean I don't want to specify a WSDL on my own manually I want Axis2 to
>> > create one based on the Methods that are declared public the the Service
>> > Class. In Version 1.3 of Axis2 there was no need to write any additional
>> > method information for that in the service.xml.
>> >
>> > The only config explenation I can find is here:
>> >
>> http://axis.apache.org/axis2/java/core/docosts/axis2config.html#Service_Configuration
>> >
>> > But there is not mentioned anywhere if there is now need to define any
>> > method as <operation> or not .. or if there is a <parameter> tag.
>> >
>> > Even in the sample config there is a tag called *actionMapping* ...any
>> idea
>> > what that Tag means?
>> > It is not mentioned anywhere else.
>> >
>> > However thanks a lot
>> > Sebastian
>> >
>>
>> Unfortunately I'm not sure about these other questions. Seems like you
>> are copying and pasting code and config files without understanding
>> their purposes, and are using parts of axis2 I don't know much about.
>> Try searching the forums on your wsdl questions.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
>> For additional commands, e-mail: java-user-help@axis.apache.org
>>
>>
>
>
> --
> Sebastian Wagner
> http://www.webbase-design.de
> http://openmeetings.googlecode.com
> http://www.wagner-sebastian.com
> seba.wagner@gmail.com
>



-- 
Sebastian Wagner
http://www.webbase-design.de
http://openmeetings.googlecode.com
http://www.wagner-sebastian.com
seba.wagner@gmail.com

Re: Axis2 Spring integration Issues

Posted by "seba.wagner@gmail.com" <se...@gmail.com>.
Well but out of curiosity:

Is the "operation" TAG needed to make a method available via Axis2: YES or
NO?

There must be one definitive answer to that isn't it?

I am quite sure there is NO information regarding that on the documentation
in the wiki.

I am using Axis2 sind it was called Axis. I don't want to complain but I was
quite happy since they eliminated the deploy.wsdd + undeploy.wsdd files.
Now it seems to me a bit tricky again to get some simple methods available
via SOAP.

Anyway, still thankful for your response, at least my results are open
sourced so maybe someone else will find it helpful.

Sebastian


2011/8/22 robert lazarski <ro...@gmail.com>

> On Mon, Aug 22, 2011 at 4:09 PM, seba.wagner@gmail.com
> <se...@gmail.com> wrote:
> > Hi Robert,
> >
> > no the "useOriginalwsdl" doesn't work for me. What should it do actually?
> I
> > mean I don't want to specify a WSDL on my own manually I want Axis2 to
> > create one based on the Methods that are declared public the the Service
> > Class. In Version 1.3 of Axis2 there was no need to write any additional
> > method information for that in the service.xml.
> >
> > The only config explenation I can find is here:
> >
> http://axis.apache.org/axis2/java/core/docosts/axis2config.html#Service_Configuration
> >
> > But there is not mentioned anywhere if there is now need to define any
> > method as <operation> or not .. or if there is a <parameter> tag.
> >
> > Even in the sample config there is a tag called *actionMapping* ...any
> idea
> > what that Tag means?
> > It is not mentioned anywhere else.
> >
> > However thanks a lot
> > Sebastian
> >
>
> Unfortunately I'm not sure about these other questions. Seems like you
> are copying and pasting code and config files without understanding
> their purposes, and are using parts of axis2 I don't know much about.
> Try searching the forums on your wsdl questions.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
>
>


-- 
Sebastian Wagner
http://www.webbase-design.de
http://openmeetings.googlecode.com
http://www.wagner-sebastian.com
seba.wagner@gmail.com

Re: Axis2 Spring integration Issues

Posted by robert lazarski <ro...@gmail.com>.
On Mon, Aug 22, 2011 at 4:09 PM, seba.wagner@gmail.com
<se...@gmail.com> wrote:
> Hi Robert,
>
> no the "useOriginalwsdl" doesn't work for me. What should it do actually? I
> mean I don't want to specify a WSDL on my own manually I want Axis2 to
> create one based on the Methods that are declared public the the Service
> Class. In Version 1.3 of Axis2 there was no need to write any additional
> method information for that in the service.xml.
>
> The only config explenation I can find is here:
> http://axis.apache.org/axis2/java/core/docosts/axis2config.html#Service_Configuration
>
> But there is not mentioned anywhere if there is now need to define any
> method as <operation> or not .. or if there is a <parameter> tag.
>
> Even in the sample config there is a tag called *actionMapping* ...any idea
> what that Tag means?
> It is not mentioned anywhere else.
>
> However thanks a lot
> Sebastian
>

Unfortunately I'm not sure about these other questions. Seems like you
are copying and pasting code and config files without understanding
their purposes, and are using parts of axis2 I don't know much about.
Try searching the forums on your wsdl questions.

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org


Re: Axis2 Spring integration Issues

Posted by "seba.wagner@gmail.com" <se...@gmail.com>.
Hi Robert,

no the "useOriginalwsdl" doesn't work for me. What should it do actually? I
mean I don't want to specify a WSDL on my own manually I want Axis2 to
create one based on the Methods that are declared public the the Service
Class. In Version 1.3 of Axis2 there was no need to write any additional
method information for that in the service.xml.

The only config explenation I can find is here:
http://axis.apache.org/axis2/java/core/docs/axis2config.html#Service_Configuration

But there is not mentioned anywhere if there is now need to define any
method as <operation> or not .. or if there is a <parameter> tag.

Even in the sample config there is a tag called *actionMapping* ...any idea
what that Tag means?
It is not mentioned anywhere else.

However thanks a lot
Sebastian

2011/8/22 robert lazarski <ro...@gmail.com>

> On Mon, Aug 22, 2011 at 3:23 PM, seba.wagner@gmail.com
> <se...@gmail.com> wrote:
> > Hi Robert,
> >
> > the initial exception on startup is gone now,
> > however the generated WSDL initially contained no method definitions.
> >
> > I had to manually add a "operation" tag in the service XML.
> > This is my new Service.xml definition (I only test with the UserService
> > modified only):
> >
> http://code.google.com/p/openmeetings/source/browse/branches/dev/injection/src/META-INF/services.xml
> >
> > It SHOULD look like from my point of view:
> > http://demo.openmeetings.de/openmeetings/services/UserService?wsdl
> >
> > But the resulting WSDL looks like that:
> > http://pastebin.com/mzMznPhC
> >
> > You got an idea what might went wrong with it?
>
>
> IIRC, set the "useOriginalwsdl" parameter "true" in your services.xml
> so that Axis2 will use the one you supplied originally. You may want
> to double check the docs, but I believe that is still:
>
> <parameter name="useOriginalwsdl">true</parameter>
>
> > Why are those *<operation>* Tags needed by using the Spring integration?
>
> That's axis2 stuff and not specific to Spring. They define what
> methods can be invoked. See the <excludeOperations> tag to prevent
> access to, for example, your setters.
>
> > Previously I did not configure anything like that in the service.xml,
> Axis2
> > just made all Methods available that are public in the Service-Class.
> >
> > Do we now need to manually add all method calls by using the "<operation
> > name=xyz><operation>"-Definition  in the service.xml now?
> > What about params, do we need to specify params in the service.xml too?
> > What about returned JavaBeans, do we need to write mappings for those
> Beans
> > manually in the service.xml?
>
> That is all explained in the docs.
>
> > For example this Return Object "Sessiondata" ... I cannot find it in the
> > newly generated WSDL.
> > I see an error in the namespace of the generated WSDL?
> > Or is there any special trick? For example by using an Interface as
> > placeholder in the service.xml-definition?!
> >
> > I cannot find any docs on that, I would be great if you could shed some
> > light on this.
> >
>
> See "useOriginalwsdl" above.
>
> > BTW: Is there a DTD or something about possible TAGs in the service.xml ?
> I
> > was searching for that for a long time but I cannot find any Docs about
> what
> > TAGs are allowed in the service.xml
> >
>
> There was talk of an xml schema at one point for service.xml, search
> the source distro or google for it. The docs could be the best you can
> do on that ... not sure.
>
> > Thanks a lot
> > Sebastian
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
>
>


-- 
Sebastian Wagner
http://www.webbase-design.de
http://openmeetings.googlecode.com
http://www.wagner-sebastian.com
seba.wagner@gmail.com

Re: Axis2 Spring integration Issues

Posted by robert lazarski <ro...@gmail.com>.
On Mon, Aug 22, 2011 at 3:23 PM, seba.wagner@gmail.com
<se...@gmail.com> wrote:
> Hi Robert,
>
> the initial exception on startup is gone now,
> however the generated WSDL initially contained no method definitions.
>
> I had to manually add a "operation" tag in the service XML.
> This is my new Service.xml definition (I only test with the UserService
> modified only):
> http://code.google.com/p/openmeetings/source/browse/branches/dev/injection/src/META-INF/services.xml
>
> It SHOULD look like from my point of view:
> http://demo.openmeetings.de/openmeetings/services/UserService?wsdl
>
> But the resulting WSDL looks like that:
> http://pastebin.com/mzMznPhC
>
> You got an idea what might went wrong with it?


IIRC, set the "useOriginalwsdl" parameter "true" in your services.xml
so that Axis2 will use the one you supplied originally. You may want
to double check the docs, but I believe that is still:

<parameter name="useOriginalwsdl">true</parameter>

> Why are those *<operation>* Tags needed by using the Spring integration?

That's axis2 stuff and not specific to Spring. They define what
methods can be invoked. See the <excludeOperations> tag to prevent
access to, for example, your setters.

> Previously I did not configure anything like that in the service.xml, Axis2
> just made all Methods available that are public in the Service-Class.
>
> Do we now need to manually add all method calls by using the "<operation
> name=xyz><operation>"-Definition  in the service.xml now?
> What about params, do we need to specify params in the service.xml too?
> What about returned JavaBeans, do we need to write mappings for those Beans
> manually in the service.xml?

That is all explained in the docs.

> For example this Return Object "Sessiondata" ... I cannot find it in the
> newly generated WSDL.
> I see an error in the namespace of the generated WSDL?
> Or is there any special trick? For example by using an Interface as
> placeholder in the service.xml-definition?!
>
> I cannot find any docs on that, I would be great if you could shed some
> light on this.
>

See "useOriginalwsdl" above.

> BTW: Is there a DTD or something about possible TAGs in the service.xml ? I
> was searching for that for a long time but I cannot find any Docs about what
> TAGs are allowed in the service.xml
>

There was talk of an xml schema at one point for service.xml, search
the source distro or google for it. The docs could be the best you can
do on that ... not sure.

> Thanks a lot
> Sebastian

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org


Re: Axis2 Spring integration Issues

Posted by "seba.wagner@gmail.com" <se...@gmail.com>.
Hi Robert,

the initial exception on startup is gone now,
however the generated WSDL initially contained no method definitions.

I had to manually add a "operation" tag in the service XML.
This is my new Service.xml definition (I only test with the UserService
modified only):
http://code.google.com/p/openmeetings/source/browse/branches/dev/injection/src/META-INF/services.xml

It SHOULD look like from my point of view:
http://demo.openmeetings.de/openmeetings/services/UserService?wsdl

But the resulting WSDL looks like that:
http://pastebin.com/mzMznPhC

You got an idea what might went wrong with it?
Why are those *<operation>* Tags needed by using the Spring integration?
Previously I did not configure anything like that in the service.xml, Axis2
just made all Methods available that are public in the Service-Class.

Do we now need to manually add all method calls by using the "<operation
name=xyz><operation>"-Definition  in the service.xml now?
What about params, do we need to specify params in the service.xml too?
What about returned JavaBeans, do we need to write mappings for those Beans
manually in the service.xml?
For example this Return Object "Sessiondata" ... I cannot find it in the
newly generated WSDL.
I see an error in the namespace of the generated WSDL?
Or is there any special trick? For example by using an Interface as
placeholder in the service.xml-definition?!

I cannot find any docs on that, I would be great if you could shed some
light on this.

BTW: Is there a DTD or something about possible TAGs in the service.xml ? I
was searching for that for a long time but I cannot find any Docs about what
TAGs are allowed in the service.xml

Thanks a lot
Sebastian

2011/8/22 seba.wagner@gmail.com <se...@gmail.com>

> Hi Robert,
>
> I will test and give feedback.
>
> Thanks a lot!
> Sebastian
>
> 2011/8/21 robert lazarski <ro...@gmail.com>
>
>> On Sun, Aug 21, 2011 at 3:58 PM, seba.wagner@gmail.com
>> <se...@gmail.com> wrote:
>> > service.xml including that service:
>> >
>> http://code.google.com/p/openmeetings/source/browse/branches/dev/injection/src/META-INF/services.xml
>>
>> The docs indicate that for servlet context loading you should use
>> SpringServletContextObjectSupplier, not
>> SpringAppContextAwareObjectSupplier.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
>> For additional commands, e-mail: java-user-help@axis.apache.org
>>
>>
>
>
> --
> Sebastian Wagner
> http://www.webbase-design.de
> http://openmeetings.googlecode.com
> http://www.wagner-sebastian.com
> seba.wagner@gmail.com
>



-- 
Sebastian Wagner
http://www.webbase-design.de
http://openmeetings.googlecode.com
http://www.wagner-sebastian.com
seba.wagner@gmail.com

Re: Axis2 Spring integration Issues

Posted by "seba.wagner@gmail.com" <se...@gmail.com>.
Hi Robert,

I will test and give feedback.

Thanks a lot!
Sebastian

2011/8/21 robert lazarski <ro...@gmail.com>

> On Sun, Aug 21, 2011 at 3:58 PM, seba.wagner@gmail.com
> <se...@gmail.com> wrote:
> > service.xml including that service:
> >
> http://code.google.com/p/openmeetings/source/browse/branches/dev/injection/src/META-INF/services.xml
>
> The docs indicate that for servlet context loading you should use
> SpringServletContextObjectSupplier, not
> SpringAppContextAwareObjectSupplier.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
>
>


-- 
Sebastian Wagner
http://www.webbase-design.de
http://openmeetings.googlecode.com
http://www.wagner-sebastian.com
seba.wagner@gmail.com

Re: Axis2 Spring integration Issues

Posted by robert lazarski <ro...@gmail.com>.
On Sun, Aug 21, 2011 at 3:58 PM, seba.wagner@gmail.com
<se...@gmail.com> wrote:
> service.xml including that service:
> http://code.google.com/p/openmeetings/source/browse/branches/dev/injection/src/META-INF/services.xml

The docs indicate that for servlet context loading you should use
SpringServletContextObjectSupplier, not
SpringAppContextAwareObjectSupplier.

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org


Re: Axis2 Spring integration Issues

Posted by "seba.wagner@gmail.com" <se...@gmail.com>.
So here we go.

I am testing the Service called *UserService*

service.xml including that service:
http://code.google.com/p/openmeetings/source/browse/branches/dev/injection/src/META-INF/services.xml

The application-Context file from Spring that gets loaded and the link to
the line of the xml where the Bean is defined that Axis2 will reference:
http://code.google.com/p/openmeetings/source/browse/branches/dev/injection/WebContent/WEB-INF/openmeetings-applicationContext.xml#256

The UserService Class that gets deployed as WebService:
http://code.google.com/p/openmeetings/source/browse/branches/dev/injection/src/userservice/org/openmeetings/axis/services/UserServiceProxy.java

All very simple I think and alligned exactly to what is written at:
http://axis.apache.org/axis2/java/core/docs/spring.html#With_a_ServletContext

The service.xml is compiled into a file called: OpenMeetingsService.aar and
situated in webapp/WEB-INF/services
The UserServiceProxy.java class is bundled into a
openmeetings-WebService.jar and situated in webapp/WEB-INF/lib

The exception on startup of Tomcat is:
2011-08-21 20:49:23,552 [main] INFO  o.a.catalina.core.StandardEngine -
Starting Servlet Engine: Apache Tomcat/6.0.24
2011-08-21 20:49:26,011 [main] ERROR o.a.a.deployment.ServiceDeployer - The
OpenMeetingsService.aar service, which is not valid, caused The following
error occurred during schema generation: Axis2 Can't find Spring's
ApplicationContext
org.apache.axis2.deployment.DeploymentException: The following error
occurred during schema generation: Axis2 Can't find Spring's
ApplicationContext
...


Thanks
Sebastian


2011/8/21 seba.wagner@gmail.com <se...@gmail.com>:
> Thanks Robert,
>
> I will modify the sources aligned with the inital approach again and
> send you the details.
>
> Sebastian
>
> 2011/8/21 robert lazarski <ro...@gmail.com>:
>> On Sun, Aug 21, 2011 at 1:58 PM, robert lazarski
>> <ro...@gmail.com> wrote:
>>> On Sun, Aug 21, 2011 at 1:33 PM, seba.wagner@gmail.com
>>> <se...@gmail.com> wrote:
>>>> Hi Robert,
>>>>
>>>> I have exactly read and applied this one first.
>>>>
>>>> You mean:
>>>> <service name="SpringAwareService">
>>>>    <description>
>>>>        simple spring example
>>>>    </description>
>>>>    <parameter
name="ServiceObjectSupplier">org.apache.axis2.extensions.spring.receivers.SpringServletContextObjectSupplier</parameter>
>>>>    <parameter name="SpringBeanName">springAwareService</parameter>
>>>>    <operation name="getValue">
>>>>        <messageReceiver
>>>> class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
>>>>    </operation>
>>>> </service>
>>>>
>>>> => It results in a situation where the WSDL file is generated but ZERO
>>>> methods are in the Service.
>>>>
>>>> If you manually add one like this:
>>>> <operation name="getValue">
>>>>
>>>> (of course with a different method name that really exist in our case
>>>> and with a SpringBean that does exist et cetera it results in:
>>>> Service Object cannot be found ... which means that much like it was
>>>> not able to find the Bean.
>>>>
>>>>
>>>> Sebastian
>>>>
>>>
>>> I'm not sure what exactly your problem is - you've mentioned at least
>>> loading order, wsdl issues and ungenerated methods, best I can tell.
>>> The axis2 spring integration guide requires you follow it exactly, and
>>> works when done so. You are pasting incomplete configs and no stack
>>> traces, so its hard to see where you are going wrong. I don't think
>>> you mentioned what version of axis2 you are using, but I suggest you
>>> try going over the guide another time as it typically works for
>>> everyone eventually.
>>>
>>
>> If all else fails, if you paste all your configs as outined in the
>> guide, and you stack traces, on the latest released axis2, I'll see if
>> I can help.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
>> For additional commands, e-mail: java-user-help@axis.apache.org
>>
>>
>
>
>
> --
> Sebastian Wagner
> http://www.webbase-design.de
> http://openmeetings.googlecode.com
> http://www.wagner-sebastian.com
> seba.wagner@gmail.com
>



-- 
Sebastian Wagner
http://www.webbase-design.de
http://openmeetings.googlecode.com
http://www.wagner-sebastian.com
seba.wagner@gmail.com

Re: Axis2 Spring integration Issues

Posted by "seba.wagner@gmail.com" <se...@gmail.com>.
Thanks Robert,

I will modify the sources aligned with the inital approach again and
send you the details.

Sebastian

2011/8/21 robert lazarski <ro...@gmail.com>:
> On Sun, Aug 21, 2011 at 1:58 PM, robert lazarski
> <ro...@gmail.com> wrote:
>> On Sun, Aug 21, 2011 at 1:33 PM, seba.wagner@gmail.com
>> <se...@gmail.com> wrote:
>>> Hi Robert,
>>>
>>> I have exactly read and applied this one first.
>>>
>>> You mean:
>>> <service name="SpringAwareService">
>>>    <description>
>>>        simple spring example
>>>    </description>
>>>    <parameter name="ServiceObjectSupplier">org.apache.axis2.extensions.spring.receivers.SpringServletContextObjectSupplier</parameter>
>>>    <parameter name="SpringBeanName">springAwareService</parameter>
>>>    <operation name="getValue">
>>>        <messageReceiver
>>> class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
>>>    </operation>
>>> </service>
>>>
>>> => It results in a situation where the WSDL file is generated but ZERO
>>> methods are in the Service.
>>>
>>> If you manually add one like this:
>>> <operation name="getValue">
>>>
>>> (of course with a different method name that really exist in our case
>>> and with a SpringBean that does exist et cetera it results in:
>>> Service Object cannot be found ... which means that much like it was
>>> not able to find the Bean.
>>>
>>>
>>> Sebastian
>>>
>>
>> I'm not sure what exactly your problem is - you've mentioned at least
>> loading order, wsdl issues and ungenerated methods, best I can tell.
>> The axis2 spring integration guide requires you follow it exactly, and
>> works when done so. You are pasting incomplete configs and no stack
>> traces, so its hard to see where you are going wrong. I don't think
>> you mentioned what version of axis2 you are using, but I suggest you
>> try going over the guide another time as it typically works for
>> everyone eventually.
>>
>
> If all else fails, if you paste all your configs as outined in the
> guide, and you stack traces, on the latest released axis2, I'll see if
> I can help.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
>
>



-- 
Sebastian Wagner
http://www.webbase-design.de
http://openmeetings.googlecode.com
http://www.wagner-sebastian.com
seba.wagner@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org


Re: Axis2 Spring integration Issues

Posted by robert lazarski <ro...@gmail.com>.
On Sun, Aug 21, 2011 at 1:58 PM, robert lazarski
<ro...@gmail.com> wrote:
> On Sun, Aug 21, 2011 at 1:33 PM, seba.wagner@gmail.com
> <se...@gmail.com> wrote:
>> Hi Robert,
>>
>> I have exactly read and applied this one first.
>>
>> You mean:
>> <service name="SpringAwareService">
>>    <description>
>>        simple spring example
>>    </description>
>>    <parameter name="ServiceObjectSupplier">org.apache.axis2.extensions.spring.receivers.SpringServletContextObjectSupplier</parameter>
>>    <parameter name="SpringBeanName">springAwareService</parameter>
>>    <operation name="getValue">
>>        <messageReceiver
>> class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
>>    </operation>
>> </service>
>>
>> => It results in a situation where the WSDL file is generated but ZERO
>> methods are in the Service.
>>
>> If you manually add one like this:
>> <operation name="getValue">
>>
>> (of course with a different method name that really exist in our case
>> and with a SpringBean that does exist et cetera it results in:
>> Service Object cannot be found ... which means that much like it was
>> not able to find the Bean.
>>
>>
>> Sebastian
>>
>
> I'm not sure what exactly your problem is - you've mentioned at least
> loading order, wsdl issues and ungenerated methods, best I can tell.
> The axis2 spring integration guide requires you follow it exactly, and
> works when done so. You are pasting incomplete configs and no stack
> traces, so its hard to see where you are going wrong. I don't think
> you mentioned what version of axis2 you are using, but I suggest you
> try going over the guide another time as it typically works for
> everyone eventually.
>

If all else fails, if you paste all your configs as outined in the
guide, and you stack traces, on the latest released axis2, I'll see if
I can help.

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org


Re: Axis2 Spring integration Issues

Posted by robert lazarski <ro...@gmail.com>.
On Sun, Aug 21, 2011 at 1:33 PM, seba.wagner@gmail.com
<se...@gmail.com> wrote:
> Hi Robert,
>
> I have exactly read and applied this one first.
>
> You mean:
> <service name="SpringAwareService">
>    <description>
>        simple spring example
>    </description>
>    <parameter name="ServiceObjectSupplier">org.apache.axis2.extensions.spring.receivers.SpringServletContextObjectSupplier</parameter>
>    <parameter name="SpringBeanName">springAwareService</parameter>
>    <operation name="getValue">
>        <messageReceiver
> class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
>    </operation>
> </service>
>
> => It results in a situation where the WSDL file is generated but ZERO
> methods are in the Service.
>
> If you manually add one like this:
> <operation name="getValue">
>
> (of course with a different method name that really exist in our case
> and with a SpringBean that does exist et cetera it results in:
> Service Object cannot be found ... which means that much like it was
> not able to find the Bean.
>
>
> Sebastian
>

I'm not sure what exactly your problem is - you've mentioned at least
loading order, wsdl issues and ungenerated methods, best I can tell.
The axis2 spring integration guide requires you follow it exactly, and
works when done so. You are pasting incomplete configs and no stack
traces, so its hard to see where you are going wrong. I don't think
you mentioned what version of axis2 you are using, but I suggest you
try going over the guide another time as it typically works for
everyone eventually.

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org


Re: Axis2 Spring integration Issues

Posted by "seba.wagner@gmail.com" <se...@gmail.com>.
Hi Robert,

I have exactly read and applied this one first.

You mean:
<service name="SpringAwareService">
    <description>
        simple spring example
    </description>
    <parameter name="ServiceObjectSupplier">org.apache.axis2.extensions.spring.receivers.SpringServletContextObjectSupplier</parameter>
    <parameter name="SpringBeanName">springAwareService</parameter>
    <operation name="getValue">
        <messageReceiver
class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
    </operation>
</service>

=> It results in a situation where the WSDL file is generated but ZERO
methods are in the Service.

If you manually add one like this:
<operation name="getValue">

(of course with a different method name that really exist in our case
and with a SpringBean that does exist et cetera it results in:
Service Object cannot be found ... which means that much like it was
not able to find the Bean.


Sebastian

2011/8/21 robert lazarski <ro...@gmail.com>:
> On Sun, Aug 21, 2011 at 7:10 AM, seba.wagner@gmail.com
> <se...@gmail.com> wrote:
>> Hi,
>>
>> we are trying to inject Spring Services into an Axis2 Service Class.
>> Unfortunately the Spring application Context is loaded AFTER Webapp
>> initializes the Axis2 Servlet.
>>
>> My first approach was to use a SpringInit-Java Class that gets the
>> application-Context:
>> http://code.google.com/p/openmeetings/source/browse/branches/dev/injection/src/userservice/org/openmeetings/axis/services/SpringInit.java
>>
>
> That is not axis2 code, but it roughly follows one of the axis2 Spring
> guide examples for spring inside the AAR and non servlet container use
> cases. You may not have read the docs.
>
> http://axis.apache.org/axis2/java/core/docs/spring.html
>
> You sinply may be using the wrong config for your use case. The
> example code you linked to is not intended to be typically used when
> servlet container hooks itself can do the job. The "With a
> ServletContext" example may be a better ft for what you are tring to
> do.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
>
>



-- 
Sebastian Wagner
http://www.webbase-design.de
http://openmeetings.googlecode.com
http://www.wagner-sebastian.com
seba.wagner@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org


Re: Axis2 Spring integration Issues

Posted by robert lazarski <ro...@gmail.com>.
On Sun, Aug 21, 2011 at 7:10 AM, seba.wagner@gmail.com
<se...@gmail.com> wrote:
> Hi,
>
> we are trying to inject Spring Services into an Axis2 Service Class.
> Unfortunately the Spring application Context is loaded AFTER Webapp
> initializes the Axis2 Servlet.
>
> My first approach was to use a SpringInit-Java Class that gets the
> application-Context:
> http://code.google.com/p/openmeetings/source/browse/branches/dev/injection/src/userservice/org/openmeetings/axis/services/SpringInit.java
>

That is not axis2 code, but it roughly follows one of the axis2 Spring
guide examples for spring inside the AAR and non servlet container use
cases. You may not have read the docs.

http://axis.apache.org/axis2/java/core/docs/spring.html

You sinply may be using the wrong config for your use case. The
example code you linked to is not intended to be typically used when
servlet container hooks itself can do the job. The "With a
ServletContext" example may be a better ft for what you are tring to
do.

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org


Re: Axis2 Spring integration Issues

Posted by "seba.wagner@gmail.com" <se...@gmail.com>.
One obvious way would be of course to manually grab the ServletContext
and get the Bean from it like:
public ServletContext getServletContext()
    {
        MessageContext mc = MessageContext.getCurrentMessageContext();
        return (ServletContext)
mc.getProperty(HTTPConstants.MC_HTTP_SERVLETCONTEXT);
    }

and then you could do it like that:

ApplicationContext context =
WebApplicationContextUtils.getWebApplicationContext(getServletContext());
                        FileProcessor fileProcessor = (FileProcessor)
context.getBean("openmeetings.FileProcessor");


However this is neither fine and would require that we proxy all
Web-Service Call into an internal Service that is spring aware instead
of just injecting the Beans into the Axis2 Service Class.

=> so the bean DOES really exist, its just that Axis2 should:
NOT startup Spring
SHOULD find the Beans to generate the WSDL and service definitions.

It seems to me a bit impossible right? We try to create a WSDL from a
bean while Spring is not initialized but we don't want Axis to init
Spring. ... but somehow isn't this the usual scenario?

Sebastian

2011/8/21 seba.wagner@gmail.com <se...@gmail.com>
>
> Hi,
>
> we are trying to inject Spring Services into an Axis2 Service Class. Unfortunately the Spring application Context is loaded AFTER Webapp initializes the Axis2 Servlet.
>
> My first approach was to use a SpringInit-Java Class that gets the application-Context:
> http://code.google.com/p/openmeetings/source/browse/branches/dev/injection/src/userservice/org/openmeetings/axis/services/SpringInit.java
>
> and in the services.xml I defined the initialization like that:
> <service name="SpringInit" class="org.openmeetings.axis.services.SpringInit">
>     <description>Init Spring Framework</description>
>     <parameter name="ServiceClass">org.openmeetings.axis.services.SpringInit</parameter>
>     <parameter name="ServiceTCCL">composite</parameter>
>     <parameter name="load-on-startup">true</parameter>
>     <operation name="springInit">
>       <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
>     </operation>
>   </service>
>
> => The problem is: Spring initializes TWO TIMES:
> 1) When my Axis2 SpringInit class initializes, it loads the applicationContext
> 2) When the Serlvet Container also has a hook (that one I cannot change) that loads the webapp.
>
> 2. Approache without the SpringInit in the services.xml
> If I simply do specify a service like that:
>   <service name="UserService" >
>     <description>User Service</description>
>     <parameter name="ServiceObjectSupplier" locked="false">org.apache.axis2.extensions.spring.receivers.SpringAppContextAwareObjectSupplier</parameter>
>     <parameter name="SpringBeanName" locked="false">userServiceSoap</parameter>
>     <messageReceivers>
>         <messageReceiver
>             mep="http://www.w3.org/2004/08/wsdl/in-only"
>             class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"/>
>         <messageReceiver
>             mep="http://www.w3.org/2004/08/wsdl/in-out"
>             class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
>     </messageReceivers>
>     <parameter name="ServiceClass" locked="xsd:false">org.openmeetings.axis.services.UserService</parameter>
>   </service>
>
> Source code of Service.xml: http://code.google.com/p/openmeetings/source/browse/branches/dev/injection/src/META-INF/services.xml
>
> WITHOUT loading additionally with SpringInit I do get: UserService?WSDL => is generated fine.
> BUT when I do invoek any method in the Service I do get an exception:
> Axis2 Can't find Spring's ApplicationContext
>
> Who can help me with that?
> Is there a way to initialize the SpringInit AFTER the webapp is loaded somehow? I mean I cannot be the only person that has a Spring aware Web-Application and simply want's to inject the SpringBeans into Axis2 but WITHOUT Axis2 actually STARTING Spring cause Spring is already loaded via the Web-Container.
>
>
> Thanks a lot
> Sebastian Wagner
>
> --
> Sebastian Wagner
> http://www.webbase-design.de
> http://openmeetings.googlecode.com
> http://www.wagner-sebastian.com
> seba.wagner@gmail.com



--
Sebastian Wagner
http://www.webbase-design.de
http://openmeetings.googlecode.com
http://www.wagner-sebastian.com
seba.wagner@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org