Hello friends,

How can I return a Data Object to the client side?
I am using the SDO_DAS_XML to create the data object but I cannot send
to the client the correct object.

I have tried this example (and a lot others):
http://www.ibm.com/developerworks/web/library/ws-soa-scasdo/index.html

My service file:
<?php
include "SCA/SCA.php";

/**
 * @service
 * @binding.soap
 *
 * @location http://mydomain.com/SOA/Weather/WeatherService.php
 * @types http://Weather http://mydomain.com/SOA/Weather/AreasTypes.xsd
 * @types http://Weather http://mydomain.com/SOA/Weather/TemperaturesTypes.xsd
 */
class WeatherService {
        /**
     * @param Areas $Areas http://Weather
     * @return Temperatures http://Weather
     */
    public function getTemperature($Areas) {
        $Temperatures = SCA::createDataObject('http://Weather',
'Temperatures');
        $Pair = $Temperatures->createDataObject('entry');
        $Pair->state = 'CA';
        $Pair->temperature = 65;
        $Pair = $Temperatures->createDataObject('entry');
        $Pair->state = 'UT';
        $Pair->temperature = 105;
        $Pair = $Temperatures->createDataObject('entry');
        $Pair->state = 'ND';
        $Pair->temperature = -20;
        return $Temperatures;
    }
}
?>

My client file:
<?php
include "SCA/SCA.php";

$weather = SCA::getService('http://mydomain.com/SOA/Weather/
WeatherService.php');

$Areas = $weather->createDataObject('http://Weather','Areas');
$area = $Areas->createDataObject('area');
$area->state = 'CA';
$area = $Areas->createDataObject('area');
$area->state = 'UT';
$area = $Areas->createDataObject('area');
$area->state = 'ND';
$Temperatures = $weather->getTemperature($Areas);

echo "Received temperatures from Web service:<br>";
foreach($Temperatures->entry as $Pair)
    echo $Pair->state . ": " . $Pair->temperature . "<br>";
?>

The AreasTypes.xsd:
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
targetNamespace="http://Weather"; elementFormDefault="qualified">
        <complexType name="StateType">
                <sequence>
                        <element name="state" type="string"/>
                </sequence>
        </complexType>
        <element name="Areas">
                <complexType>
                        <sequence>
                                <element name="area" type="ns1:StateType" 
maxOccurs="unbounded"/>
                        </sequence>
                </complexType>
        </element>
</schema>

The TemperaturesTypes.xsd:
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
targetNamespace="http://Weather"; elementFormDefault="qualified">
        <complexType name="PairType">
                <sequence>
                        <element name="state" type="string"/>
                        <element name="temperature" type="float"/>
                </sequence>
        </complexType>
        <element name="Temperatures">
                <complexType>
                        <sequence>
                                <element name="entry" type="ns1:PairType" 
maxOccurs="unbounded"/>
                        </sequence>
                </complexType>
        </element>
</schema>

The WSDL file:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:tns2="http://WeatherService";
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; xmlns:soap="http://
schemas.xmlsoap.org/wsdl/soap/" xmlns:xsi="http://www.w3.org/2001/
XMLSchema-instance" targetNamespace="http://WeatherService";>
  <wsdl:types>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
      xmlns:ns0="http://Weather";
      xmlns:ns1="http://Weather";
      targetNamespace="http://WeatherService";
      elementFormDefault="qualified">
      <xs:import schemaLocation="http://mydomain.com/SOA/Weather/
AreasTypes.xsd" namespace="http://Weather"/>
      <xs:import schemaLocation="http://mydomain.com/SOA/Weather/
TemperaturesTypes.xsd" namespace="http://Weather"/>
      <xs:element name="getTemperature">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="Areas" type="ns1:Areas"/>

          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="getTemperatureResponse">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="getTemperatureReturn"
type="ns1:Temperatures"/>
          </xs:sequence>
        </xs:complexType>

      </xs:element>
    </xs:schema>
  </wsdl:types>

  <wsdl:message name="getTemperatureRequest">
    <wsdl:part name="getTemperatureRequest"
element="tns2:getTemperature"/>
  </wsdl:message>
  <wsdl:message name="getTemperatureResponse">
    <wsdl:part name="return" element="tns2:getTemperatureResponse"/>

  </wsdl:message>
  <wsdl:portType name="WeatherServicePortType">
    <wsdl:operation name="getTemperature">
      <wsdl:input message="tns2:getTemperatureRequest"/>
      <wsdl:output message="tns2:getTemperatureResponse"/>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="WeatherServiceBinding"
type="tns2:WeatherServicePortType">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http";
style="document"/>

    <wsdl:operation name="getTemperature">
      <soap:operation soapAction=""/>
      <wsdl:input>
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>

  </wsdl:binding>
  <wsdl:service name="WeatherServiceService">
    <wsdl:port name="WeatherServicePort"
binding="tns2:WeatherServiceBinding">
      <soap:address location="http://mydomain.com/SOA/Weather/
WeatherService.php"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

<!-- this line identifies this file as WSDL generated by SCA for PHP.
Do not remove -->


Can you tell me what I am doing wrong?

The next question is: How can I create a dynamic data object returning
to the client a list of some information?

Thank you guys!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"phpsoa" group.
To post to this group, send email to phpsoa@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.co.uk/group/phpsoa?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to