468,107 Members | 1,340 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,107 developers. It's quick & easy.

Set request parameters for web services


My .net application is to consume a Java web services exposed using
AXIS.
The web service will extract the user name and password to perform some
custom authentication.
/** Java **/
userId = hReq.getParameter("wsUserName");
password = hReq.getParameter("wsPassword");

So my ASP.net application will need to set the user id and password to
be passed as a HTTP request parameters
upon calling the java web service.

I have added a web refernce to this web service inside my .net
application.
But i can't seems to find any methods or parameters to set the request
parameters.

I have search the web for issues similar to this but don't seems to get
any related help.
Does someone encounter this before???? Any help will be greatly
appreciated.

Thanks.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #1
1 8264
I am not familiar with java web services. But what do you mean by
parameters?

Usually web service consist of using HTTP post method by setting SOAPAction
http header with a value of web service method url. The post contents would
be SoapEnvelope xml.

If you are saying that the wsUserName and wsPassword need to be http header
name and value pairs, then you are out side of SoapEnvelope. The Add Web
Reference feature does not help you. However you can manually edit the proxy
code that was generated with add web reference feature as shown below:

1) In the solution explorer, click on Show All Files.
2) Expand the Web References node all the way until you see Reference.cs
file (assuming you are writing C# code).
3) You should see a class (say TestService, whatever your webservice name
is) that derives from SoapHttpClientProtocol.
4) In the constructor, add following code, below the existing Url setting
code:

Uri uri = new Uri(this.Url);
System.Net.WebRequest req =this.GetWebRequest(uri);

req.Headers["wsUserName"] = "myuser";

req.Headers["wsPassword"] = "mypassword";

5) You can even modify the constructor signature to accept user name and
password and use those values to set headers.

If the above does not work for you, then you may need to use Web Service
Enahancements from micrsoft. You can search the MSDN for it.

Hope this helps.
Raghu/..
"wawa_piggy" <an**@anon.com> wrote in message
news:el**************@TK2MSFTNGP10.phx.gbl...

My .net application is to consume a Java web services exposed using
AXIS.
The web service will extract the user name and password to perform some
custom authentication.
/** Java **/
userId = hReq.getParameter("wsUserName");
password = hReq.getParameter("wsPassword");

So my ASP.net application will need to set the user id and password to
be passed as a HTTP request parameters
upon calling the java web service.

I have added a web refernce to this web service inside my .net
application.
But i can't seems to find any methods or parameters to set the request
parameters.

I have search the web for issues similar to this but don't seems to get
any related help.
Does someone encounter this before???? Any help will be greatly
appreciated.

Thanks.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Jit Prasad | last post: by
13 posts views Thread by trpost | last post: by
3 posts views Thread by Stuart Irving | last post: by
3 posts views Thread by =?Utf-8?B?UGV0ZXIgU2NobWl0eg==?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.