c# - asp.net page cannot invoke SOAP POST method in middle-tier -


I have an ASP.NET (C #) web page that uses the VB class library. The VB Library posts a SOAP for a remote web service and gives a message. However, the VB Library is a "no connection can be made because the target machine has actively denied it xxx.xxx.xxx.xxx".

However, I also created a C # exam customer The same VB class library that can be consumed and posted properly!

So what's going on here?

Default.aspx:

  protected void Prisht_lod (object sender, Iventaarjis e) {string Sopastring = ........ Mayvibimdeltiarobjektkpostmjiar Pimarar = new Aivibimdeltiar Object.postgig (); Response.Write (pMgr.DoPOST (soapString)); }  

VB Middle Tier:

  public function DoPOST (ByVal soapMsg as string) String Dim encode UTF8Encoding = new UTF8Encoding () as fond dim as () = encode.GetBytes (soapMsg as bytes) retarded client as HttpWebRequest = CTYPE (WebRequest.Create (ConfigurationManager.AppSettings ( "SoapService")), HttpWebRequest) client.Headers.Add ( "SOAPAction "," ") Client.ContentType =" Text / xml; charset = utf-8 "client.accept =" text / xml "client.method =" POST "client. Contact lang = buff. Lang Client Timeout = 5000 dim S stream = as the client. GETRequestStream (S) type (buff, 0, buff.Length) s.Close () in WebResponse = client.GetResponse (as slow response) S = response.GetResponseStream () As StreamReader = New StreamReader (s) sPostResult = Sr.ReadToEnd () response slow sr (stop [] args) {string soap string = ........ MyVBMiddleTierObject.PostMgr pMgr = new MyVBMiddleTierObject.PostMgr (); String s = pmgr.DoPOST (soapString); Console.WriteLine (s); }}  

So why is my C # exam client working fine, but not my web page?

Update

Soap Message:

  & lt; Soapenv: envelope xmlns: java = "java: com.xyz.service" xmlns: soapenv = "http://schemas.xmlsoap.org/soap/envelope/" xmlns: vcs = "http://schemas.xyz.com / Vcs "& gt; & Lt; Soapenv: header & gt; & Lt; wsse: Security soapenv: mustUnderstand = "1" xmlns: wsse = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" & gt; & Lt; Vsse: Ussernametokeँ Vasu: id = "Ussernametokeँ-5775010" Ksmlns: Vasu = "Actiteepi://dokskosis-opankorg/vss/2004/0l/osis-20040l-vss-vssekrity-utiliti- Lk0kksd" & Gt; & Lt; Wsse: username & gt; JoeShmoe & lt; / Wsse: Username & gt; & Lt; Wsse: Password Type = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText" & gt; 123456789 & lt; / Wsse: Password & gt; & Lt; / Wsse: UsernameToken & gt; & Lt; / Wsse: Security & gt; & Lt; / Soapenv: Header & gt; & Lt; Soapenv: body & gt; & Lt; VCS: theirService & gt; & Lt; VCS: theirMethod & gt; & Lt; Java: Frequency & gt; M & lt; / Java: Frequency & gt; & Lt; / VCS: theirMethod & gt; & Lt; / VCS: theirService & gt; & Lt; / Soapenv: Body & gt; & Lt; / Soapenv: envelope & gt;  

Again, the exact same soap string is being posted (by my test client, and by my web page) but only my test client can connect ...


Update to include web config

  & lt; Configuration & gt; & Lt; AppSettings & gt; & Lt; Add key = "SOAP service" value = "https://www.wxy.com/theirService" /> & Lt; / AppSettings & gt; & Lt; ConnectionStrings / & gt; & Lt; System.web & gt; & Lt; Compilation debug = "true" strict = "false" clear = "true" /> & Lt; Authentication mode = "Windows" /> & Lt; /system.web> & Lt; / Configuration & gt;  

This is very basic ...

error There is no server listening on the port you requested (80 I value) on the computer connecting to your code. This may mean that the IP is incorrect (this computer is found, but it is wrong), or the port is wrong, we will need to see our soap-string for more diagnosis.

Configure it in your web. The credentials are passed with your web service to configure.

  & lt; Identification impersonation = "true" />  

Or if you are not using a Windows token, specify the user id and password.

  & lt; Identification impersonation = "true" userName = "domain \ user" password = "password" />  

You also need to use a proxy with credentials.

  client.Proxy.Credentials = System.Net.CredentialCache.DefaultCredentials  

or

  client.Proxy.Credentials = New Net Networks credentials ("user name", "password")  

Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -