You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wsrf-user@ws.apache.org by José Antonio Sánchez <ge...@gmail.com> on 2006/07/18 11:18:49 UTC
Problem with singleton service
Hello, I'm trying to implement a factory service in Muse 1.0, so I've
made it a singleton service. To do so I copied the code of the Home in
the enterprise example as follows:
private ServiceManagementPortResource m_resource = null;
/**
* Create and add any resource instances.
*
* @throws Exception on error
*/
public void init() throws Exception
{
super.init();
// TODO: Create and add any known resource instances here.
// If this is home for a singleton service (i.e. a service
that exposes exactly one resource),
// use null as the resource identifier when creating the instance.
//String instance1Id = "00000001";
try
{
if ( m_resource == null )
{
m_resource = (ServiceManagementPortResource)
createInstance( null );
EndpointReference epr =
getEndpointReference( null );
m_resource.setEndpointReference( epr );
add( m_resource );
System.out.println("epr is " + epr.toString());
}
}
catch ( ResourceException e )
{
throw new ResourceUnknownException(
"ServiceManagementPortResource","ServiceManagementPortResource"
);
}
}
And in the Resource file I've initialized the resourceid following the
Host example:
public void init()
{
super.init();
/**
* The ResourcePropertySet which contains all the defined ResourceProperties
*/
org.apache.ws.resource.properties.ResourcePropertySet
resourcePropertySet = getResourcePropertySet();
org.apache.ws.resource.properties.ResourceProperty resourceProperty = null;
try{
// init the {http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part1.xsd}ResourceId
Resource Property
org.apache.ws.muws.MuwsUtils.initResourceIdProperty(this);
}
catch (Exception e)
{
throw new javax.xml.rpc.JAXRPCException("There was a problem in
initializing your resource properties. Please check your init()
method. Cause: " + e.getLocalizedMessage());
}
}
The problem is that when I try to invoke it using the following message:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:fs="http://tomas.org/wsdm/ServiceManagement"
xmlns:wsrp="http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
<soapenv:Header>
<wsa:To
soapenv:mustUnderstand="1">http://adapt20:8081/muse/services/ServiceManagementPort</wsa:To>
<wsa:Action
soapenv:mustUnderstand="1">http://tomas.org/wsdm/ServiceManagement/ServiceManagementPortType/GetServices</wsa:Action>
</soapenv:Header>
<soapenv:Body>
<fs:GetServicesRequest/>
</soapenv:Body>
</soapenv:Envelope>
I get the response:
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<soapenv:Fault>
<faultcode>soapenv:Client</faultcode>
<faultstring>The expected resource identifier reference
parameter named
{http://tomas.org/wsdm/ServiceManagement}ResourceIdentifier was not
found in the SOAP header.</faultstring>
<detail/>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
So I think that it does not recognize it as a singleton service. Is
there something more to do to define a singleton service apart from
initializing the resource id as null?
--
Saludos.
José Antonio Sánchez
---------------------------------------------------------------------
To unsubscribe, e-mail: wsrf-user-unsubscribe@ws.apache.org
For additional commands, e-mail: wsrf-user-help@ws.apache.org
Re: Problem with singleton service
Posted by José Antonio Sánchez <ge...@gmail.com>.
Thanks. that worked.
On 7/18/06, Reddy, Naga <Na...@ca.com> wrote:
> You need to remove the following code from jndi-config.xml file under your service:
> <parameter>
> <name>resourceIdentifierReferenceParameterName</name>
> <value>{ http://tomas.org/wsdm/ServiceManagement }ResourceIdentifier</value>
> </parameter>
>
> - Naga Muni Reddy
>
> -----Original Message-----
> From: José Antonio Sánchez [mailto:getaceres@gmail.com]
> Sent: Tuesday, July 18, 2006 2:49 PM
> To: muse-user@ws.apache.org; wsrf-user@ws.apache.org
> Subject: Problem with singleton service
>
> Hello, I'm trying to implement a factory service in Muse 1.0, so I've
> made it a singleton service. To do so I copied the code of the Home in
> the enterprise example as follows:
>
> private ServiceManagementPortResource m_resource = null;
> /**
> * Create and add any resource instances.
> *
> * @throws Exception on error
> */
> public void init() throws Exception
> {
> super.init();
> // TODO: Create and add any known resource instances here.
> // If this is home for a singleton service (i.e. a service
> that exposes exactly one resource),
> // use null as the resource identifier when creating the instance.
> //String instance1Id = "00000001";
>
> try
> {
>
> if ( m_resource == null )
> {
> m_resource = (ServiceManagementPortResource)
> createInstance( null );
> EndpointReference epr =
> getEndpointReference( null );
> m_resource.setEndpointReference( epr );
> add( m_resource );
> System.out.println("epr is " + epr.toString());
> }
> }
> catch ( ResourceException e )
> {
> throw new ResourceUnknownException(
> "ServiceManagementPortResource","ServiceManagementPortResource"
> );
> }
> }
>
>
> And in the Resource file I've initialized the resourceid following the
> Host example:
>
> public void init()
> {
> super.init();
>
> /**
> * The ResourcePropertySet which contains all the defined ResourceProperties
> */
> org.apache.ws.resource.properties.ResourcePropertySet
> resourcePropertySet = getResourcePropertySet();
> org.apache.ws.resource.properties.ResourceProperty resourceProperty = null;
>
>
> try{
> // init the {http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part1.xsd}ResourceId
> Resource Property
> org.apache.ws.muws.MuwsUtils.initResourceIdProperty(this);
>
>
> }
> catch (Exception e)
> {
> throw new javax.xml.rpc.JAXRPCException("There was a problem in
> initializing your resource properties. Please check your init()
> method. Cause: " + e.getLocalizedMessage());
> }
>
> }
>
> The problem is that when I try to invoke it using the following message:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:fs="http://tomas.org/wsdm/ServiceManagement"
> xmlns:wsrp="http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd"
> xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
> <soapenv:Header>
> <wsa:To
> soapenv:mustUnderstand="1">http://adapt20:8081/muse/services/ServiceManagementPort</wsa:To>
> <wsa:Action
> soapenv:mustUnderstand="1">http://tomas.org/wsdm/ServiceManagement/ServiceManagementPortType/GetServices</wsa:Action>
> </soapenv:Header>
> <soapenv:Body>
> <fs:GetServicesRequest/>
> </soapenv:Body>
> </soapenv:Envelope>
>
> I get the response:
>
> <?xml version="1.0" encoding="utf-8"?>
> <soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <soapenv:Body>
> <soapenv:Fault>
> <faultcode>soapenv:Client</faultcode>
> <faultstring>The expected resource identifier reference
> parameter named
> {http://tomas.org/wsdm/ServiceManagement}ResourceIdentifier was not
> found in the SOAP header.</faultstring>
> <detail/>
> </soapenv:Fault>
> </soapenv:Body>
> </soapenv:Envelope>
>
> So I think that it does not recognize it as a singleton service. Is
> there something more to do to define a singleton service apart from
> initializing the resource id as null?
>
> --
> Saludos.
> José Antonio Sánchez
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: muse-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: muse-user-help@ws.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: muse-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: muse-user-help@ws.apache.org
>
>
--
Saludos.
José Antonio Sánchez
---------------------------------------------------------------------
To unsubscribe, e-mail: muse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-user-help@ws.apache.org
Re: Problem with singleton service
Posted by José Antonio Sánchez <ge...@gmail.com>.
That's not supposed to work that way, I think. Normally you create a
factory service because you don't know the ID of a resource so you ask
to a service without ID about the ID of the resource you want.
Also, in the Enterprise example, all the request to the singleton
service comes without ResourceIdentifier.
On 7/18/06, Daniel Jemiolo <da...@us.ibm.com> wrote:
> Perhaps your client still needs to include the ResourceIdentifier SOAP
> header, even if it's an empty element? Even if a resource type is a
> singleton, it may still have a resource identifier, no?
>
> Dan
>
>
>
> "José Antonio Sánchez" <ge...@gmail.com> wrote on 07/18/2006 05:18:49
> AM:
>
> > Hello, I'm trying to implement a factory service in Muse 1.0, so I've
> > made it a singleton service. To do so I copied the code of the Home in
> > the enterprise example as follows:
> >
> > private ServiceManagementPortResource m_resource = null;
> > /**
> > * Create and add any resource instances.
> > *
> > * @throws Exception on error
> > */
> > public void init() throws Exception
> > {
> > super.init();
> > // TODO: Create and add any known resource instances here.
> > // If this is home for a singleton service (i.e. a service
> > that exposes exactly one resource),
> > // use null as the resource identifier when creating the
> instance.
> > //String instance1Id = "00000001";
> >
> > try
> > {
> >
> > if ( m_resource == null )
> > {
> > m_resource = (ServiceManagementPortResource)
> > createInstance( null );
> > EndpointReference epr =
> > getEndpointReference( null );
> > m_resource.setEndpointReference( epr );
> > add( m_resource );
> > System.out.println("epr is " + epr.toString());
> > }
> > }
> > catch ( ResourceException e )
> > {
> > throw new ResourceUnknownException(
> > "ServiceManagementPortResource","ServiceManagementPortResource"
> > );
> > }
> > }
> >
> >
> > And in the Resource file I've initialized the resourceid following the
> > Host example:
> >
> > public void init()
> > {
> > super.init();
> >
> > /**
> > * The ResourcePropertySet which contains all the defined
> ResourceProperties
> > */
> > org.apache.ws.resource.properties.ResourcePropertySet
> > resourcePropertySet = getResourcePropertySet();
> > org.apache.ws.resource.properties.ResourceProperty
> resourceProperty = null;
> >
> >
> > try{
> > // init the
> {http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-
> > part1.xsd}ResourceId
> > Resource Property
> > org.apache.ws.muws.MuwsUtils.initResourceIdProperty(this);
> >
> >
> > }
> > catch (Exception e)
> > {
> > throw new javax.xml.rpc.JAXRPCException("There was a problem in
> > initializing your resource properties. Please check your init()
> > method. Cause: " + e.getLocalizedMessage());
> > }
> >
> > }
> >
> > The problem is that when I try to invoke it using the following message:
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <soapenv:Envelope
> > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > xmlns:fs="http://tomas.org/wsdm/ServiceManagement"
> > xmlns:wsrp="http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-
> > ResourceProperties-1.2-draft-01.xsd"
> > xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
> > <soapenv:Header>
> > <wsa:To
> > soapenv:mustUnderstand="1">http://adapt20:
> > 8081/muse/services/ServiceManagementPort</wsa:To>
> > <wsa:Action
> > soapenv:mustUnderstand="1">http://tomas.
> >
> org/wsdm/ServiceManagement/ServiceManagementPortType/GetServices</wsa:Action>
> > </soapenv:Header>
> > <soapenv:Body>
> > <fs:GetServicesRequest/>
> > </soapenv:Body>
> > </soapenv:Envelope>
> >
> > I get the response:
> >
> > <?xml version="1.0" encoding="utf-8"?>
> > <soapenv:Envelope
> > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> > <soapenv:Body>
> > <soapenv:Fault>
> > <faultcode>soapenv:Client</faultcode>
> > <faultstring>The expected resource identifier reference
> > parameter named
> > {http://tomas.org/wsdm/ServiceManagement}ResourceIdentifier was not
> > found in the SOAP header.</faultstring>
> > <detail/>
> > </soapenv:Fault>
> > </soapenv:Body>
> > </soapenv:Envelope>
> >
> > So I think that it does not recognize it as a singleton service. Is
> > there something more to do to define a singleton service apart from
> > initializing the resource id as null?
> >
> > --
> > Saludos.
> > José Antonio Sánchez
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: wsrf-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: wsrf-user-help@ws.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wsrf-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: wsrf-user-help@ws.apache.org
>
>
--
Saludos.
José Antonio Sánchez
---------------------------------------------------------------------
To unsubscribe, e-mail: wsrf-user-unsubscribe@ws.apache.org
For additional commands, e-mail: wsrf-user-help@ws.apache.org
Re: Problem with singleton service
Posted by Daniel Jemiolo <da...@us.ibm.com>.
Perhaps your client still needs to include the ResourceIdentifier SOAP
header, even if it's an empty element? Even if a resource type is a
singleton, it may still have a resource identifier, no?
Dan
"José Antonio Sánchez" <ge...@gmail.com> wrote on 07/18/2006 05:18:49
AM:
> Hello, I'm trying to implement a factory service in Muse 1.0, so I've
> made it a singleton service. To do so I copied the code of the Home in
> the enterprise example as follows:
>
> private ServiceManagementPortResource m_resource = null;
> /**
> * Create and add any resource instances.
> *
> * @throws Exception on error
> */
> public void init() throws Exception
> {
> super.init();
> // TODO: Create and add any known resource instances here.
> // If this is home for a singleton service (i.e. a service
> that exposes exactly one resource),
> // use null as the resource identifier when creating the
instance.
> //String instance1Id = "00000001";
>
> try
> {
>
> if ( m_resource == null )
> {
> m_resource = (ServiceManagementPortResource)
> createInstance( null );
> EndpointReference epr =
> getEndpointReference( null );
> m_resource.setEndpointReference( epr );
> add( m_resource );
> System.out.println("epr is " + epr.toString());
> }
> }
> catch ( ResourceException e )
> {
> throw new ResourceUnknownException(
> "ServiceManagementPortResource","ServiceManagementPortResource"
> );
> }
> }
>
>
> And in the Resource file I've initialized the resourceid following the
> Host example:
>
> public void init()
> {
> super.init();
>
> /**
> * The ResourcePropertySet which contains all the defined
ResourceProperties
> */
> org.apache.ws.resource.properties.ResourcePropertySet
> resourcePropertySet = getResourcePropertySet();
> org.apache.ws.resource.properties.ResourceProperty
resourceProperty = null;
>
>
> try{
> // init the
{http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-
> part1.xsd}ResourceId
> Resource Property
> org.apache.ws.muws.MuwsUtils.initResourceIdProperty(this);
>
>
> }
> catch (Exception e)
> {
> throw new javax.xml.rpc.JAXRPCException("There was a problem in
> initializing your resource properties. Please check your init()
> method. Cause: " + e.getLocalizedMessage());
> }
>
> }
>
> The problem is that when I try to invoke it using the following message:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:fs="http://tomas.org/wsdm/ServiceManagement"
> xmlns:wsrp="http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-
> ResourceProperties-1.2-draft-01.xsd"
> xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
> <soapenv:Header>
> <wsa:To
> soapenv:mustUnderstand="1">http://adapt20:
> 8081/muse/services/ServiceManagementPort</wsa:To>
> <wsa:Action
> soapenv:mustUnderstand="1">http://tomas.
>
org/wsdm/ServiceManagement/ServiceManagementPortType/GetServices</wsa:Action>
> </soapenv:Header>
> <soapenv:Body>
> <fs:GetServicesRequest/>
> </soapenv:Body>
> </soapenv:Envelope>
>
> I get the response:
>
> <?xml version="1.0" encoding="utf-8"?>
> <soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <soapenv:Body>
> <soapenv:Fault>
> <faultcode>soapenv:Client</faultcode>
> <faultstring>The expected resource identifier reference
> parameter named
> {http://tomas.org/wsdm/ServiceManagement}ResourceIdentifier was not
> found in the SOAP header.</faultstring>
> <detail/>
> </soapenv:Fault>
> </soapenv:Body>
> </soapenv:Envelope>
>
> So I think that it does not recognize it as a singleton service. Is
> there something more to do to define a singleton service apart from
> initializing the resource id as null?
>
> --
> Saludos.
> José Antonio Sánchez
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wsrf-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: wsrf-user-help@ws.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: wsrf-user-unsubscribe@ws.apache.org
For additional commands, e-mail: wsrf-user-help@ws.apache.org
Re: Problem with singleton service
Posted by Daniel Jemiolo <da...@us.ibm.com>.
Perhaps your client still needs to include the ResourceIdentifier SOAP
header, even if it's an empty element? Even if a resource type is a
singleton, it may still have a resource identifier, no?
Dan
"José Antonio Sánchez" <ge...@gmail.com> wrote on 07/18/2006 05:18:49
AM:
> Hello, I'm trying to implement a factory service in Muse 1.0, so I've
> made it a singleton service. To do so I copied the code of the Home in
> the enterprise example as follows:
>
> private ServiceManagementPortResource m_resource = null;
> /**
> * Create and add any resource instances.
> *
> * @throws Exception on error
> */
> public void init() throws Exception
> {
> super.init();
> // TODO: Create and add any known resource instances here.
> // If this is home for a singleton service (i.e. a service
> that exposes exactly one resource),
> // use null as the resource identifier when creating the
instance.
> //String instance1Id = "00000001";
>
> try
> {
>
> if ( m_resource == null )
> {
> m_resource = (ServiceManagementPortResource)
> createInstance( null );
> EndpointReference epr =
> getEndpointReference( null );
> m_resource.setEndpointReference( epr );
> add( m_resource );
> System.out.println("epr is " + epr.toString());
> }
> }
> catch ( ResourceException e )
> {
> throw new ResourceUnknownException(
> "ServiceManagementPortResource","ServiceManagementPortResource"
> );
> }
> }
>
>
> And in the Resource file I've initialized the resourceid following the
> Host example:
>
> public void init()
> {
> super.init();
>
> /**
> * The ResourcePropertySet which contains all the defined
ResourceProperties
> */
> org.apache.ws.resource.properties.ResourcePropertySet
> resourcePropertySet = getResourcePropertySet();
> org.apache.ws.resource.properties.ResourceProperty
resourceProperty = null;
>
>
> try{
> // init the
{http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-
> part1.xsd}ResourceId
> Resource Property
> org.apache.ws.muws.MuwsUtils.initResourceIdProperty(this);
>
>
> }
> catch (Exception e)
> {
> throw new javax.xml.rpc.JAXRPCException("There was a problem in
> initializing your resource properties. Please check your init()
> method. Cause: " + e.getLocalizedMessage());
> }
>
> }
>
> The problem is that when I try to invoke it using the following message:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:fs="http://tomas.org/wsdm/ServiceManagement"
> xmlns:wsrp="http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-
> ResourceProperties-1.2-draft-01.xsd"
> xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
> <soapenv:Header>
> <wsa:To
> soapenv:mustUnderstand="1">http://adapt20:
> 8081/muse/services/ServiceManagementPort</wsa:To>
> <wsa:Action
> soapenv:mustUnderstand="1">http://tomas.
>
org/wsdm/ServiceManagement/ServiceManagementPortType/GetServices</wsa:Action>
> </soapenv:Header>
> <soapenv:Body>
> <fs:GetServicesRequest/>
> </soapenv:Body>
> </soapenv:Envelope>
>
> I get the response:
>
> <?xml version="1.0" encoding="utf-8"?>
> <soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <soapenv:Body>
> <soapenv:Fault>
> <faultcode>soapenv:Client</faultcode>
> <faultstring>The expected resource identifier reference
> parameter named
> {http://tomas.org/wsdm/ServiceManagement}ResourceIdentifier was not
> found in the SOAP header.</faultstring>
> <detail/>
> </soapenv:Fault>
> </soapenv:Body>
> </soapenv:Envelope>
>
> So I think that it does not recognize it as a singleton service. Is
> there something more to do to define a singleton service apart from
> initializing the resource id as null?
>
> --
> Saludos.
> José Antonio Sánchez
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wsrf-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: wsrf-user-help@ws.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: muse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-user-help@ws.apache.org
RE: Problem with singleton service
Posted by "Reddy, Naga" <Na...@ca.com>.
You need to remove the following code from jndi-config.xml file under your service:
<parameter>
<name>resourceIdentifierReferenceParameterName</name>
<value>{ http://tomas.org/wsdm/ServiceManagement }ResourceIdentifier</value>
</parameter>
- Naga Muni Reddy
-----Original Message-----
From: José Antonio Sánchez [mailto:getaceres@gmail.com]
Sent: Tuesday, July 18, 2006 2:49 PM
To: muse-user@ws.apache.org; wsrf-user@ws.apache.org
Subject: Problem with singleton service
Hello, I'm trying to implement a factory service in Muse 1.0, so I've
made it a singleton service. To do so I copied the code of the Home in
the enterprise example as follows:
private ServiceManagementPortResource m_resource = null;
/**
* Create and add any resource instances.
*
* @throws Exception on error
*/
public void init() throws Exception
{
super.init();
// TODO: Create and add any known resource instances here.
// If this is home for a singleton service (i.e. a service
that exposes exactly one resource),
// use null as the resource identifier when creating the instance.
//String instance1Id = "00000001";
try
{
if ( m_resource == null )
{
m_resource = (ServiceManagementPortResource)
createInstance( null );
EndpointReference epr =
getEndpointReference( null );
m_resource.setEndpointReference( epr );
add( m_resource );
System.out.println("epr is " + epr.toString());
}
}
catch ( ResourceException e )
{
throw new ResourceUnknownException(
"ServiceManagementPortResource","ServiceManagementPortResource"
);
}
}
And in the Resource file I've initialized the resourceid following the
Host example:
public void init()
{
super.init();
/**
* The ResourcePropertySet which contains all the defined ResourceProperties
*/
org.apache.ws.resource.properties.ResourcePropertySet
resourcePropertySet = getResourcePropertySet();
org.apache.ws.resource.properties.ResourceProperty resourceProperty = null;
try{
// init the {http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part1.xsd}ResourceId
Resource Property
org.apache.ws.muws.MuwsUtils.initResourceIdProperty(this);
}
catch (Exception e)
{
throw new javax.xml.rpc.JAXRPCException("There was a problem in
initializing your resource properties. Please check your init()
method. Cause: " + e.getLocalizedMessage());
}
}
The problem is that when I try to invoke it using the following message:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:fs="http://tomas.org/wsdm/ServiceManagement"
xmlns:wsrp="http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
<soapenv:Header>
<wsa:To
soapenv:mustUnderstand="1">http://adapt20:8081/muse/services/ServiceManagementPort</wsa:To>
<wsa:Action
soapenv:mustUnderstand="1">http://tomas.org/wsdm/ServiceManagement/ServiceManagementPortType/GetServices</wsa:Action>
</soapenv:Header>
<soapenv:Body>
<fs:GetServicesRequest/>
</soapenv:Body>
</soapenv:Envelope>
I get the response:
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<soapenv:Fault>
<faultcode>soapenv:Client</faultcode>
<faultstring>The expected resource identifier reference
parameter named
{http://tomas.org/wsdm/ServiceManagement}ResourceIdentifier was not
found in the SOAP header.</faultstring>
<detail/>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
So I think that it does not recognize it as a singleton service. Is
there something more to do to define a singleton service apart from
initializing the resource id as null?
--
Saludos.
José Antonio Sánchez
---------------------------------------------------------------------
To unsubscribe, e-mail: muse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-user-help@ws.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: muse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-user-help@ws.apache.org