abdullah.shabbab

C#: Error when the App try to Initialize the Web Services using WS-Security

Discussion created by abdullah.shabbab on Sep 20, 2016
Latest reply on Oct 5, 2016 by rt0044432

dear All,

i am trying to use WS in my project in the beggining i did the following steps to prepear for lunch this service:@

1- make the WS Active.

2- create a Proxy Tool .

3- open the visual studio and add the reference to the project( using the "WSDL Location").

4- add BbWsClient.dll to the project.

5- write the following code:

C# code

            const long EXPECTED_LIFE = 10000000;

            string host = "https://lms.nu.edu.sa";

            string vendor = "VendorId";

            string program = "ProgranId";

            string secrt = "**********";

            WebserviceWrapper ws = new WebserviceWrapper(host, vendor, program, EXPECTED_LIFE);

            // Initialize the web service session. Under the covers, this takes care of Context.initialize()

            ws.initialize_v1();

            ContextWrapper ctx = ws.getContextWrapper();

error msg i got :

System.IO.FileNotFoundException was unhandled

  HResult=-2147024894

  Message=Could not load file or assembly 'Microsoft.Web.Services2, Version=2.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

  Source=BbWsClient

  FileName=Microsoft.Web.Services2, Version=2.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35

  FusionLog==== Pre-bind state information ===

LOG: DisplayName = Microsoft.Web.Services2, Version=2.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35

(Fully-specified)

LOG: Appbase = file:///C:/Users/amshabbab/Documents/visual studio 2010/Projects/TestBBWebServices/TestBBWebServices/bin/Debug/

LOG: Initial PrivatePath = NULL

Calling assembly : BbWsClient, Version=1.0.5521.21194, Culture=neutral, PublicKeyToken=null.

===

LOG: This bind starts in default load context.

LOG: Using application configuration file: C:\Users\amshabbab\Documents\visual studio 2010\Projects\TestBBWebServices\TestBBWebServices\bin\Debug\TestBBWebServices.vshost.exe.Config

LOG: Using host configuration file:

LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.

LOG: Post-policy reference: Microsoft.Web.Services2, Version=2.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35

LOG: Attempting download of new URL file:///C:/Users/amshabbab/Documents/visual studio 2010/Projects/TestBBWebServices/TestBBWebServices/bin/Debug/Microsoft.Web.Services2.DLL.

LOG: Attempting download of new URL file:///C:/Users/amshabbab/Documents/visual studio 2010/Projects/TestBBWebServices/TestBBWebServices/bin/Debug/Microsoft.Web.Services2/Microsoft.Web.Services2.DLL.

LOG: Attempting download of new URL file:///C:/Users/amshabbab/Documents/visual studio 2010/Projects/TestBBWebServices/TestBBWebServices/bin/Debug/Microsoft.Web.Services2.EXE.

LOG: Attempting download of new URL file:///C:/Users/amshabbab/Documents/visual studio 2010/Projects/TestBBWebServices/TestBBWebServices/bin/Debug/Microsoft.Web.Services2/Microsoft.Web.Services2.EXE.

 

 

  StackTrace:

       at BbWsClient.WebserviceWrapper..ctor(String host, String vendor, String program, Int64 expected_life)

       at TestBBWebServices.Form1.btnShoAnn_Click(Object sender, EventArgs e) in C:\Users\amshabbab\Documents\visual studio 2010\Projects\TestBBWebServices\TestBBWebServices\Form1.cs:line 27

       at System.Windows.Forms.Control.OnClick(EventArgs e)

       at System.Windows.Forms.Button.OnClick(EventArgs e)

       at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)

       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)

       at System.Windows.Forms.Control.WndProc(Message& m)

       at System.Windows.Forms.ButtonBase.WndProc(Message& m)

       at System.Windows.Forms.Button.WndProc(Message& m)

       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)

       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)

       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)

       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)

       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)

       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)

       at System.Windows.Forms.Application.Run(Form mainForm)

       at TestBBWebServices.Program.Main() in c:\users\amshabbab\documents\visual studio 2010\Projects\TestBBWebServices\TestBBWebServices\Program.cs:line 18

       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)

       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)

       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()

       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)

       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)

       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)

       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

       at System.Threading.ThreadHelper.ThreadStart()

  InnerException:

Error ScreenCap:

Attachments

Outcomes