wonu wns
wonu wns

Reputation: 3608

Calling SOAP web service from GWT client

I don't have any experience working with SOAP so please help me.

i have web project with GWT on the client side. as for the information needed for this site, i have to call/access SOAP web service. i've read some forums that i should use RequestBuilder in order to do so. i have the following code:

    RequestBuilder builder = new RequestBuilder( RequestBuilder.POST, URL.encode( url ) );

    try {
      builder.sendRequest( null, new RequestCallback() {
        public void onResponseReceived( Request request, Response response) {
            if (200 == response.getStatusCode()) {
                // processing response here
            } else {
                // Handle the error
            }
        }

        public void onError(Request request, Throwable exception) {
            // error
        }

      });
    } catch (RequestException e) {
        // Couldn't connect to server
    }

This code causes an error and return status code 0. I think it's the SOP(Same-Origin-Policy) again.

Is there any other way I can do to access SOAP web service in GWT?

E D I T

In this project, a .wsdl file, which is located from an existing domain,

http://sample.com/server/soap/soap.wsdl

is already provided. And I also have this:

http://sample.com/server/soap/soapserver.php

How does it help me to connect to the SOAP web service?

I have created a SOAP Client in java but i encountered an error on javax.xml.* about inheriting the required modules.

Upvotes: 2

Views: 6653

Answers (1)

dimchez
dimchez

Reputation: 2004

If you're trying to access SOAP service from another domain then you're probably limited by SOP. I'd suggest building a thin server-side layer that will actually talk to the SOAP service. To talk to your GWT server-side you can use, for example, DispatchAsync or RequestFactory.

Upvotes: 2

Related Questions