Hi.

The tutorial shows, among other things, how you can reference a web service in an SCA application, starting from the WSDL only.
I thought that was what you wanted to do. Sorry if I made a mistake. :)

Regarding the WSDL you attached below, it is invalid.
I got the same error with Tuscany 1.4. You can try to validate it with Eclipse tools, you will see. And this is why you can't use any WSDL2Java libraries.
There is an empty import and an XML schema with no target namespace.
I think the version 2.0 M1 fix that (but I'm not sure).

The correct WSDL for your service is :

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="CalculatorServiceService" targetNamespace="http://server.tuscany.telvent.com/" xmlns:tns="http://server.tuscany.telvent.com/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:SOAP="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:SOAP11="http://schemas.xmlsoap.org/wsdl/soap/">
  <wsdl:types>
    <xs:schema attributeFormDefault="qualified" elementFormDefault="unqualified" targetNamespace="http://server.tuscany.telvent.com/" xmlns:xs="http://www.w3.org/2001/XMLSchema"><xs:element name="multiply"><xs:complexType><xs:sequence><xs:element minOccurs="0" name="arg0" type="xs:double"/><xs:element minOccurs="0" name="arg1" type="xs:double"/></xs:sequence></xs:complexType></xs:element><xs:element name="divide"><xs:complexType><xs:sequence><xs:element minOccurs="0" name="arg0" type="xs:double"/><xs:element minOccurs="0" name="arg1" type="xs:double"/></xs:sequence></xs:complexType></xs:element><xs:element name="add"><xs:complexType><xs:sequence><xs:element minOccurs="0" name="arg0" type="xs:double"/><xs:element minOccurs="0" name="arg1" type="xs:double"/></xs:sequence></xs:complexType></xs:element><xs:element name="divideResponse"><xs:complexType><xs:sequence><xs:element minOccurs="0" name="return" type="xs:double"/></xs:sequence></xs:complexType></xs:element><xs:element name="subtractResponse"><xs:complexType><xs:sequence><xs:element minOccurs="0" name="return" type="xs:double"/></xs:sequence></xs:complexType></xs:element><xs:element name="subtract"><xs:complexType><xs:sequence><xs:element minOccurs="0" name="arg0" type="xs:double"/><xs:element minOccurs="0" name="arg1" type="xs:double"/></xs:sequence></xs:complexType></xs:element><xs:element name="addResponse"><xs:complexType><xs:sequence><xs:element minOccurs="0" name="return" type="xs:double"/></xs:sequence></xs:complexType></xs:element><xs:element name="getPersona"><xs:complexType/></xs:element><xs:element name="multiplyResponse"><xs:complexType><xs:sequence><xs:element minOccurs="0" name="return" type="xs:double"/></xs:sequence></xs:complexType></xs:element><xs:element name="getPersonaResponse"><xs:complexType><xs:sequence><xs:element minOccurs="0" name="return" nillable="true" type="persona"/></xs:sequence></xs:complexType></xs:element>
<xs:complexType name="persona"><xs:sequence><xs:element minOccurs="0" name="altura" type="xs:int"/><xs:element name="edad" type="xs:int"/><xs:element minOccurs="0" name="name" type="xs:string"/></xs:sequence></xs:complexType>
</xs:schema>
  </wsdl:types>
  <wsdl:message name="multiply">
    <wsdl:part name="multiply" element="tns:multiply">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="divide">
    <wsdl:part name="divide" element="tns:divide">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="add">
    <wsdl:part name="add" element="tns:add">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="divideResponse">
    <wsdl:part name="divideResponse" element="tns:divideResponse">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="subtractResponse">
    <wsdl:part name="subtractResponse" element="tns:subtractResponse">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="subtract">
    <wsdl:part name="subtract" element="tns:subtract">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="addResponse">
    <wsdl:part name="addResponse" element="tns:addResponse">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="getPersona">
    <wsdl:part name="getPersona" element="tns:getPersona">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="multiplyResponse">
    <wsdl:part name="multiplyResponse" element="tns:multiplyResponse">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="getPersonaResponse">
    <wsdl:part name="getPersonaResponse" element="tns:getPersonaResponse">
    </wsdl:part>
  </wsdl:message>
  <wsdl:portType name="CalculatorService">
    <wsdl:operation name="getPersona">
      <wsdl:input message="tns:getPersona">
    </wsdl:input>
      <wsdl:output message="tns:getPersonaResponse">
    </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="add">
      <wsdl:input message="tns:add">
    </wsdl:input>
      <wsdl:output message="tns:addResponse">
    </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="subtract">
      <wsdl:input message="tns:subtract">
    </wsdl:input>
      <wsdl:output message="tns:subtractResponse">
    </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="divide">
      <wsdl:input message="tns:divide">
    </wsdl:input>
      <wsdl:output message="tns:divideResponse">
    </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="multiply">
      <wsdl:input message="tns:multiply">
    </wsdl:input>
      <wsdl:output message="tns:multiplyResponse">
    </wsdl:output>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="CalculatorServiceBinding" type="tns:CalculatorService">
    <SOAP:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="getPersona">
      <SOAP:operation/>
      <wsdl:input>
        <SOAP:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <SOAP:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="add">
      <SOAP:operation/>
      <wsdl:input>
        <SOAP:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <SOAP:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="subtract">
      <SOAP:operation/>
      <wsdl:input>
        <SOAP:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <SOAP:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="divide">
      <SOAP:operation/>
      <wsdl:input>
        <SOAP:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <SOAP:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="multiply">
      <SOAP:operation/>
      <wsdl:input>
        <SOAP:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <SOAP:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="CalculatorServiceService">
    <wsdl:port name="CalculatorServicePort" binding="tns:CalculatorServiceBinding">
      <SOAP:address location="http://192.168.3.15:8085/CalculatorServiceComponent"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

And it then should work.

Regards,

                Vincent.




santiago.ara...@telvent.com a écrit :

Hi.
Tutorial is very interesting but I can not find the specific example for my problem. I want to develop a client that connects with the SCA Calculator. The example from  http://wiki.eclipse.org/images/7/72/EclipseCON_2009_SOA_Tutorial_Toward---SCA.pdf connects using a RMI binding. This client needs to know the interface from the service that it will  be consumed (GlobalWeatherService). It needs the same java code in the client side.

I want an independent client that didn't know java code from SCA Calculator. You can imagine that I haven't developed the SCA Calculator but  WSDL contract is published in internet.
I only knew the WSDL contract generated by Tuscany. But the problem is that I have an error when I am using WSDL2Java. Person class can not be found.


Thank you very much

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="CalculatorServiceService" targetNamespace="http://server.tuscany.telvent.com/" xmlns:tns="http://server.tuscany.telvent.com/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:SOAP="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:SOAP11="http://schemas.xmlsoap.org/wsdl/soap/">
  <wsdl:types>
    <xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="persona"><xs:sequence><xs:element minOccurs="0" name="altura" type="xs:int"/><xs:element name="edad" type="xs:int"/><xs:element minOccurs="0" name="name" type="xs:string"/></xs:sequence></xs:complexType>
</xs:schema>
    <xs:schema attributeFormDefault="qualified" elementFormDefault="unqualified" targetNamespace="http://server.tuscany.telvent.com/" xmlns:xs="http://www.w3.org/2001/XMLSchema"><xs:import/><xs:element name="multiply"><xs:complexType><xs:sequence><xs:element minOccurs="0" name="arg0" type="xs:double"/><xs:element minOccurs="0" name="arg1" type="xs:double"/></xs:sequence></xs:complexType></xs:element><xs:element name="divide"><xs:complexType><xs:sequence><xs:element minOccurs="0" name="arg0" type="xs:double"/><xs:element minOccurs="0" name="arg1" type="xs:double"/></xs:sequence></xs:complexType></xs:element><xs:element name="add"><xs:complexType><xs:sequence><xs:element minOccurs="0" name="arg0" type="xs:double"/><xs:element minOccurs="0" name="arg1" type="xs:double"/></xs:sequence></xs:complexType></xs:element><xs:element name="divideResponse"><xs:complexType><xs:sequence><xs:element minOccurs="0" name="return" type="xs:double"/></xs:sequence></xs:complexType></xs:element><xs:element name="subtractResponse"><xs:complexType><xs:sequence><xs:element minOccurs="0" name="return" type="xs:double"/></xs:sequence></xs:complexType></xs:element><xs:element name="subtract"><xs:complexType><xs:sequence><xs:element minOccurs="0" name="arg0" type="xs:double"/><xs:element minOccurs="0" name="arg1" type="xs:double"/></xs:sequence></xs:complexType></xs:element><xs:element name="addResponse"><xs:complexType><xs:sequence><xs:element minOccurs="0" name="return" type="xs:double"/></xs:sequence></xs:complexType></xs:element><xs:element name="getPersona"><xs:complexType/></xs:element><xs:element name="multiplyResponse"><xs:complexType><xs:sequence><xs:element minOccurs="0" name="return" type="xs:double"/></xs:sequence></xs:complexType></xs:element><xs:element name="getPersonaResponse"><xs:complexType><xs:sequence><xs:element minOccurs="0" name="return" nillable="true" type="persona"/></xs:sequence></xs:complexType></xs:element></xs:schema>
  </wsdl:types>
  <wsdl:message name="multiply">
    <wsdl:part name="multiply" element="tns:multiply">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="divide">
    <wsdl:part name="divide" element="tns:divide">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="add">
    <wsdl:part name="add" element="tns:add">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="divideResponse">
    <wsdl:part name="divideResponse" element="tns:divideResponse">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="subtractResponse">
    <wsdl:part name="subtractResponse" element="tns:subtractResponse">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="subtract">
    <wsdl:part name="subtract" element="tns:subtract">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="addResponse">
    <wsdl:part name="addResponse" element="tns:addResponse">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="getPersona">
    <wsdl:part name="getPersona" element="tns:getPersona">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="multiplyResponse">
    <wsdl:part name="multiplyResponse" element="tns:multiplyResponse">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="getPersonaResponse">
    <wsdl:part name="getPersonaResponse" element="tns:getPersonaResponse">
    </wsdl:part>
  </wsdl:message>
  <wsdl:portType name="CalculatorService">
    <wsdl:operation name="getPersona">
      <wsdl:input message="tns:getPersona">
    </wsdl:input>
      <wsdl:output message="tns:getPersonaResponse">
    </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="add">
      <wsdl:input message="tns:add">
    </wsdl:input>
      <wsdl:output message="tns:addResponse">
    </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="subtract">
      <wsdl:input message="tns:subtract">
    </wsdl:input>
      <wsdl:output message="tns:subtractResponse">
    </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="divide">
      <wsdl:input message="tns:divide">
    </wsdl:input>
      <wsdl:output message="tns:divideResponse">
    </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="multiply">
      <wsdl:input message="tns:multiply">
    </wsdl:input>
      <wsdl:output message="tns:multiplyResponse">
    </wsdl:output>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="CalculatorServiceBinding" type="tns:CalculatorService">
    <SOAP:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="getPersona">
      <SOAP:operation/>
      <wsdl:input>
        <SOAP:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <SOAP:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="add">
      <SOAP:operation/>
      <wsdl:input>
        <SOAP:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <SOAP:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="subtract">
      <SOAP:operation/>
      <wsdl:input>
        <SOAP:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <SOAP:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="divide">
      <SOAP:operation/>
      <wsdl:input>
        <SOAP:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <SOAP:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="multiply">
      <SOAP:operation/>
      <wsdl:input>
        <SOAP:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <SOAP:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="CalculatorServiceService">
    <wsdl:port name="CalculatorServicePort" binding="tns:CalculatorServiceBinding">
      <SOAP:address location="http://192.168.3.15:8085/CalculatorServiceComponent"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>


Un saludo.
Santiago Miguel Aranda Rojas
Telvent Interactiva
Extension: 35999



Vincent Zurczak <vincent.zurc...@ebmwebsourcing.com>
Vincent Zurczak
30/03/2009 15:44
Por favor, responda a user
Para: user@tuscany.apache.org
cc:
Asunto: Re: Generating code from WSDL using WSDL2Java




Hi.

The Eclipse SCA Tools provide some features to allow you to simply call a web service in an SCA application.
It does not work with specific message structures, but your case seems pretty simple and it should work without any problem.

Basically, it generates you a WS client and then cleans up the code to remove all the unrequired elements.
This approach has already been tested with Tuscany 1.4 and it was even part of the SOA tutorial that was presented last week at EclipseCON.

You can find an example on the SCA Tools wiki [0].
The tutorial itself is available here [1]. Check the pages 9 and 10 in particular.

It shows in details how you can call a web service from an SCA application in few clicks (no need to create another SCA application).
There will be another tutorial soon on the STP wiki, to show how you can use JAX-B for more complex referenced web services.

Regards,

                   Vincent Zurczak.



[0] :
http://wiki.eclipse.org/STP/SCA_Component
[1] :
http://wiki.eclipse.org/images/7/72/EclipseCON_2009_SOA_Tutorial_Toward---SCA.pdf




santiago.ara...@telvent.com a écrit :

I have running Calculator sample included in apache-tuscany-sca-all-2.0-M1. I have added a new component to this composite service. This is called GetPersonaService. It only has a method "getPersona" that returns an object "Person". It is a complex type with three attributes , age, name, height.  I am publishing this component with my CalculatorService like Web Service.




   
<component name="CalculatorServiceComponent">
               
<implementation.java class="com.telvent.tuscany.server.CalculatorServiceImpl"/>
               
       
<service name="CalculatorService">
           
<binding.ws uri="http://localhost:8085/CalculatorServiceComponent"/>
       
</service>
        <
reference name="getPersonaService" target="GetPersonaServiceComponent"/>      
    </
component>


   
<component name="GetPersonaServiceComponent">
       
<implementation.java class="com.telvent.tuscany.server.GetPersonaServiceImpl"/>
   
</component>
...


I have done another little SCA application that is connecting to Web Service and using its funcionality. It works. I mean I can access to "getPersona" method through its WebService. Problem is client application need to know Persona class. It is necessary to have a copy of "Person.java" in the new bundle.


   <
component name="CalculatorClient">
               
<implementation.java class="com.telvent.tuscany.server.CalculatorClient"/>
       
<reference name="calculatorService">
               
<binding.ws uri="http://localhost:8085/CalculatorServiceComponent"/>
       
</reference>
   
</component>


But I want to connect to the Web service using a little client application that is not SCA. I mean it  haven´t developed using Tuscany. I followed this Steps.


* I ran SCA CalculatorService.
* I stored generated WSDL .

* I am trying generate client code using WSDL2Java but I obtain this error --> org.apache.axis2.SchemaCompiler findClassName.  Type persona missing!


When I run this client (with this autogenerated code) I can acess to methods that return primitive types values (int, double... add method for example). But the getPersona method that return a complex type Person is not working. I have seen that autogenerated code does not contain code for recovering of age, name, height attributes.


What can I do?


Thanks in advance


Un saludo.
Santiago Miguel Aranda Rojas
Telvent Interactiva
Extension: 35999


-- 
Vincent Zurczak
EBM WebSourcing
+33 (0) 4 38 12 16 77


Reply via email to