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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]