Hi Folks,
If I create a Infopath form in C# and I add a web reference to my web
service. How do I get a hold of the web services via the code and execute
it's methods??
Cheers
Davie - 06 Dec 2004 20:41 GMT
Hi Shem, you would access the webservice in the code behind of infopath
just as you would if you weren't using infopath.
So if you have a webservice defined as Service1 and you have a method
called
[WebMethod]
public string helloworld(){
return "Hello World";
}
you could write in you FormCode.cs file
Service1 myService = new Service1();
thisXDocument.UI.Alert(myService.HelloWorld());
I hope this helps.
-- Davie
http://dotnetjunkies.com/weblog/dsweis/
> Hi Folks,
>
> If I create a Infopath form in C# and I add a web reference to my web
> service. How do I get a hold of the web services via the code and execute
> it's methods??
>
> Cheers
Matthew Blain \(Serriform\) - 07 Dec 2004 00:56 GMT
Or you can use the DataAdapters just like you would using script for any
other InfoPath form.
--Matthew Blain
http://tips.serriform.com/
http://www.developingsolutionswithinfopath.com/
> Hi Shem, you would access the webservice in the code behind of infopath
> just as you would if you weren't using infopath.
[quoted text clipped - 26 lines]
> >
> > Cheers
Davie - 06 Dec 2004 20:41 GMT
Hi Shem, you would access the webservice in the code behind of infopath
just as you would if you weren't using infopath.
So if you have a webservice defined as Service1 and you have a method
called
[WebMethod]
public string helloworld(){
return "Hello World";
}
you could write in you FormCode.cs file
Service1 myService = new Service1();
thisXDocument.UI.Alert(myService.HelloWorld());
I hope this helps.
-- Davie
http://dotnetjunkies.com/weblog/dsweis/
> Hi Folks,
>
> If I create a Infopath form in C# and I add a web reference to my web
> service. How do I get a hold of the web services via the code and execute
> it's methods??
>
> Cheers
Davie - 06 Dec 2004 20:42 GMT
Hi Shem, you would access the webservice in the code behind of infopath
just as you would if you weren't using infopath.
So if you have a webservice defined as Service1 and you have a method
called
[WebMethod]
public string helloworld(){
return "Hello World";
}
you could write in you FormCode.cs file
Service1 myService = new Service1();
thisXDocument.UI.Alert(myService.HelloWorld());
I hope this helps.
-- Davie
http://dotnetjunkies.com/weblog/dsweis/
> Hi Folks,
>
> If I create a Infopath form in C# and I add a web reference to my web
> service. How do I get a hold of the web services via the code and execute
> it's methods??
>
> Cheers
Shem - 07 Dec 2004 15:09 GMT
Hi this has been really helpful except when I call teh method I always get
Unauthorized access even though I am ana dministrator. I also have Sharepoint
sevices installed which does some crazy stuff. Are you familiar with
Sharepoint?
> Hi Shem, you would access the webservice in the code behind of infopath
> just as you would if you weren't using infopath.
[quoted text clipped - 26 lines]
> >
> > Cheers
Davie - 07 Dec 2004 15:50 GMT
Try adding this...
service1.Credentials = System.Net.CredentialCache.DefaultCredentials;
-- Davie
http://dotnetjunkies.com/weblog/dsweis/
> Hi this has been really helpful except when I call teh method I always get
> Unauthorized access even though I am ana dministrator. I also have Sharepoint
[quoted text clipped - 31 lines]
> > >
> > > Cheers