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 <danjemiolo 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" <getaceres 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","ServiceMa
nagementPortResource"
> >
);
> > }
> > }
> >
> >
> > 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-
a>
> > 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://sche
mas.xmlsoap.org/soap/envelope/"
> > xmlns sd=&
quot;http://www.w3.org/20
01/XMLSchema"
> > xmlns si=&
quot;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://tomas.
> >
>
org/wsdm/ServiceManagement/ServiceManagementPortType/GetServ
ices</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://sche
mas.xmlsoap.org/soap/envelope/"
> > xmlns sd=&
quot;http://www.w3.org/20
01/XMLSchema"
> > xmlns si=&
quot;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
|