Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Stardust/Knowledge Base/Web Service API/Starting a Process with Primitive and Structured data"

(Introduction)
(Introduction)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 
== Introduction ==
 
== Introduction ==
This example shows the user how to start a process and pass it primitive and SDT values during initialization itself. The example refers to a model that can be downloaded from [http://images/6/69/Stardust_Knowledge_Base_WSAPI_Primitive_and_SDT_SDTTestModel.zip here].
+
This example shows the user how to start a process and pass it primitive and SDT values during initialization itself. The example refers to a model that can be downloaded from [https://wiki.eclipse.org/images/6/69/Stardust_Knowledge_Base_WSAPI_Primitive_and_SDT_SDTTestModel.zip here].
  
== SOAP Request =
+
= SOAP Request =
 
As seen from the process definition in the model, we are required to pass in 3 primitive values (a String, an integer and a boolean) and a Structured Data of type Person that contains a few primitive properties (FirstName, LastName, Phone, Email) as well as one or more Addresses which are themselves SDTs of type Address (with the properties Street1, Street2, City, State and Zip). Please note that by default, any primitive will be interpreted as a String unless its type is specified. This can be changed by including an <api:type> element per primitive parameter with a proper namespace prefix. In this example the xsi namespace is added to the top of the request in the SOAP envelope. Also note that for SDT data, while the data itself must be mentioned in an <api:name> element, it must also be the outermost tag of the <api:xml> element that actually provides the value for this data. The element names and nesting within this XML must match the SDT definition provided in the model.
 
As seen from the process definition in the model, we are required to pass in 3 primitive values (a String, an integer and a boolean) and a Structured Data of type Person that contains a few primitive properties (FirstName, LastName, Phone, Email) as well as one or more Addresses which are themselves SDTs of type Address (with the properties Street1, Street2, City, State and Zip). Please note that by default, any primitive will be interpreted as a String unless its type is specified. This can be changed by including an <api:type> element per primitive parameter with a proper namespace prefix. In this example the xsi namespace is added to the top of the request in the SOAP envelope. Also note that for SDT data, while the data itself must be mentioned in an <api:name> element, it must also be the outermost tag of the <api:xml> element that actually provides the value for this data. The element names and nesting within this XML must match the SDT definition provided in the model.
  

Latest revision as of 02:23, 14 February 2014

Introduction

This example shows the user how to start a process and pass it primitive and SDT values during initialization itself. The example refers to a model that can be downloaded from here.

SOAP Request

As seen from the process definition in the model, we are required to pass in 3 primitive values (a String, an integer and a boolean) and a Structured Data of type Person that contains a few primitive properties (FirstName, LastName, Phone, Email) as well as one or more Addresses which are themselves SDTs of type Address (with the properties Street1, Street2, City, State and Zip). Please note that by default, any primitive will be interpreted as a String unless its type is specified. This can be changed by including an <api:type> element per primitive parameter with a proper namespace prefix. In this example the xsi namespace is added to the top of the request in the SOAP envelope. Also note that for SDT data, while the data itself must be mentioned in an <api:name> element, it must also be the outermost tag of the <api:xml> element that actually provides the value for this data. The element names and nesting within this XML must match the SDT definition provided in the model.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
 xmlns:api="http://eclipse.org/stardust/ws/v2012a/api" 
 xmlns:xsi="http://www.w3.org/2001/XMLSchema">
   <soapenv:Header/>
   <soapenv:Body>
      <api:startProcess>
         <api:processId>{SDTTestModel}SDTTestProcess</api:processId>
         <api:parameters>
            <!--Zero or more repetitions:-->
            <api:parameter>
               <api:name>String1</api:name>
               <api:primitive>Hello World</api:primitive>
            </api:parameter>   
		  <api:parameter>
               <api:name>Int1</api:name>
               <api:type>xsi:int</api:type>
               <api:primitive>99</api:primitive>
            </api:parameter>   
		  <api:parameter>
               <api:name>Boolean1</api:name>
               <api:type>xsi:boolean</api:type>
               <api:primitive>true</api:primitive>
		  </api:parameter>
            <api:parameter>
               <api:name>PersonData</api:name>
               <api:xml>
                  <PersonData>
                    <FirstName>John</FirstName>
                    <LastName>Doe</LastName>
                    <Phone>123456</Phone>
                    <Email>john.doe@xyz.com</Email>
                    <Address>
                      <Street1>123 Main St</Street1>
                      <Street2>456 Avenue</Street2>
                      <City>Any City</City>
                      <State>Any State</State>
                      <Zip>987654</Zip>
                    </Address>
                  </PersonData>
               </api:xml>
            </api:parameter>
         </api:parameters>
         <api:startSynchronously>true</api:startSynchronously>
      </api:startProcess>
   </soapenv:Body>
</soapenv:Envelope>

Back to the top