5 Replies Latest reply on Mar 31, 2017 10:51 AM by carlesc RSS
    avaidya Newbie

    Invoking SOAP web service from TW

    Hi,

    We need to invoke SOAP based (synchronous) Web service of external system, from Thingworx platform.

    Do we need to write Java extension for it ? OR can we do it from Java script code in TW platform.

    What is preferred from your experience?

    Best Regards,

    Aniruddha

      • Re: Invoking SOAP web service from TW
        carlesc Ninja

        I've invoked SOAP with just standard TW services. You must look on PostXML snippet.

          • Re: Invoking SOAP web service from TW
            avaidya Newbie

            Thanks for reply.

            Using above suggestion,

            If I write a Thing1.service1(param, param2)  that invokes external SOAP web service passing param1, param2 as SOAP request params and returning response of web service as result of service1.

            When say 5 concurrent users access the same Thing1.service1(), , will caller will get the expected result as per passed params or I need to create new Thing1 for each caller ? in Short is service code of Thing is threadsafe if used like singleton pattern in TW?

              • Re: Invoking SOAP web service from TW
                carlesc Ninja

                I don't see the singleton pattern for the same you say, if you are just calling a remote SOAP service and returning results, all the calls can be done in parallel ( same thing / service with multiple threads )

                  • Re: Invoking SOAP web service from TW
                    carlesc Ninja

                    1. Yes if it are started by different Events, Timers, Users,... But If the service writes on a Persistent property, then no concurrent calls will be done.

                    2. I don't use Java Extensions, 99% off our code it's on Javascript, but I don't think it creates multiple copies, but I don't know exactly the lifecycle of a Java Service Call, maybe better someone else can answer you.

              • Re: Invoking SOAP web service from TW
                avaidya Newbie

                Thanks for clarification.

                1. Does it mean when multiple callers call sameTW thing.service() concurrently, the code inside the thing.service() gets executed in separate thread(s)?

                 

                2. Is the abovetrue, in case Thing1 is a Java extension.?

                If Yes, What happens if there are some instance variables in Java implementation those are used inside service() logic, aren't their values going to create issue for concurrent invocation of the service()?

                OR TW platform at runtime will create multiple copies of same thing on stack during concurrent invocation?

                 

                As I am from J2EE background getting my doubts cleared about TW platofrm