Showing posts with label consume. Show all posts
Showing posts with label consume. Show all posts

Monday, March 26, 2012

Access Denied error when attempting to consume web service

I am attempting to call a web service from my extender control, but when I do so, I get an error message - access denied (there are no other details). After some research, I think this has something to do with cross site scripting - since the web service exists elsewhere (it is a public webservice). How does one access an external webservice?

Here is the code that is throwing the error:

Sys.Net.WebServiceProxy.invoke(this.get_servicePath(),this.get_serviceMethod(),false, params,

Function.createDelegate(this,this._onMethodComplete),

Function.createDelegate(this,this._onMethodFailed));

ServicePath="http://www.webservicex.net/uszip.asmx"ServiceMethod="GetInfoByZIP"

Check out this article:

http://dotnetslackers.com/columns/ajax/MashitUpwithASPNETAJAX.aspx

Hope this helps,

Elias.

Wednesday, March 21, 2012

A quesiton regarding soapheader

Dear all,

I am making a webservice client program and need to consume the service which is devleoped by java. The requirement is I need to send a soapheader which contains user and password. Is anybody can help me to do that?Thank you !!

localhost.IWSMessageService mservice = new localhost.IWSMessageService();
AuthenticationToken AuthenticationToken = new AuthenticationToken(); //this is class extended by Soapheader.

// I need pass AuthenticationToken to mservice

Response.write(mservice.getmessage());

Since you are using Java WebService you will not be able to use the builtin WebServiceProxy of Asp.net Ajax. Instead you have to use Sys.Net.WebRequest object directly to call the web methods the following link may help you to learn how to invoke the WebRequest object of Asp.net Ajax.

http://geekswithblogs.net/rashid/archive/2007/07/21/Asp.net-Ajax-and-VS2003.aspx