hi,
the service create here,
axisService = createAnonymousService();
does not have a service Group.
So
AxisServiceGroup axisServiceGroup = axisService.getAxisServiceGroup();
ServiceGroupContext sgc =
configContext.createServiceGroupContext(axisServiceGroup);
serviceContext = sgc.getServiceContext(axisService);
there will be an NullpointerException at the third statement.
AxisService axisService = axisServiceGroup.getService(service.getName());
see inside the sgc.getServiceContext(axisService) method.
So basically this code does not work if an AxisService already exists in the
AxisConfiguration.
Anyway if we take your scenario, I think the idea of using the same name is
that user wants to use the same existing service. And also I think there are
no changes happen to AxisService during a service invocation.
thanks,
Amila.
On Mon, Aug 17, 2009 at 10:33 AM, Deepal Jayasinghe <[email protected]>wrote:
> Amila,
>
> Let's say we are trying to invoke a service called "Echo" inside an
> application server (like tomcat), and further assume that we have a
> service called "Echo" in the server as well. Then what happen is you are
> going to change the server's service. I think that is not right.
>
> Deepal
>
> [email protected] wrote:
> > Author: amilas
> > Date: Mon Aug 17 04:37:13 2009
> > New Revision: 804860
> >
> > URL: http://svn.apache.org/viewvc?rev=804860&view=rev
> > Log:
> > if the axisService already exists in the axisconfiguration we need to use
> that inside the service client as well.
> >
> > Modified:
> >
> webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/ServiceClient.java
> >
> > Modified:
> webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/ServiceClient.java
> > URL:
> http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/ServiceClient.java?rev=804860&r1=804859&r2=804860&view=diff
> >
> ==============================================================================
> > ---
> webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/ServiceClient.java
> (original)
> > +++
> webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/ServiceClient.java
> Mon Aug 17 04:37:13 2009
> > @@ -167,20 +167,22 @@
> > if (axisService == null) {
> > axisService = createAnonymousService();
> > }
> > - this.axisService = axisService;
> > +
> > // axis service is removed from the configuration context
> > // only if user has not added it to configuration context.
> > if (axisConfig.getService(axisService.getName()) == null) {
> > axisService.setClientSide(true);
> > axisConfig.addService(axisService);
> > removeAxisService = true;
> > + this.axisService = axisService;
> > } else {
> > axisService.setClientSide(true);
> > removeAxisService = false;
> > + this.axisService =
> axisConfig.getService(axisService.getName());
> > }
> > - AxisServiceGroup axisServiceGroup =
> axisService.getAxisServiceGroup();
> > + AxisServiceGroup axisServiceGroup =
> this.axisService.getAxisServiceGroup();
> > ServiceGroupContext sgc =
> configContext.createServiceGroupContext(axisServiceGroup);
> > - serviceContext = sgc.getServiceContext(axisService);
> > + serviceContext = sgc.getServiceContext(this.axisService);
> > }
> >
> >
> >
> >
> >
> >
>
> --
> Thank you!
>
>
> http://blogs.deepal.org
> http://deepal.org
>
>
--
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/