Web service instances - InfoPath Dev
in

InfoPath Dev

Web service instances

Last post 02-07-2007 12:35 AM by ekzarov. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 01-29-2007 02:59 AM

    Web service instances

    Is there a posibility to save Service object in FormState ???
    For example I have two methods of my web-service named "MyService" : GetClientData and GetOtherData. So in my form I need to write something like this:

    private void SetClientData()
    {
    MyService myService = new MyService();
    XmlNode myNode = myService.GetClientData();
    ...
    ...
    }

    private void SetOtherData()
    {
    MyService myService = new MyService();
    XmlNode myNode = myService.GetInfoData();
    ...
    ...
    }

    So, I need to create MyService two times... Can I do it once ???
    Best regards,
    Alexander Ekzarov
    Kyiv, Ukraine
    silverlightnet.blogspot.com
  • 02-06-2007 10:40 AM In reply to

    Hi Alexander,

    You should be able to do this:

    private MyService myService;

    OnLoad()
    {
    myService = newMyService();
    }


    Then you can reference this global myService variable from any of the functions in the class. To generate the OnLoad event, click Tools -> Programming -> OnLoad event.
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 02-07-2007 12:35 AM In reply to

    :) Well, you think very bad about me :) I`d already tried this ... So the template assamble compiles succesfuly, but when I try to verify it with "stsadm -0 verifyformtemplate ...." I get an error:
    "FatalErrorNoThrow: An issue was found the following with variable 'MyForm.MyFormCodeNameSpace.myService'. Member variables are not supported. Use the FormState property to store data.". So I write this topic http://www.infopathdev.com/forums/topic.asp?TOPIC_ID=4301. Do you understand me now? :)
    Best regards,
    Alexander Ekzarov
    Kyiv, Ukraine
    silverlightnet.blogspot.com
Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.