On Dec 16 2009, 6:49 pm, joe <joe.krat...@gmail.com> wrote:
> yeah it looks like the link was butchered when I send the post.
>
> http://www.gwtapps.com/doc/html/com.google.gwt.http.client.html
>
> I have tried what you are using. However, after looking into the
> problem more I see that Same Origin Policy seems to be my issue. It
> looks like without using JSONP I can not call my self hosted C#WCF
> application. This is due to the port miss match (Jetty server runs on
> 8888 and my self hostedWCfapp runs on 80) which violates S.O.P.
>
> According to Google's docs I can not do this without some 'hack' on
> the GWT 
> side.http://code.google.com/webtoolkit/doc/1.6/FAQ_Server.html#How_can_I_d...
>
> I have looked into using JSONP withWCFbut I have been unable to
> locate a way to send a pure JSONP object to GWT. The only thing I have
> been able to do it send a string that holds my JSONP string. so there
> are leading and trailing ". I would assume that GWT won't like this.
>
> So right now I have no other option but to write a GWT back-end proxy
> so that GWT front end can call my C# app to request data, unless
> anyone has any ideas.
>
> Thank you
>
> On Dec 16, 3:25 am, rjcarr <rjc...@gmail.com> wrote:
>
> > The link you posted is dead, and I didn't completely understand what
> > you were asking.  However, I make some non-GWTrequests in my project
> > so maybe this will help you out.
>
> > RequestBuilder reqbuilder = new RequestBuilder(RequestBuilder.GET,
> > URL);
>
> > reqbuilder.sendRequest(
> >         null, // OK to use null for GET type
> >         new RequestCallback() {
> >                 public void onResponseReceived(Request request, Response 
> > response) {
> >                         if(response.getStatusCode() == 200) {
> >                                 // SUCCESS
> >                                 log(response.getText());
>
> >                         } else {
> >                                 // ERROR
> >                                 log(response.getStatusCode());
> >                                 log(response.getStatusText());
> >                         }
> >                 }
>
> >                 public void onError(Request request, Throwable t) {
> >                         // ERROR
> >                         log(t.getMessage());
> >                 }
> >         }
> > );
>
> > On Dec 15, 7:59 am, joe <joe.krat...@gmail.com> wrote:
>
> > > I'm having an issue withGWT2.0requesting XML data from aC#self
> > > hosted Web Service. Using the GET request tutorial 
> > > (http://www.gwtapps.com/doc/html/com.google.gwt.http.client.html) I was 
> > > able
> > > to retrieve the XML data usingGWT1.7. After upgrading to2.0all I
> > > return is an empty String using response.getTest(). The headers are
> > > also empty and response.getStatusCode() returned is 0.
>
> > > Running theC#app in debug I find that it is sending the XML data
> > > out, but it looks like theGWTside isn't receiving it. If I call the
> > > URL from the browser I see the XML data.
>
> > > I have also tried to use this same method to call other web services
> > > as well as websites. Still status code 0 and no text in the
> > > response.getTest().
>
> > > This leads me to believe that I missed some configuration in setting
> > > up my app toGWT2.0. However, I have clue where to start.
>
> > > Any help would be greatly appreciated.

This post is a few weeks old and you've probably solved your problem
by now - but, in case you haven't, it is possible to fix the same
origin policy issue for a JSON WCF web service by doing this in your
operation implementation:

        public SomeData MyOperation(SomeParameters args)
        {
            WebOperationContext.Current.OutgoingResponse.Headers.Add
("Access-Control-Allow-Origin:*");

            // Rest of operation code...
        }

You only have to do this during development. In a production scenario
you definitely don't want to be setting this header! Note that it's
also possible to do the above in a WCF behavior which extends
DispatchRuntime or DispatchOperation. That way you can decide in
configuration whether this header gets set.

CTD
-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.


Reply via email to