Hi
I have some troubles. I should call a webservice and frome there i should
create authentication object for calling other services.
Is there a way to do that with vbs and the ms soap object?
I posted an .Net example, to understand how it would work:
using System;
using ConsoleApplication1;
namespace ConsoleApplication1
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
// string docbase = "comlog";
string docbase = "pwm_zu";
loginservice.DocbaseCredentialsService crServ = new
loginservice.DocbaseCredentialsService();
loginservice.DocbaseCredentialsInfo info = new
loginservice.DocbaseCredentialsInfo();
// info.docbaseName = "docbase1";
// info.user = "Name1";
// info.password = "*******";
info.docbaseName = "docbase2";
info.user = "name2";
info.password = "*******";
String token = crServ.newCredentials(info, true);
account.MSAccountService acService = new account.MSAccountService();
account.DocumentumSecurityToken acToken = new
account.DocumentumSecurityToken();
acToken.token = token;
acService.DocumentumSecurityTokenValue = acToken;
string accountId = "1111111";
try
{
account.Document[] docs = acService.getDocumentsOfAccount(docbase,
accountId, "false");
foreach(account.Document doc in docs)
{
System.Console.WriteLine(doc.docIndexNo);
System.Console.WriteLine(doc.objectId);
System.Console.WriteLine(doc.documentDescr);
System.Console.WriteLine(doc.createdDate);
System.Console.WriteLine(doc.creationOwner);
System.Console.WriteLine(doc.versionLabel);
System.Console.WriteLine("------------------------------------");
try
{
byte[] data = acService.getContentXferBase64(docbase, doc.objectId);
if(data!=null)
{
string s = base64Decode(data);
Console.WriteLine("Contentsize: " + s.Length);
}
}
catch(System.Web.Services.Protocols.SoapException err)
{
PrintSoapExceptionInfo(err);
}
}
string xml = acService.getDocumentsOfAccountAsXml(docbase, accountId,
"false");
Console.WriteLine(xml);
xml = acService.getDocumentTypesOfAccountAsXml(docbase, accountId,
"1-AO", "false");
Console.WriteLine(xml);
System.Console.WriteLine("Ende");
}
catch(System.Web.Services.Protocols.SoapException err)
{
PrintSoapExceptionInfo(err);
}
}
private static void
PrintSoapExceptionInfo(System.Web.Services.Protocols.SoapException err)
{
System.Console.WriteLine(err.Message);
System.Console.WriteLine(err.StackTrace);
System.Console.WriteLine(err.Detail.InnerText);
Exception e = err.InnerException;
while(e!=null)
{
System.Console.WriteLine(err.Message);
System.Console.WriteLine(err.StackTrace);
e = e.InnerException;
}
}
public static string base64Decode(Byte[] data)
{
try
{
System.Text.UTF8Encoding encoder = new System.Text.UTF8Encoding();
System.Text.Decoder utf8Decode = encoder.GetDecoder();
char[] ca = new char[data.Length];
for(int i=0;i<data.Length;i++)
{
ca[i] = (char)data[i];
}
byte[] todecode_byte = Convert.FromBase64CharArray(ca,0,ca.Length);
int charCount = utf8Decode.GetCharCount(todecode_byte, 0,
todecode_byte.Length);
char[] decoded_char = new char[charCount];
utf8Decode.GetChars(todecode_byte, 0, todecode_byte.Length,
decoded_char, 0);
string result = new String(decoded_char);
return result;
}
catch(Exception e)
{
throw new Exception("Error in base64Decode" + e.Message);
}
}
}
}