Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / December 2004

Tip: Looking for answers? Try searching our database.

Web Services C#

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Shem - 06 Dec 2004 16:19 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.