Exception while connecting to webservice

Tuesday, July 12, 2011
Avatar

Today we have tried to connect our local Spira Installation http://localhost/SpiraTeam

from a windows forms application using the reference

 

http://localhost/SpiraTeam/Services/v3_0/ImportExport.svc?wsdl 

 

an exception occurs, what's wrong ?

 

the code:

 

test()

{

SpiraDemo.ServiceReference1.ImportExportClient

test = new SpiraDemo.ServiceReference1.ImportExportClient(); >>exception

string t =test.System_GetProductName();

}

 

An endpoint configuration section for contract 'ServiceReference1.IImportExport' could not be loaded because more than one endpoint configuration for that contract was found. Please indicate the preferred endpoint configuration section by name.

   at System.ServiceModel.Description.ConfigLoader.LookupChannel(ContextInformation configurationContext, String configurationName, ContractDescription contract, EndpointAddress address, Boolean wildcard, Boolean useChannelElementKind, ServiceEndpoint& serviceEndpoint)

   at System.ServiceModel.ChannelFactory.InitializeEndpoint(String configurationName, EndpointAddress address)

   at System.ServiceModel.ChannelFactory`1..ctor(String endpointConfigurationName, EndpointAddress remoteAddress)

   at System.ServiceModel.EndpointTrait`1.CreateSimplexFactory()

   at System.ServiceModel.ClientBase`1.CreateChannelFactoryRef(EndpointTrait`1 endpointTrait)

   at System.ServiceModel.ClientBase`1.InitializeChannelFactoryRef()

   at System.ServiceModel.ClientBase`1..ctor()

   at SpiraDemo.ServiceReference1.ImportExportClient..ctor() in D:\testprogramme\SpiraDemo\Service References\ServiceReference1\Reference.cs:line 9030

   at SpiraDemo.Form1.button1_Click(Object sender, EventArgs e) in D:\testprogramme\SpiraDemo\Form1.cs:line 22

   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 SpiraDemo.Program.Main() in D:\testprogramme\SpiraDemo\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.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)

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

   at System.Threading.ThreadHelper.ThreadStart()

 

 

1 Replies
Tuesday, July 12, 2011
Avatar
re: kagel Tuesday, July 12, 2011

problem solved!, the initialsation needs an argument defined in the app.config

<endpoint address="http://localhost/SpiraTeam/Services/v3_0/ImportExport.svc"

binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IImportExport"

contract="ServiceReference1.IImportExport" name="BasicHttpBinding_IImportExport" />

so:

SpiraDemo.ServiceReference1.ImportExportClient

test = new SpiraDemo.ServiceReference1.ImportExportClient("BasicHttpBinding_IImportExport");

But now we get an error on retrieving requirments although the authentication has been

executed ???

if (test.Connection_Authenticate("user", "pwd"))

{

RemoteRequirement[] reqs = test.Requirement_RetrieveForOwner(); >>

pÇÇ

{"The session was not authenticated, please call the Connection_Authenticate() method first"}

Spira Helps You Deliver Quality Software, Faster and With Lower Risk

And if you have any questions, please email or call us at +1 (202) 558-6885

 

Statistics
  • Started: Tuesday, July 12, 2011
  • Last Reply: Tuesday, July 12, 2011
  • Replies: 1
  • Views: 4067