Gregor Kiddie wrote:

-----Original Message-----
From: Simon Laws [mailto:simonsl...@googlemail.com] Sent: 18 May 2010 14:13
To: user@tuscany.apache.org
Subject: Re: Problem calling to an external web service.

On Tue, May 18, 2010 at 1:55 PM, Gregor Kiddie
<gregor.kid...@channeladvisor.com> wrote:

-----Original Message-----
From: Simon Laws [mailto:simonsl...@googlemail.com]
Sent: 18 May 2010 13:42
To: user@tuscany.apache.org
Subject: Re: Problem calling to an external web service.

On Tue, May 18, 2010 at 1:04 PM, Gregor Kiddie
<gregor.kid...@channeladvisor.com> wrote:

-----Original Message-----
From: Simon Laws [mailto:simonsl...@googlemail.com]
Sent: 18 May 2010 12:56
To: user@tuscany.apache.org
Subject: Re: Problem calling to an external web service.

On Tue, May 18, 2010 at 12:25 PM, Gregor Kiddie
<gregor.kid...@channeladvisor.com> wrote:
I'm trying to make a call from Tuscany to an external webservice. I think I
have it set up correctly, but it gives the same error each time. It's
running in a Tomcat Container.



The error I'm getting is



Caused by: org.osoa.sca.ServiceRuntimeException: No runtime wire is
available

                at
org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:186)

and my composite looks like this



<?xml version="1.0" encoding="UTF-8"?>

<composite xmlns="http://www.osoa.org/xmlns/sca/1.0";

            targetNamespace="com.mycompany.myproduct.mymodule"

            name="mymodule">



      <component name="MyModule">

            <implementation.spring
location="WEB-INF/classes/applicationContext.xml" />

            <service name="MyService">

                  <binding.ws />

            </service>

      </component>



      <reference name="myServiceProvider">

            <interface.java
interface="com.mycompany.soa.webservices.SuperServiceSkeletonInterface" />

            <binding.ws
uri="http://soa.0002.dev.mycompany.com/SuperFacility/SuperService.asmx"; />

      </reference>

</composite>



Any suggestions?
Hi

Try putting the reference inside the component, for example,

     <component name="MyModule">
           <implementation.spring
location="WEB-INF/classes/applicationContext.xml" />
           <service name="MyService">
                 <binding.ws />
           </service>
          <reference name="myServiceProvider">
               <interface.java
interface="com.mycompany.soa.webservices.SuperServiceSkeletonInterface"
/>
               <binding.ws
uri="http://soa.0002.dev.mycompany.com/SuperFacility/SuperService.asmx";
/>
          </reference>
     </component>

I'm assuming that you're Spring context defines a reference property
called "myServiceProvider". You can of course put references at the
composite level but they should refer to a component reference that
they promote using the the "promote" attribute.

Regards

Simon

Yeah, the applicationContext looks like this

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans";
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
      xmlns:sca="http://www.springframework.org/schema/sca";
      xsi:schemaLocation="
          http://www.springframework.org/schema/beans
          http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
          http://www.springframework.org/schema/sca
          http://www.osoa.org/xmlns/sca/1.0/spring-sca.xsd";>

       <bean id="MyModuleBean" 
class="com.mycompany.myproduct.mymodule.impl.DefaultImplementation">
               <property name="myServiceProvider" ref="myServiceProvider" />
       </bean>
</beans>

Putting the reference in the component and removing the property set in the 
applicationContext throws an error on start up

Caused by: org.apache.tuscany.sca.monitor.MonitorRuntimeException: Reference 
not found for component reference: Component = MyModule Reference = 
myServiceProvider


--
Apache Tuscany committer: tuscany.apache.org
Co-author of a book about Tuscany and SCA: tuscanyinaction.com

It's because SCA it looking for a property that it can map to the SCA
reference. In doing this it looks for Spring properties that
themselves don't have references. Can you try taking the
ref="myServiceProvider"  annotation off the Spring property and see
what happens.

Regards

Simon

No annotations other than SCA ones. Spring is purely XML driven.

Taking the <property... /> out of the bean definition gives the same error.

--
Apache Tuscany committer: tuscany.apache.org
Co-author of a book about Tuscany and SCA: tuscanyinaction.com


Oops sorry I used the word annotation when I meant to say attribute.
Can you change

<property name="myServiceProvider" ref="myServiceProvider" />

to be

<property name="myServiceProvider" />

Simon

Same error. I'm deleting the web app, rebuilding and redeploying each time as 
well to make sure it's starting correctly.


Gregor,

What is the type of the "myServiceProvider" property in the com.mycompany.myproduct.mymodule.impl.DefaultImplementation class?

For the bean property to be recognised as an SCA reference, the type must be an 
interface class.

If the type is not an interface class, you will need to add an <sca:reference/> element into your application context, along these lines:

<beans>

   <!-- An explicit reference, which is used by bean "Y" -->
   <sca:reference name=”SCAReference” type="com.xyz.SomeType"/>

        <bean name="X">
           <property name="foo" ref="Y"/>
        </bean>

        <bean name="Y">
           <property name="bar" ref="SCAReference"/>
           <property name="goo" ref="sca-property-name"/>
        </bean>

   <!-- expose an SCA property named “sca-property-name” -->
   <sca:property name="sca-property-name" type="java.lang.String"/>

   <!-- Expose the bean "X" as an SCA service named "SCAService" -->
   <sca:service name="SCAService" type="org.xyz.someapp.SomeInterface" 
target="X"/>

</beans>


Yours,  Mike.

Reply via email to