You are viewing a plain text version of this content. The canonical link for it is here.
Posted to muse-dev@ws.apache.org by SARA1232007 <cy...@foxmail.com> on 2009/04/27 15:16:53 UTC

About use factory to create resource

Hi,

I tried to use a factory to create a managed resource and then access the
resource directly without searching the ServiceGroup.

I have modified the wrsf example as following:
1) use WsrMEPMBeanFactory to create a managed resource, ie, WsrMEPMBean, the
code is following:

    public void initializeCompleted() 
        throws SoapFault
    {
        super.initializeCompleted();

		ResourceManager manager = getResource().getResourceManager();
					
		Resource next = manager.createResource("WsrMEPMBean");
		next.initialize();

        getLog().warning("WsrMEPMBeanFactoryImpl.initializeCompleted()::
WsrMEPMBean address:"+next.getEndpointReference().getAddress());
    }


2) rename the WsResource to WsrMEPMBean
3) remove the declarence and implementation of ServiceGroup and
ServiceGroupEntry.
 
The log information of client which try to build a WsrServerClient to access
"http://127.0.0.1:8086/WsrServer/services/WsrMEPMBean" directly without
searching ServiceGroup. The client trace information tells me that the
endpoint "http://127.0.0.1:8086/WsrServer/services/WsrMEPMBean" does not
exist, while the server information tells me that the resource with address
"http://127.0.0.1:8086/WsrServer/services/WsrMEPMBean" is already created.
The detailed trace information of client is as following:

[CLIENT TRACE] SOAP envelope contents (outgoing):

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
    <soap:Header>
        <wsa:To
xmlns:wsa="http://www.w3.org/2005/08/addressing">http://127.0.0.1:8086/WsrServer/services/WsrMEPMBean</wsa:To>
        <wsa:Action
xmlns:wsa="http://www.w3.org/2005/08/addressing">http://docs.oasis-open.org/wsrf/rpw-2/GetResourcePropertyDocument/GetResourcePropertyDocumentRequest</wsa:Action>
        <wsa:MessageID
xmlns:wsa="http://www.w3.org/2005/08/addressing">uuid:0593b5c8-f369-8188-7674-e76599ba8a94</wsa:MessageID>
        <wsa:From xmlns:wsa="http://www.w3.org/2005/08/addressing">
           
<wsa:Address>http://www.w3.org/2005/08/addressing/role/anonymous</wsa:Address>
        </wsa:From>
    </soap:Header>
    <soap:Body>
        <wsrf-rp:GetResourcePropertyDocument
xmlns:wsrf-rp="http://docs.oasis-open.org/wsrf/rp-2"/>
    </soap:Body>
</soap:Envelope>

[CLIENT TRACE] SOAP envelope contents (incoming):

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
    <soap:Header>
        <wsa:To
xmlns:wsa="http://www.w3.org/2005/08/addressing">http://www.w3.org/2005/08/addressing/role/anonymous</wsa:To>
        <wsa:Action
xmlns:wsa="http://www.w3.org/2005/08/addressing">http://www.w3.org/2005/08/addressing/fault</wsa:Action>
        <wsa:MessageID
xmlns:wsa="http://www.w3.org/2005/08/addressing">uuid:9ab4845a-7d97-746d-2faf-e68acb554fb4</wsa:MessageID>
        <wsa:RelatesTo RelationshipType="wsa:Reply"
xmlns:wsa="http://www.w3.org/2005/08/addressing">uuid:0593b5c8-f369-8188-7674-e76599ba8a94</wsa:RelatesTo>
        <wsa:From xmlns:wsa="http://www.w3.org/2005/08/addressing">
           
<wsa:Address>http://127.0.0.1:8086/WsrServer/services/WsrMEPMBean</wsa:Address>
        </wsa:From>
    </soap:Header>
    <soap:Body>
        <soap:Fault>
            <soap:Code>
                <soap:Value>soap:Sender</soap:Value>
                <soap:Subcode
xmlns:wsa="http://www.w3.org/2005/08/addressing">
                    <soap:Value>wsa:DestinationUnreachable</soap:Value>
                </soap:Subcode>
            </soap:Code>
            <soap:Reason>
                <soap:Text>[ID = 'DestinationUnreachable'] There is no
resource available at the given EPR: 

&lt;wsa:EndpointReference
xmlns:wsa="http://www.w3.org/2005/08/addressing"&gt;
   
&lt;wsa:Address&gt;http://127.0.0.1:8086/WsrServer/services/WsrMEPMBean&lt;/wsa:Address&gt;
&lt;/wsa:EndpointReference&gt;

The existing EPRs hosted by this endpoint are: 

&lt;wsa:EndpointReference
xmlns:wsa="http://www.w3.org/2005/08/addressing"&gt;
    &lt;wsa:ReferenceParameters
xmlns:wsa="http://www.w3.org/2005/08/addressing"/&gt;
   
&lt;wsa:Address&gt;http://127.0.0.1:8086/WsrServer/services/WsrMEPMBeanFactory&lt;/wsa:Address&gt;
&lt;/wsa:EndpointReference&gt;
</soap:Text>
            </soap:Reason>
        </soap:Fault>
    </soap:Body>
</soap:Envelope>

org.apache.muse.ws.addressing.soap.SoapFault: [ID =
'DestinationUnreachable'] There is no resource available at the given EPR: 

<wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing">
   
<wsa:Address>http://127.0.0.1:8086/WsrServer/services/WsrMEPMBean</wsa:Address>
</wsa:EndpointReference>

The existing EPRs hosted by this endpoint are: 

<wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing">
    <wsa:ReferenceParameters
xmlns:wsa="http://www.w3.org/2005/08/addressing"/>
   
<wsa:Address>http://127.0.0.1:8086/WsrServer/services/WsrMEPMBeanFactory</wsa:Address>
</wsa:EndpointReference>

The log information from server is as following: 

10:22:03,342 INFO  [Server] JBoss (MX MicroKernel) [4.2.2.GA (build:
SVNTag=JBos
s_4_2_2_GA date=200710221139)] Started in 1m:27s:229ms
10:22:16,140 ERROR [STDERR] 2009-4-27 10:22:16
org.apache.muse.core.SimpleResour
ce initialize
信息: [ID = 'ResourceInitialized'] The resource at 'WsrMEPMBean' has been
initia
lized.
10:22:16,140 ERROR [STDERR] WsrMEPMBeanFactoryImpl.initializeCompleted()::
WsrME
PMBean address:http://127.0.0.1:8086/WsrServer/services/WsrMEPMBean
10:22:16,140 ERROR [STDERR] 2009-4-27 10:22:16
com._30wish.www.muse.ManagementSe
rvice.WsrMEPMBeanFactoryImpl initializeCompleted

10:22:16,140 ERROR [STDERR] 2009-4-27 10:22:16
org.apache.muse.core.SimpleResour
ce initialize
信息: [ID = 'ResourceInitialized'] The resource at 'WsrMEPMBeanFactory' has
been
 initialized.
10:22:16,140 ERROR [STDERR] 2009-4-27 10:22:16
org.apache.muse.core.routing.Simp
leResourceRouter initialize
信息: [ID = 'RouterIsInitialized'] The resource router has been initialized.

Can anyone tell me what's wrong?

Thanks.

Sara


-- 
View this message in context: http://www.nabble.com/About-use-factory-to-create-resource-tp23256067p23256067.html
Sent from the Muse - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: muse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-dev-help@ws.apache.org


Re: About use factory to create resource

Posted by SARA1232007 <cy...@foxmail.com>.
Hi Chris,

I search the WsrMEPMBean(managed resource) entry using ServiceGroup and
found that the WsrMEPMBean has a resourceId with the value MuseResource-1.
What I plan is to use the address
'http://127.0.0.1:8086/WsrServer/services/WsrMEPMBean' without resourceId,
so I remove the subdirectory 'WsrMEPMBean' under  'router-entries'
directory. 

Can anyone tell me what else need to be done to access a resource, which
generated by a factory, without resourceId?
Also, an another question: what should I do if I want to assign the
resourceId value by an another class?

The muse.xml content is as following:

    <router>
       
<java-router-class>org.apache.muse.core.routing.SimpleResourceRouter</java-router-class>
        <logging>
            <log-file>log/muse.log</log-file>
            <log-level>FINE</log-level>
        </logging>
        <persistence>
           
<java-persistence-class>org.apache.muse.core.routing.RouterFilePersistence</java-persistence-class>
            <persistence-location>router-entries</persistence-location>
        </persistence>
    </router>
    <resource-type>
        <context-path>WsrMEPMBean</context-path>
        <wsdl>
            <wsdl-file>/wsdl/WsrMEPMBean.wsdl</wsdl-file>
            <wsdl-port-type
xmlns:pfx="http://www.30wish.com/muse/ManagementService">pfx:WsrMEPMBeanPortType</wsdl-port-type>
        </wsdl>
       
<java-id-factory-class>org.apache.muse.core.routing.CounterResourceIdFactory</java-id-factory-class>
       
<java-resource-class>org.apache.muse.ws.resource.impl.SimpleWsResource</java-resource-class>
... ...
Thanks.

Sara

-- 
View this message in context: http://www.nabble.com/About-use-factory-to-create-resource-tp23256067p23293658.html
Sent from the Muse - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: muse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-dev-help@ws.apache.org