Hello,
I'm trying to access a remote application from .Net via the SOAP interface.
My first C# program code is as follow:
-----------code snippet----------------
namespace MyLogin {
using System.Xml.Serialization;
using System;
using System.Web.Services.Protocols;
using System.Web.Services;
[System.Web.Services.WebServiceBindingAttribute(
Name="Login",
Namespace="http://www.my.com/mapi")]
public class Login :
System.Web.Services.Protocols.SoapHttpClientProtocol {
public Login() {
this.Url = "http://192.168.1.57/cgi-bin/rpc_soap";
}
[System.Web.Services.Protocols.SoapDocumentMethodAttribute(
"http://www.my.com/mapi",
RequestNamespace="http://www.my.com/mapi",
ResponseNamespace="http://www.my.com/mapi",
Use=System.Web.Services.Description.SoapBindingUse.Literal,
ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped
)]
public string login(string username, string passwd) {
object[] results = this.Invoke("login", new object[] {username,
pass
wd});
return ((string)(results[0]));
}
public System.IAsyncResult BeginProductCatalog(System.AsyncCallback
callback, object asyncState) {
return this.BeginInvoke("login", new object[0], callback,
asyncState
);
}
public static void Main(string[] args) {
Console.WriteLine("Calling SOAP server...");
Login authStr = new Login();
Console.WriteLine("Server says: " + authStr.login
("myID", "myPassword"));
}
}
}
--------------ends snippet---------------------------
When I run this program, I can see that it contacts the rpc_soap server,
which is an easysoap++0.5 server. The result data is supposed to look
something like below:
<E:Envelope xmlns:E="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:A="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:s="http://www.w3.org/2001/XMLSchema-instance"
xmlns:y="http://www.w3.org/2001/XMLSchema"
E:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<E:Body>
<m:loginResponse xmlns:m="http://www.my.com/mapi">
<result
s:type="y:string">1,1020192207,7fdb7a3a936aba9d857c0824f6e42ca7</result>
</m:loginResponse>
</E:Body>
</E:Envelope>
However, the results array appears to be null. Any clue? Thanks.
Dzuy
You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.