Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7187157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:47:02+00:00 2026-05-28T18:47:02+00:00

I would like to learn the basic usage of SOAP through this ( weather

  • 0

I would like to learn the basic usage of SOAP through this (weather) example.
How is it worthy to process this data?

Request:

POST /globalweather.asmx HTTP/1.1
Host: www.webservicex.net
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <GetWeather xmlns="http://www.webserviceX.NET">
      <CityName>string</CityName>
      <CountryName>string</CountryName>
    </GetWeather>
  </soap12:Body>
</soap12:Envelope>
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length

Response:

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <GetWeatherResponse xmlns="http://www.webserviceX.NET">
      <GetWeatherResult>string</GetWeatherResult>
    </GetWeatherResponse>
  </soap12:Body>
</soap12:Envelope>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T18:47:02+00:00Added an answer on May 28, 2026 at 6:47 pm

    The most simple approach would be:

    $requestParams = array(
        'CityName' => 'Berlin',
        'CountryName' => 'Germany'
    );
    
    $client = new SoapClient('http://www.webservicex.net/globalweather.asmx?WSDL');
    $response = $client->GetWeather($requestParams);
    
    print_r($response);
    

    would output

    stdClass Object
    (
        [GetWeatherResult] => <?xml version="1.0" encoding="utf-16"?>
    <CurrentWeather>
      <Location>Berlin-Tegel, Germany (EDDT) 52-34N 013-19E 37M</Location>
      <Time>Jan 26, 2012 - 07:50 AM EST / 2012.01.26 1250 UTC</Time>
      <Wind> from the SE (130 degrees) at 14 MPH (12 KT):0</Wind>
      <Visibility> greater than 7 mile(s):0</Visibility>
      <SkyConditions> mostly clear</SkyConditions>
      <Temperature> 33 F (1 C)</Temperature>
      <Wind>Windchill: 23 F (-5 C):1</Wind>
      <DewPoint> 21 F (-6 C)</DewPoint>
      <RelativeHumidity> 59%</RelativeHumidity>
      <Pressure> 30.27 in. Hg (1025 hPa)</Pressure>
      <Status>Success</Status>
    </CurrentWeather>
    )
    

    The rest can then be parsed with SimpleXML or something similar.

    Note, that the kind of response is specific to this web service. There are better web services out there, which do not simply return an xml string, but rather provide the response structure within the WSDL.


    EDIT An example for a “more structured” webservice could be the GeoIP lookup on the same site:

    $client = new SoapClient('http://www.webservicex.net/geoipservice.asmx?WSDL');
    $result = $client->GetGeoIP(array('IPAddress' => '8.8.8.8'));
    
    print_r($result);
    

    this gives you:

    stdClass Object
    (
        [GetGeoIPResult] => stdClass Object
            (
                [ReturnCode] => 1
                [IP] => 8.8.8.8
                [ReturnCodeDetails] => Success
                [CountryName] => United States
                [CountryCode] => USA
            )
    
    )
    

    Now you can simply access the values by invoking

    $country = $result->GetGeoIPResult->CountryName;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to learn how to select weighted items. For example : I
I really do not want to learn Visual Basic and would like to stick
I would like learn about .htaccess file, from the very basic to the complex
I would like to learn the basics of digital certificates. Including how to create
I would like to learn more about C++0x. What are some good references and
I would like to learn the best practices to employ when creating a database
I would like to learn the best practices in reloading the application state, such
I would like to learn how to use NUnit. I learn best by reading
I would like to learn how setup prefix routing like there is in cakephp
I would like to learn how to use binding functions. Here is the idea:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.