web service

B

Brock

I have a classic textbook example of consuming a Web service. I'm
using Visual Web Developer Express 2008 v9. I have a textbox, a
listbox, and a button on my .aspx form. I'm trying to use the
http://developer.capeclear.com/files/GlobalWeather.wsdl as my Web
reference which looks good so far. But my code has some what will
assurably be obvious flaws to many. You can see the WSDL at the above
link. The method in that I am trying to use is "searchByCode"... so I
would of course enter an airport code like "LAX" and get weather for
Los Angeles. The following code needs some help. the compiler doesn't
like the item "textCode" below and it's saying that all the "ws." 's
are not declared. Anyone? THANKS!!

<script runat="server">

Private Sub btnGetSummary_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnGetSummary.Click
Dim aw As com.capeclear.developer.WeatherReport = New
com.capeclear.developer.WeatherReport()
Dim ws As
com.capeclear.developer.getWeatherReport(txtCode.Text)
With lbResults.Items
.Clear()
.Add("Visibility: " & ws.visibility)
.Add("Temperature: " & ws.temperature)
.Add("Winds: " & ws.winds)
.Add("Precipitation: " & ws.precipitation)
.Add("Sky: " & ws.sky)
.Add("Pressure: " & ws.pressure)
End With
End Sub

</script>
 
D

daveh551

I have a classic textbook example of consuming a Web service. I'm
using Visual Web Developer Express 2008 v9. I have a textbox, a
listbox, and a button on my .aspx form. I'm trying to use thehttp://developer.capeclear.com/files/GlobalWeather.wsdlas my Web
reference which looks good so far. But my code has some what will
assurably be obvious flaws to many. You can see the WSDL at the above
link. The method in that I am trying to use is "searchByCode"... so I
would of course enter an airport code like "LAX" and get weather for
Los Angeles. The following code needs some help. the compiler doesn't
like the item "textCode" below and it's saying that all the "ws." 's
are not declared. Anyone? THANKS!!

<script runat="server">

    Private Sub btnGetSummary_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnGetSummary.Click
        Dim aw As com.capeclear.developer.WeatherReport = New
com.capeclear.developer.WeatherReport()
        Dim ws As
com.capeclear.developer.getWeatherReport(txtCode.Text)
        With lbResults.Items
            .Clear()
            .Add("Visibility: " & ws.visibility)
            .Add("Temperature: " & ws.temperature)
            .Add("Winds: " & ws.winds)
            .Add("Precipitation: " & ws.precipitation)
            .Add("Sky: " & ws.sky)
            .Add("Pressure: " & ws.pressure)
        End With
    End Sub

</script>

It look to me like you have "Dim ws As <a method invocation>" where
what you want, I think, is "Dim ws As <a type> = <a method
invocation>"

In other words, what is the object type returned by
com.capeclear.developer.getWeatherReport(txtCode.Text) ? you need ws
declared to be that type before you can invoke the getWeatherReport()
method.
 
B

Brock

I checked through the WSDL below but I'm not following what I should
do.
Something like this?: Dim ws As String() =
<someMethod>(txtCode.Text)

<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://
www.capeclear.com/globalweather/wsdl/" xmlns:xsd="http://www.w3.org/
2001/XMLSchema" xmlns:xsd1="http://www.capeclear.com/globalweather/
xsd/" xmlns="http://schemas.xmlsoap.org/wsdl/" name="GlobalWeather"
targetNamespace="http://www.capeclear.com/globalweather/wsdl/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<xsd:schema attributeFormDefault="unqualified"
elementFormDefault="qualified" targetNamespace="http://
www.capeclear.com/globalweather/xsd/">
<xsd:element name="getStation">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="code" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="getStationResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="return" type="xsd1:Station" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="getWeatherReport">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="code" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="getWeatherReportResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="return" type="xsd1:WeatherReport" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="isValidCode">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="code" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="isValidCodeResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="return" type="xsd:boolean" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="listCountries">
<xsd:complexType>
<xsd:sequence />
</xsd:complexType>
</xsd:element>
<xsd:element name="listCountriesResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="return" type="xsd1:ArrayOfstring" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="searchByCode">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="code" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="searchByCodeResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="return" type="xsd1:ArrayOfStation" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="searchByCountry">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="country" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="searchByCountryResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="return" type="xsd1:ArrayOfStation" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="searchByLocation">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="latitude" type="xsd1:Range" />
<xsd:element name="longitude" type="xsd1:Range" />
<xsd:element name="elevation" type="xsd1:Range" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="searchByLocationResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="return" type="xsd1:ArrayOfStation" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="searchByName">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="name" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="searchByNameResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="return" type="xsd1:ArrayOfStation" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="searchByRegion">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="region" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="searchByRegionResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="return" type="xsd1:ArrayOfStation" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="ArrayOfExtreme">
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="unbounded"
name="extreme" type="xsd1:Extreme" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="PhenomenonIntensity">
<xsd:complexContent mixed="false">
<xsd:extension base="xsd1:Enum">
<xsd:sequence />
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="Direction">
<xsd:sequence>
<xsd:element minOccurs="0" name="compass"
type="xsd1:DirectionCompass" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="Sky">
<xsd:sequence>
<xsd:element name="ceiling_altitude" type="xsd:double" />
<xsd:element minOccurs="0" name="layers"
type="xsd1:ArrayOfLayer" />
<xsd:element minOccurs="0" name="string" type="xsd:string" / </xsd:sequence>
</xsd:complexType>
<xsd:complexType name="Station">
<xsd:sequence>
<xsd:element minOccurs="0" name="icao" type="xsd:string" />
<xsd:element minOccurs="0" name="wmo" type="xsd:string" />
<xsd:element minOccurs="0" name="iata" type="xsd:string" />
<xsd:element name="elevation" type="xsd:double" />
<xsd:element name="latitude" type="xsd:double" />
<xsd:element name="longitude" type="xsd:double" />
<xsd:element minOccurs="0" name="country" type="xsd:string" / <xsd:element minOccurs="0" name="string" type="xsd:string" / </xsd:sequence>
</xsd:complexType>
<xsd:complexType name="Enum" abstract="true">
<xsd:sequence>
<xsd:element minOccurs="0" name="value" type="xsd:string" />
<xsd:element name="hashCode" type="xsd:int" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="WeatherReport">
<xsd:sequence>
<xsd:element minOccurs="0" name="timestamp"
type="xsd:dateTime" />
<xsd:element minOccurs="0" name="station"
type="xsd1:Station" />
<xsd:element minOccurs="0" name="phenomena"
type="xsd1:ArrayOfPhenomenon" />
<xsd:element minOccurs="0" name="precipitation"
type="xsd1:ArrayOfPrecipitation" />
<xsd:element minOccurs="0" name="extremes"
type="xsd1:ArrayOfExtreme" />
<xsd:element minOccurs="0" name="pressure"
type="xsd1:pressure" />
<xsd:element minOccurs="0" name="sky" type="xsd1:Sky" />
<xsd:element minOccurs="0" name="temperature"
type="xsd1:Temperature" />
<xsd:element minOccurs="0" name="visibility"
type="xsd1:Visibility" />
<xsd:element minOccurs="0" name="wind" type="xsd1:Wind" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="DirectionCompass">
<xsd:complexContent mixed="false">
<xsd:extension base="xsd1:Enum">
<xsd:sequence />
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="Pressure">
<xsd:sequence>
<xsd:element name="altimeter" type="xsd:double" />
<xsd:element name="slp" type="xsd:double" />
<xsd:element name="delta" type="xsd:double" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ExtremeType">
<xsd:complexContent mixed="false">
<xsd:extension base="xsd1:Enum">
<xsd:sequence />
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="Wind">
<xsd:sequence>
<xsd:element name="prevailing_speed" type="xsd:double" />
<xsd:element name="gust_speed" type="xsd:double" />
<xsd:element minOccurs="0" name="prevailing_direction"
type="xsd1:Direction" />
<xsd:element minOccurs="0" name="varying_from_direction"
type="xsd1:Direction" />
<xsd:element minOccurs="0" name="varying_to_direction"
type="xsd1:Direction" />
<xsd:element minOccurs="0" name="string" type="xsd:string" / </xsd:sequence>
</xsd:complexType>
<xsd:complexType name="PhenomenonType">
<xsd:complexContent mixed="false">
<xsd:extension base="xsd1:Enum">
<xsd:sequence />
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="Range">
<xsd:sequence>
<xsd:element name="from" type="xsd:double" />
<xsd:element name="to" type="xsd:double" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ArrayOfPrecipitation">
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="unbounded"
name="precipitation" type="xsd1:precipitation" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="Temperature">
<xsd:sequence>
<xsd:element name="ambient" type="xsd:double" />
<xsd:element name="dewpoint" type="xsd:double" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="Phenomenon">
<xsd:sequence>
<xsd:element minOccurs="0" name="type"
type="xsd1:phenomenonType" />
<xsd:element minOccurs="0" name="intensity"
type="xsd1:phenomenonIntensity" />
<xsd:element minOccurs="0" name="string" type="xsd:string" / </xsd:sequence>
</xsd:complexType>
<xsd:complexType name="Precipitation">
<xsd:sequence>
<xsd:element name="amount" type="xsd:double" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ArrayOfPhenomenon">
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="unbounded"
name="phenomenon" type="xsd1:phenomenon" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="Layer">
<xsd:sequence>
<xsd:element name="altitude" type="xsd:double" />
<xsd:element name="extent" type="xsd:int" />
<xsd:element minOccurs="0" name="type"
type="xsd1:phenomenonType" />
<xsd:element minOccurs="0" name="string" type="xsd:string" / </xsd:sequence>
</xsd:complexType>
<xsd:complexType name="Extreme">
<xsd:sequence>
<xsd:element minOccurs="0" name="temperature"
type="xsd1:Temperature" />
<xsd:element minOccurs="0" name="type"
type="xsd1:ExtremeType" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ArrayOfLayer">
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="unbounded"
name="layer" type="xsd1:Layer" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ArrayOfstring">
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="unbounded" name="item"
type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ArrayOfStation">
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="unbounded"
name="station" type="xsd1:Station" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="Visibility">
<xsd:sequence>
<xsd:element name="distance" type="xsd:double" />
<xsd:element minOccurs="0" name="qualifier"
type="xsd1:VisibilityQualifier" />
<xsd:element minOccurs="0" name="string" type="xsd:string" / </xsd:sequence>
</xsd:complexType>
<xsd:complexType name="VisibilityQualifier">
<xsd:complexContent mixed="false">
<xsd:extension base="xsd1:Enum">
<xsd:sequence />
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:schema>
</wsdl:types>
<wsdl:message name="getWeatherReport">
<wsdl:part name="getWeatherReport"
element="xsd1:getWeatherReport" />
</wsdl:message>
<wsdl:message name="getStationResponse">
<wsdl:part name="getStationResponse"
element="xsd1:getStationResponse" />
</wsdl:message>
<wsdl:message name="listCountries">
<wsdl:part name="listCountries" element="xsd1:listCountries" />
</wsdl:message>
<wsdl:message name="getStation">
<wsdl:part name="getStation" element="xsd1:getStation" />
</wsdl:message>
<wsdl:message name="isValidCodeResponse">
<wsdl:part name="isValidCodeResponse"
element="xsd1:isValidCodeResponse" />
</wsdl:message>
<wsdl:message name="isValidCode">
<wsdl:part name="isValidCode" element="xsd1:isValidCode" />
</wsdl:message>
<wsdl:message name="searchByNameResponse">
<wsdl:part name="searchByNameResponse"
element="xsd1:searchByNameResponse" />
</wsdl:message>
<wsdl:message name="searchByCountryResponse">
<wsdl:part name="searchByCountryResponse"
element="xsd1:searchByCountryResponse" />
</wsdl:message>
</wsdl:message>
<wsdl:message name="searchByName">
<wsdl:part name="searchByName" element="xsd1:searchByName" />
</wsdl:message>
<wsdl:message name="searchByLocation">
<wsdl:part name="searchByLocation"
element="xsd1:searchByLocation" />
</wsdl:message>
<wsdl:message name="searchByRegion">
<wsdl:part name="searchByRegion" element="xsd1:searchByRegion" />
</wsdl:message>
<wsdl:message name="searchByCodeResponse">
<wsdl:part name="searchByCodeResponse"
element="xsd1:searchByCodeResponse" />
</wsdl:message>
<wsdl:message name="searchByRegionResponse">
<wsdl:part name="searchByRegionResponse"
element="xsd1:searchByRegionResponse" />
</wsdl:message>
<wsdl:message name="searchByLocationResponse">
<wsdl:part name="searchByLocationResponse"
element="xsd1:searchByLocationResponse" />
</wsdl:message>
<wsdl:message name="searchByCode">
<wsdl:part name="searchByCode" element="xsd1:searchByCode" />
</wsdl:message>
<wsdl:message name="getWeatherReportResponse">
<wsdl:part name="getWeatherReportResponse"
element="xsd1:getWeatherReportResponse" />
</wsdl:message>
<wsdl:message name="listCountriesResponse">
<wsdl:part name="listCountriesResponse"
element="xsd1:listCountriesResponse" />
</wsdl:message>
<wsdl:portType name="StationInfo">
<wsdl:eek:peration name="getStation">
<wsdl:input message="tns:getStation" />
<wsdl:eek:utput message="tns:getStationResponse" />
</wsdl:eek:peration>
<wsdl:eek:peration name="isValidCode">
<wsdl:input message="tns:isValidCode" />
<wsdl:eek:utput message="tns:isValidCodeResponse" />
</wsdl:eek:peration>
<wsdl:eek:peration name="listCountries">
<wsdl:input message="tns:listCountries" />
<wsdl:eek:utput message="tns:listCountriesResponse" />
</wsdl:eek:peration>
<wsdl:eek:peration name="searchByCode">
<wsdl:input message="tns:searchByCode" />
<wsdl:eek:utput message="tns:searchByCodeResponse" />
</wsdl:eek:peration>
<wsdl:eek:peration name="searchByCountry">
<wsdl:input message="tns:searchByCountry" />
<wsdl:eek:utput message="tns:searchByCountryResponse" />
</wsdl:eek:peration>
<wsdl:eek:peration name="searchByLocation">
<wsdl:input message="tns:searchByLocation" />
<wsdl:eek:utput message="tns:searchByLocationResponse" />
</wsdl:eek:peration>
<wsdl:eek:peration name="searchByName">
<wsdl:input message="tns:searchByName" />
<wsdl:eek:utput message="tns:searchByNameResponse" />
</wsdl:eek:peration>
<wsdl:eek:peration name="searchByRegion">
<wsdl:input message="tns:searchByRegion" />
<wsdl:eek:utput message="tns:searchByRegionResponse" />
</wsdl:eek:peration>
</wsdl:portType>
<wsdl:portType name="GlobalWeather">
<wsdl:eek:peration name="getWeatherReport">
<wsdl:input message="tns:getWeatherReport" />
<wsdl:eek:utput message="tns:getWeatherReportResponse" />
</wsdl:eek:peration>
</wsdl:portType>
<wsdl:binding name="StationInfoBinding" type="tns:StationInfo">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:eek:peration name="getStation">
<soap:eek:peration soapAction="" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:eek:utput>
<soap:body use="literal" />
</wsdl:eek:utput>
</wsdl:eek:peration>
<wsdl:eek:peration name="isValidCode">
<soap:eek:peration soapAction="" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:eek:utput>
<soap:body use="literal" />
</wsdl:eek:utput>
</wsdl:eek:peration>
<wsdl:eek:peration name="listCountries">
<soap:eek:peration soapAction="" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:eek:utput>
<soap:body use="literal" />
</wsdl:eek:utput>
</wsdl:eek:peration>
<wsdl:eek:peration name="searchByCode">
<soap:eek:peration soapAction="" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:eek:utput>
<soap:body use="literal" />
</wsdl:eek:utput>
</wsdl:eek:peration>
<wsdl:eek:peration name="searchByCountry">
<soap:eek:peration soapAction="" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:eek:utput>
<soap:body use="literal" />
</wsdl:eek:utput>
</wsdl:eek:peration>
<wsdl:eek:peration name="searchByLocation">
<soap:eek:peration soapAction="" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:eek:utput>
<soap:body use="literal" />
</wsdl:eek:utput>
</wsdl:eek:peration>
<wsdl:eek:peration name="searchByName">
<soap:eek:peration soapAction="" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:eek:utput>
<soap:body use="literal" />
</wsdl:eek:utput>
</wsdl:eek:peration>
<wsdl:eek:peration name="searchByRegion">
<soap:eek:peration soapAction="" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:eek:utput>
<soap:body use="literal" />
</wsdl:eek:utput>
</wsdl:eek:peration>
</wsdl:binding>
<wsdl:binding name="GlobalWeatherBinding" type="tns:GlobalWeather">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:eek:peration name="getWeatherReport">
<soap:eek:peration soapAction="" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:eek:utput>
<soap:body use="literal" />
</wsdl:eek:utput>
</wsdl:eek:peration>
</wsdl:binding>
<wsdl:service name="GlobalWeather">
<wsdl:port name="GlobalWeather"
binding="tns:GlobalWeatherBinding">
<soap:address location="http://live.capeclear.com/ccx/
GlobalWeather" />
</wsdl:port>
<wsdl:port name="StationInfo" binding="tns:StationInfoBinding">
<soap:address location="http://live.capeclear.com/ccx/
GlobalWeather" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top