Click here to Skip to main content
15,895,656 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: ViewData, Viewbag and tempdata not working Pin
Member 815484520-Dec-16 8:36
Member 815484520-Dec-16 8:36 
GeneralRe: ViewData, Viewbag and tempdata not working Pin
Richard Deeming20-Dec-16 10:11
mveRichard Deeming20-Dec-16 10:11 
QuestionASMX: Facing problem to send user credentails from client side to service end Pin
Tridip Bhattacharjee19-Dec-16 3:51
professionalTridip Bhattacharjee19-Dec-16 3:51 
AnswerRe: ASMX: Facing problem to send user credentails from client side to service end Pin
jkirkerx19-Dec-16 11:40
professionaljkirkerx19-Dec-16 11:40 
GeneralRe: ASMX: Facing problem to send user credentails from client side to service end Pin
Tridip Bhattacharjee20-Dec-16 21:17
professionalTridip Bhattacharjee20-Dec-16 21:17 
AnswerRe: ASMX: Facing problem to send user credentails from client side to service end Pin
jkirkerx21-Dec-16 9:49
professionaljkirkerx21-Dec-16 9:49 
GeneralRe: ASMX: Facing problem to send user credentails from client side to service end Pin
Tridip Bhattacharjee21-Dec-16 20:31
professionalTridip Bhattacharjee21-Dec-16 20:31 
GeneralRe: ASMX: Facing problem to send user credentails from client side to service end Pin
jkirkerx22-Dec-16 8:20
professionaljkirkerx22-Dec-16 8:20 
Mines just a class written in VB. The class is then registered on a asmx page as a single line.
The web service class uses serialized classes to package the data, and not just a couple of primitive variables.
As far as the namespace goes, never had a problem with it "redcopper.net"

I was thinking about your post last night, and realized the code the article your referencing is for authenticating using the SOAP header, in an existing SOAP operation that actually works. In other words, you have an existing SOAP application that works, but you want to authenticate in the SOAP header, before the server responds to the SOAP envelope or body of data.

You may want to consider getting the SOAP envelope working first, and then add the code to authenticate using the SOAP header.
To get the SOAP envelope working first, remove or remark out the [SoapHeader ("Authentication", Required=true)]
But ...
[SoapHeader ("Authentication", Required=true)]
This part here must activate or tell the WebMethod to analyse or process the SOAP header first, sort of like a MVC controller attribute in which because required = true, it expects the model "AuthHeader" to be present. If it's not present or does not match the format, the SOAP call is rejected.
// Global declaration of AuthHeader in the sample class
public AuthHeader Authentication;

// And this is the class it expects
public class AuthHeader : SoapHeader
{
   public string Username;
   public string Password;
}
The class above called AuthHeader is used in the WebMethod, but must be the same exact class referenced in your console app via a WebReference. It can't be a copy of the class in your console app, in other words having 2 of them; one on the client and one on the server, it has to be the same exact class, or else it won't work.

So here is the simple client again ...
//simple client

// This is code that was created by the WebReference
AuthWebService.WebService webService = new AuthWebService.WebService();

// This is a reference to the class from the web service
AuthWebService.AuthHeader authentication = new AuthWebService.AuthHeader();

// Populate the header data for Authentication using the object above
authentication.Username = "test";
authentication.Password = "test";

// Bind the data to the web service request
webService.AuthHeaderValue = authentication;

// Transmit the SOAP request and header values, but there is no SOAP envelope data in the body, it's blank.
DataSet dsData = webService.SensitiveData();

Regardless of how you write the SOAP code, everything on the client side must use the WebServices classes, so you create a WebReference.

In the sample project, there is a WSDL file. This file is created when you make a WebReference on the client.
If you input data into the WebReference Tool, you will then target the service end point of the service,
in this case I changed it to http://localhost:5636/AuthForWebServices/WebService.asmx to point to a debug server.
<binding name="WebServiceHttpGet" type="s0:WebServiceHttpGet">
    <http:binding verb="GET" />
  </binding>
  <binding name="WebServiceHttpPost" type="s0:WebServiceHttpPost">
    <http:binding verb="POST" />
  </binding>
  <service name="WebService">
    <port name="WebServiceSoap" binding="s0:WebServiceSoap">
      <soap:address location="http://localhost:5636/AuthForWebServices/WebService.asmx" />
    </port>
    <port name="WebServiceHttpGet" binding="s0:WebServiceHttpGet">
      <http:address location="http://localhost:5636/AuthForWebServices/WebService.asmx" />
    </port>
    <port name="WebServiceHttpPost" binding="s0:WebServiceHttpPost">
      <http:address location="http://localhost:5636/AuthForWebServices/WebService.asmx" />
    </port>

If you can't contact the WebService, then you may have a binding or service endpoint error; that is determined by the above file.
Check and make sure your WSDL file is correct, and has the correct URL, check the HTTP or HTTPS for port 80 or 443.

The one thing I don't like about this, is that you have to change the URL when you use it in production to match the production servers URL.
21st Century Globalism has become Socialism on a planetary scale, in which the unequal treaties of the past have come back into play.

GeneralRe: ASMX: Facing problem to send user credentails from client side to service end Pin
Tridip Bhattacharjee22-Dec-16 21:28
professionalTridip Bhattacharjee22-Dec-16 21:28 
GeneralRe: ASMX: Facing problem to send user credentails from client side to service end Pin
jkirkerx23-Dec-16 7:02
professionaljkirkerx23-Dec-16 7:02 
QuestionASMX Web Service Soap Extension ProcessMessage function not calling Pin
Tridip Bhattacharjee19-Dec-16 2:09
professionalTridip Bhattacharjee19-Dec-16 2:09 
AnswerRe: ASMX Web Service Soap Extension ProcessMessage function not calling Pin
Tridip Bhattacharjee21-Dec-16 20:32
professionalTridip Bhattacharjee21-Dec-16 20:32 
Questionasp .net web development Pin
Sanju govind18-Dec-16 20:53
Sanju govind18-Dec-16 20:53 
AnswerRe: asp .net web development Pin
Peter Leow18-Dec-16 21:02
professionalPeter Leow18-Dec-16 21:02 
QuestionRe: asp .net web development Pin
ZurdoDev19-Dec-16 8:23
professionalZurdoDev19-Dec-16 8:23 
AnswerRe: asp .net web development Pin
koolprasad200320-Dec-16 22:43
professionalkoolprasad200320-Dec-16 22:43 
QuestionNeed help on passing id to next page on response.redirect Pin
Bootzilla3318-Dec-16 10:43
Bootzilla3318-Dec-16 10:43 
AnswerRe: Need help on passing id to next page on response.redirect Pin
F-ES Sitecore18-Dec-16 21:59
professionalF-ES Sitecore18-Dec-16 21:59 
QuestionData not updating on fields using UPDATE Statement Pin
Bootzilla3318-Dec-16 10:41
Bootzilla3318-Dec-16 10:41 
AnswerRe: Data not updating on fields using UPDATE Statement Pin
Richard Deeming19-Dec-16 2:33
mveRichard Deeming19-Dec-16 2:33 
GeneralRe: Data not updating on fields using UPDATE Statement Pin
Bootzilla3319-Dec-16 8:21
Bootzilla3319-Dec-16 8:21 
AnswerRe: Data not updating on fields using UPDATE Statement Pin
ZurdoDev19-Dec-16 8:25
professionalZurdoDev19-Dec-16 8:25 
QuestionDropdown pre-filled from prior page fires off required validator Pin
Bootzilla3315-Dec-16 9:54
Bootzilla3315-Dec-16 9:54 
AnswerRe: Dropdown pre-filled from prior page fires off required validator Pin
Richard Deeming16-Dec-16 2:05
mveRichard Deeming16-Dec-16 2:05 
GeneralRe: Dropdown pre-filled from prior page fires off required validator Pin
Bootzilla3316-Dec-16 6:49
Bootzilla3316-Dec-16 6:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.