I'm trying to call the web service method from my PowerShell script but it has failed. Here is the C # code:
Public MyTable Insert (MyTable Data) {var Data Contex = New MyIntees (); DataContext.MyTables.AddObject (data); DataContext.SaveChanges (); Return data; }
Thus I call it in PowerShell:
$ uri = "http: //localhost/MyWcfService/MyService.svc?wsdl" $ Svc = New-WebServiceProxy -Uri $ Uuri -UseDefaultCredential $ t = $ svc.GetType () .Namespace $ attributes = New-object ($ t + ".myTable") $ attributes.Name = "Project X" $ attributes Comment = "This is an exam" $ resp = $ svc.InsertRow ($ attributes) $ resp
And this is what I get:
A surcharge and logic number can not be found for "insert": "1" in line: 1 character: 1 + $ resp = $ svc.InsertRow ($ attributes) + ~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Category Info : Not Specified: (:) [], Method Exception + Fully Qualified Error Id: MethodCountCouldNotFindBest
What am I doing wrong?
Update: This is built-in. NET type is when I call $ attributes. GetType ():
IsPublic IsSerial name basetipe -------- -------- ---- -------- true true Microsoft . PowerShell Commands.New Vice Serviceproxy.Agogenerated Type WebServicesProxy1WCFservicesMaji Service ... ...
I left on to try PowerShell Call my rental web service in I used this tutorial and then used it to use C #. I have not tried it yet, but I should be capable (this requires my project).
No comments:
Post a Comment