Presto.Connection.request idiosynchracies...

michael.rollins
michael.rollins's picture
User offline. Last seen 1 year 41 weeks ago. Offline
Joined: 01/07/2009
Points: 231

I'm attempting to connect directly to a web service from JavaScript using the Presto.Connection object provided by presto-connect.js.  The web service I'm connecting to is a charting web service which returns a chart image.  Part of its input is a list of objects which contain the actual point data for the graph. 

Here's the connection object that I create:

<code>

var connection = new Presto.Connection({
        prestoUrl: 'http://localhost:8080/presto'
    });

</code>

Here's the actual request object that I create:

<code>

var request = {
        "sid": "ChartWebService",
        "oid": "getBarChart",
        "params": [{
            "chartTitle": "myChart",
            "domainTitle": "domain",
            "rangeTitle": "range",
            "isVerticalOrientation": "true",
            "showLegend": "true",
            "width": "300",
            "height": "300",
            "dataset": [{
                "value": "10",
                "category": "foo",
                "column": "column1"
            },{
                "value": "20",
                "category": "foo",
                "column": "column2"
            },{
                "value": "30",
                "category": "foo",
                "column": "column3"
            }]
        }]
    }

</code>

 

I'm having a problem with the dataset.  Specifically, only the first value of the array is being transmitted to the web service (resulting in a graph of only one value).  How can I get Presto to transmit the entire array to the web service?

0
Your rating: None
ivan_mejia
ivan_mejia's picture
User offline. Last seen 8 weeks 5 days ago. Offline
Joined: 09/22/2008
Points: 0

 Michael,

     Are you invoking a WSDL Webservice, if so, can you share the WSDL file?

Ivan.

michael.rollins
michael.rollins's picture
User offline. Last seen 1 year 41 weeks ago. Offline
Joined: 01/07/2009
Points: 231

Here is the WSDL.  It was auto-generated using JBoss 4.2.3 and the native web stack that comes with that platform.

<?xml version="1.0" encoding="UTF-8"?>
<definitions name="ChartService" targetNamespace="http://org.casm.ws/gadget/chart" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://org.casm.ws/gadget/chart" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
  <types>
    <xs:schema targetNamespace="http://org.casm.ws/gadget/chart" version="1.0" xmlns:tns="http://org.casm.ws/gadget/chart" xmlns:xs="http://www.w3.org/2001/XMLSchema">
   <xs:element name="getBarChart" nillable="true" type="tns:barChartRequest"/>
   <xs:element name="getBarChartResponse" nillable="true" type="tns:chartResponse"/>
   <xs:element name="getLineChart" nillable="true" type="tns:barChartRequest"/>
   <xs:element name="getLineChartResponse" nillable="true" type="tns:chartResponse"/>
   <xs:element name="getPieChart" nillable="true" type="tns:pieChartRequest"/>
   <xs:element name="getPieChartResponse" nillable="true" type="tns:chartResponse"/>
   <xs:complexType name="barChartRequest">
    <xs:sequence>
     <xs:element minOccurs="0" name="chartTitle" type="xs:string"/>
     <xs:element minOccurs="0" name="domainTitle" type="xs:string"/>
     <xs:element minOccurs="0" name="rangeTitle" type="xs:string"/>
     <xs:element name="isVerticalOrientation" type="xs:boolean"/>
     <xs:element name="showLegend" type="xs:boolean"/>
     <xs:element name="width" type="xs:int"/>
     <xs:element name="height" type="xs:int"/>
     <xs:element maxOccurs="unbounded" minOccurs="0" name="dataset" nillable="true" type="tns:categoryDatasetEntry"/>
    </xs:sequence>
   </xs:complexType>
   <xs:complexType name="categoryDatasetEntry">
    <xs:sequence>
     <xs:element minOccurs="0" name="category" type="xs:string"/>
     <xs:element minOccurs="0" name="column" type="xs:string"/>
     <xs:element name="value" type="xs:double"/>
    </xs:sequence>
   </xs:complexType>
   <xs:complexType name="chartResponse">
    <xs:sequence>
     <xs:element minOccurs="0" name="chart" type="xs:base64Binary"/>
    </xs:sequence>
   </xs:complexType>
   <xs:complexType name="pieChartRequest">
    <xs:sequence>
     <xs:element minOccurs="0" name="chartTitle" type="xs:string"/>
     <xs:element maxOccurs="unbounded" minOccurs="0" name="dataset" nillable="true" type="tns:pieChartDatasetEntry"/>
     <xs:element name="height" type="xs:int"/>
     <xs:element name="showLegend" type="xs:boolean"/>
     <xs:element name="width" type="xs:int"/>
    </xs:sequence>
   </xs:complexType>
   <xs:complexType name="pieChartDatasetEntry">
    <xs:sequence>
     <xs:element minOccurs="0" name="title" type="xs:string"/>
     <xs:element name="value" type="xs:double"/>
    </xs:sequence>
   </xs:complexType>
  </xs:schema>
  </types>
  <message name="Chart_getPieChartResponse">
    <part name="getPieChartResponse" element="tns:getPieChartResponse">
    </part>
  </message>
  <message name="Chart_getLineChart">
    <part name="getLineChart" element="tns:getLineChart">
    </part>
  </message>
  <message name="Chart_getLineChartResponse">
    <part name="getLineChartResponse" element="tns:getLineChartResponse">
    </part>
  </message>
  <message name="Chart_getBarChartResponse">
    <part name="getBarChartResponse" element="tns:getBarChartResponse">
    </part>
  </message>
  <message name="Chart_getBarChart">
    <part name="getBarChart" element="tns:getBarChart">
    </part>
  </message>
  <message name="Chart_getPieChart">
    <part name="getPieChart" element="tns:getPieChart">
    </part>
  </message>
  <portType name="Chart">
    <operation name="getBarChart" parameterOrder="getBarChart">
      <input message="tns:Chart_getBarChart">
    </input>
      <output message="tns:Chart_getBarChartResponse">
    </output>
    </operation>
    <operation name="getLineChart" parameterOrder="getLineChart">
      <input message="tns:Chart_getLineChart">
    </input>
      <output message="tns:Chart_getLineChartResponse">
    </output>
    </operation>
    <operation name="getPieChart" parameterOrder="getPieChart">
      <input message="tns:Chart_getPieChart">
    </input>
      <output message="tns:Chart_getPieChartResponse">
    </output>
    </operation>
  </portType>
  <binding name="ChartBinding" type="tns:Chart">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <operation name="getBarChart">
      <soap:operation soapAction="URN:GetBarChart"/>
      <input>
        <soap:body use="literal"/>
      </input>
      <output>
        <soap:body use="literal"/>
      </output>
    </operation>
    <operation name="getLineChart">
      <soap:operation soapAction="URN:GetLineChart"/>
      <input>
        <soap:body use="literal"/>
      </input>
      <output>
        <soap:body use="literal"/>
      </output>
    </operation>
    <operation name="getPieChart">
      <soap:operation soapAction="URN:GetPieChart"/>
      <input>
        <soap:body use="literal"/>
      </input>
      <output>
        <soap:body use="literal"/>
      </output>
    </operation>
  </binding>
  <service name="ChartService">
    <port name="ChartPort" binding="tns:ChartBinding">
      <soap:address location="http://127.0.0.1:8080/ChartWebService/ChartService"/>
    </port>
  </service>
</definitions>

 

rrickell
rrickell's picture
User offline. Last seen 27 weeks 5 days ago. Offline
Joined: 04/14/2009
Points: 30

Hi,

I too need the ability to pass tables as input parameters in javascript to a web service.  Has a example of this ever been posted on MDC?

Thanks, Ray