Ok I have had a look with fiddler

This is the results of using a delphi soap application

<?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><geocodeResponse xmlns="http://rpc.geocoder.us/Geo/Coder/US"><geo:results soapenc:arrayType="geo:GeocoderAddressResult[1]" xsi:type="soapenc:Array" xmlns:geo="http://rpc.geocoder.us/Geo/Coder/US/"><geo:item xsi:type="geo:GeocoderAddressResult" xmlns:geo="http://rpc.geocoder.us/Geo/Coder/US/"><geo:number xsi:type="xsd:int">1600</geo:number><geo:lat xsi:type="xsd:float">38.898748</geo:lat><geo:street xsi:type="xsd:string">Pennsylvania</geo:street><geo:state xsi:type="xsd:string">DC</geo:state><geo:city xsi:type="xsd:string">Washington</geo:city><geo:zip xsi:type="xsd:int">20502</geo:zip><geo:suffix xsi:type="xsd:string">NW</geo:suffix><geo:long xsi:type="xsd:float">-77.037684</geo:long><geo:type xsi:type="xsd:string">Ave</geo:type><geo:prefix xsi:type="xsd:string" /></geo:item></geo:results></geocodeResponse></soap:Body></soap:Envelope>

When I run my itty bitty C# application I see this



If I click on 'Click here to transform' I get

<?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><geocodeResponse xmlns="http://rpc.geocoder.us/Geo/Coder/US/"><geo:results soapenc:arrayType="geo:GeocoderAddressResult[1]" xsi:type="soapenc:Array" xmlns:geo="http://rpc.geocoder.us/Geo/Coder/US/"><geo:item xsi:type="geo:GeocoderAddressResult" xmlns:geo="http://rpc.geocoder.us/Geo/Coder/US/"><geo:number xsi:type="xsd:int">1600</geo:number><geo:lat xsi:type="xsd:float">38.898748</geo:lat><geo:street xsi:type="xsd:string">Pennsylvania</geo:street><geo:state xsi:type="xsd:string">DC</geo:state><geo:city xsi:type="xsd:string">Washington</geo:city><geo:zip xsi:type="xsd:int">20502</geo:zip><geo:suffix xsi:type="xsd:string">NW</geo:suffix><geo:long xsi:type="xsd:float">-77.037684</geo:long><geo:type xsi:type="xsd:string">Ave</geo:type><geo:prefix xsi:type="xsd:string" /></geo:item></geo:results></geocodeResponse></soap:Body></soap:Envelope>

Ok looks like what whatever is returned needs to be transformed. At this point in time I have do not know what fiddler is using to do any transform.

Looking at the response in hex I see
HTTP/1.1 200 OK
Date: Thu, 20 Jan 2011 07:58:52 GMT
Server: Apache/2.2.9 (Debian) mod_perl/2.0.4 Perl/v5.10.0
Content-Type: text/xml; charset=utf-8
SOAPServer: SOAP::Lite/Perl/0.710.08
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 458
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
<<Followed by binary type characters.>>

It looks like the response has been gzipped.

Looks like I need to do extra research but if anyone has some pointers as to what I should do next it would be appreciated.
I am not sure why one returns the response as plain text and the other is compressed.
May there is some setting in the request headers  (??) that asks for this.

Full marks for Fiddler though, an absolutely brilliant piece of software.

Regards Peter

On 20/01/2011 11:25 AM, Stephen Price wrote:
Have you had a look at whats happening using Fiddler? (or other
suitable traffic monitoring tool)
Might give you a hint as to whats being sent/returned. might even show
you an error rather than just empty result

On Thu, Jan 20, 2011 at 11:23 AM, Peter Maddin <[email protected]> wrote:
I am re-learning WCF and am trying a simple web service client to the US Geo
Coordinate service at http://geocoder.us/

WSDL is at  http://rpc.geocoder.us/dist/eg/clients/GeoCoder.wsdl

There is a C# Client at
http://www.c-sharpcorner.com/uploadfile/scottlysle/geocoderuswebservice01232008035119am/geocoderuswebservice.aspx

but it does not work. It keeps saying that the address given is invalid.

I have used the sample addresses at http://geocoder.us/  and while they work
in the web site they don't in the c# demo.

I have a demo Delphi application that also works against this site.

So the site  is working!!

I wrote a extremely basic web service client. I added a service reference
using the WSDL and created a simple winForm application

Code

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.ServiceModel;
using GeoCodeTest.ServiceReference1;

namespace GeoCodeTest
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private GeocoderResult[] LocationResult = null;
        private GeoCode_PortTypeClient proxy = null;

        private void btnGo_Click(object sender, EventArgs e)
        {
            LocationResult = proxy.geocode(txtLocation.Text); // always returns a null !!!
            geocoderResultBindingSource.DataSource = LocationResult;
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            proxy = new GeoCode_PortTypeClient("GeoCode_Port");
        }
    }
}

No matter what address I put in, the result returned is always null.
In the C# demo from
http://www.c-sharpcorner.com/uploadfile/scottlysle/geocoderuswebservice01232008035119am/geocoderuswebservice.aspx
the location returned was also null.

This is the app.config file that was generated.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="GeoCode_Binding" closeTimeout="00:01:00" openTimeout="00:01:00"
                    receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
                    bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                    messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                    useDefaultWebProxy="true">
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <security mode="None">
                        <transport clientCredentialType="None" proxyCredentialType="None"
                            realm="" />
                        <message clientCredentialType="UserName" algorithmSuite="Default" />
                    </security>
                </binding>
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://rpc.geocoder.us/service/soap/" binding="basicHttpBinding"
                bindingConfiguration="GeoCode_Binding" contract="ServiceReference1.GeoCode_PortType"
                name="GeoCode_Port" />
        </client>
    </system.serviceModel>
</configuration>


There is a link to passing credentials here to fix an issue
http://geocoder.us/help/msxml.shtml.
But I don't think that has anything to do with this (could be wrong). I am
using the free service.

Can anyone tell me why the C# solution won't work where as other solutions
do?
Is there something else one needs to do (apart from tearing one's hair out).

Regards Peter








    

Reply via email to