You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by Stefan Kolb <st...@web.de> on 2010/01/18 21:25:13 UTC

Binding to external Webservices

Im trying to build a simple Composite that includes a component which uses a reference to invoke an external webservice.

PaymentComposite (Composite) --> CreditCardComponent (Component) --> CreditCardValidation (Reference)

Composite Code:
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="PaymentComposite">

<component name="CreditCardComponent">
      <implementation.java class="implementation.CreditCardPaymentImpl"/>

      	<reference name="CreditCardValidation">
      		<interface.wsdl interface="http://www.webservicex.net#wsdl.interface(CCCheckerSoap)"/>
        	<binding.ws wsdlElement="http://www.webservicex.net#wsdl.port(CCChecker/CCCheckerSoap)" />
   		</reference>
	</component>

</composite>

As an example im using the Creditcard Webservice from webservicex.net.

1. I included the *.wdsl in the root of the project (CreditCard.wsdl).
2. I did a mapping of the *.wsdl to a Java Interface (Is that always necessary? If i want to use it in Java yes?!) -> CreditCard.java

@Remotable
public interface CreditCard {
	public String ValidateCardNumber(String cardType, String cardNumber);
}

3. I injected the Reference in my Impl (CreditCardPaymentImpl)

@Reference
public void setCreditCard(CreditCard creditCard) {
        System.out.println("Injected Service");
        this.creditCard = creditCard;
}

4. Tried to use this scenario in a client class
SCADomain scaDomain = SCADomain.newInstance("PaymentComposite.composite");
CreditCardPayment helloWorldService = scaDomain.getService(CreditCardPayment.class, "CreditCardComponent");
...

But i still get the error
- Reference not found for component reference: Component = CreditCardComponent Reference = CreditCardValidation

What am i doing wrong? I tried to use several things there and ended up totally confused because this trivial looking thing doesnt work :(

Sincerely Stefan


___________________________________________________________
Preisknaller: WEB.DE DSL Flatrate für nur 16,99 Euro/mtl.! 
http://produkte.web.de/go/02/


RE: Binding to external Webservices

Posted by "Hatfield, Dan" <da...@hp.com>.
Based on your examples, it seems like it is probably having trouble lining up interfaces/names...
Have you tried

@Reference(name="CreditCardValidation")

?

________________________________________
From: Stefan Kolb [stefan-kolb@web.de]
Sent: Monday, January 18, 2010 3:25 PM
To: user@tuscany.apache.org
Subject: Binding to external Webservices

Im trying to build a simple Composite that includes a component which uses a reference to invoke an external webservice.

PaymentComposite (Composite) --> CreditCardComponent (Component) --> CreditCardValidation (Reference)

Composite Code:
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="PaymentComposite">

<component name="CreditCardComponent">
      <implementation.java class="implementation.CreditCardPaymentImpl"/>

        <reference name="CreditCardValidation">
                <interface.wsdl interface="http://www.webservicex.net#wsdl.interface(CCCheckerSoap)"/>
                <binding.ws wsdlElement="http://www.webservicex.net#wsdl.port(CCChecker/CCCheckerSoap)" />
                </reference>
        </component>

</composite>

As an example im using the Creditcard Webservice from webservicex.net.

1. I included the *.wdsl in the root of the project (CreditCard.wsdl).
2. I did a mapping of the *.wsdl to a Java Interface (Is that always necessary? If i want to use it in Java yes?!) -> CreditCard.java

@Remotable
public interface CreditCard {
        public String ValidateCardNumber(String cardType, String cardNumber);
}

3. I injected the Reference in my Impl (CreditCardPaymentImpl)

@Reference
public void setCreditCard(CreditCard creditCard) {
        System.out.println("Injected Service");
        this.creditCard = creditCard;
}

4. Tried to use this scenario in a client class
SCADomain scaDomain = SCADomain.newInstance("PaymentComposite.composite");
CreditCardPayment helloWorldService = scaDomain.getService(CreditCardPayment.class, "CreditCardComponent");
...

But i still get the error
- Reference not found for component reference: Component = CreditCardComponent Reference = CreditCardValidation

What am i doing wrong? I tried to use several things there and ended up totally confused because this trivial looking thing doesnt work :(

Sincerely Stefan


___________________________________________________________
Preisknaller: WEB.DE DSL Flatrate für nur 16,99 Euro/mtl.!
http://produkte.web.de/go/02/