SharePoint XML Web Part and proxy setting

XML Web Part is quite useful when you want to collect data from other sites (e.g. RSS). Yesterday I wanted to display local weather information using Weather.com XML Data Feed. I followed these steps:
  1. Registered to weather.com to download the SDK (to use weather images)
  2. Copied SDK images to TEMPLATE\Images\weather\
  3. Added XML Web Part to WSS site and set URL to
    http://xoap.weather.com/weather/local/(zipcode)?cc=*&prod=xoap
    &unit=e&par=null&key=(license key)
    [Update] Weather.com has changed the URL to
    http://xoap.weather.com/weather/local/[zipcode]?cc=*&dayf=5
    &link=xoap&prod=xoap&par=[PartnerID]&key=[LicenseKey]
  4. Set up XSLT to display weather images
But I got errors on different WSS machines:
  1. "Cannot retrieve the URL specified in the XML Link property"
  2. "The web part has timed out"
The reason was my WSS sites were behind a proxy server. WSS XML Web Part need know proxy settings, otherwise it can not access the URL.

The first error happens when the WSS application pool does not use a domain account; the second error happens when a domain account is used.

After I added proxy settings in web.config, the problem was solved:

<!-- Proxy setting -->
<system.net>
<defaultproxy useDefaultCredentials="true">
<proxy usesystemdefault="false"
proxyaddress="http://proxyServer:port"
bypassonlocal="true">
</proxy>
</defaultproxy>
</system.net>

4 comments:

Xuhong said...
This comment has been removed by a blog administrator.
Neel said...

Jun,

Can i change my zip coe based on employee profile get the zip code from active directory and append it to the url

Neel

Jun Meng said...

Neel,

Sure. You can build the URL on the fly. The only requirement is you have to keep the same LicenseKey.

Emma said...

I tried to implement the same using the code that you have posted but its still producing an error at my end. I tried to manipulate the code but is not able to make it run. Can you please suggest me what to do ? Is it possible that version may be the reason behind the issue.
e-sign act