Executing Service Operations (without code)

Service Operations can be executed only through POST operations (supports both secured and anonymous access). In order to work with POST operations, we need to work with either HTTP tools (e.g., Fiddler, FireFox’s Poster add-in, Chrome’s Advanced Rest Client extension etc.) or develop our own consuming application. In this section, we use Chrome web browser with “Advanced Rest Client” extension.

 

The base delivery of PDS includes a Service Operation named “CreateOrder”. It is designed as follows (using the Personify WSD):

 

The following screenshot demonstrates on executing a service operation named “CreateOrder” using “Advanced Rest Client” extension available for Google’s browser “Chrome”.

You would need to encode your username/password (to Base 64) and send it along with the request.  You can use an online free tool http://www.opinionatedgeek.com/dotnet/tools/base64encode/ to accomplish this (make sure that the “input text” format is “[username]:[password]” without quotations/square brackets).

 

The following is the “Headers” content (in above screen shot):

 

Content-Type: application/xml

Authorization: Basic [YourEncodedAuthenticationStringWithoutSquareBrackets]

Host: dd-servername

Content-Length: 2900

Expect: 100-continue

 

The following is the “Body” (in above screen shot) - XML used to create the order:

<?xml version="1.0" encoding="utf-16"?>

<CreateOrderInput xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

  <ShipMasterCustomerID>000000000009</ShipMasterCustomerID>

  <ShipSubCustomerID xsi:nil="true" />

  <ShipAddressID xsi:nil="true" />

  <BillSubCustomerID xsi:nil="true" />

  <BillAddressID xsi:nil="true" />

  <OrderLines>

    <CreateOrderLineInput>

      <ProductId>609</ProductId>

      <Quantity xsi:nil="true" />

      <ShipSubCustomerID xsi:nil="true" />

      <ShipAddressID xsi:nil="true" />

      <DiscountAmount xsi:nil="true" />

      <ShippingAmount xsi:nil="true" />

      <BaseUnitPrice>25</BaseUnitPrice>

      <AllowBackOrder xsi:nil="true" />

      <SubOrderLines />

    </CreateOrderLineInput>

    <CreateOrderLineInput>

      <ProductId>194</ProductId>

      <Quantity xsi:nil="true" />

      <ShipSubCustomerID xsi:nil="true" />

      <ShipAddressID xsi:nil="true" />

      <DiscountAmount xsi:nil="true" />

      <ShippingAmount xsi:nil="true" />

      <BaseUnitPrice>25</BaseUnitPrice>

      <AllowBackOrder xsi:nil="true" />

      <SubOrderLines>

        <CreateSubOrderLineInput>

          <ProductId>195</ProductId>

          <Quantity xsi:nil="true" />

          <ShipSubCustomerID xsi:nil="true" />

          <ShipAddressID xsi:nil="true" />

          <DiscountAmount xsi:nil="true" />

          <ShippingAmount xsi:nil="true" />

          <BaseUnitPrice>25</BaseUnitPrice>

          <AllowBackOrder xsi:nil="true" />

        </CreateSubOrderLineInput>

      </SubOrderLines>

    </CreateOrderLineInput>

    <CreateOrderLineInput>

      <ProductId>176</ProductId>

      <Quantity xsi:nil="true" />

      <ShipSubCustomerID xsi:nil="true" />

      <ShipAddressID xsi:nil="true" />

      <DiscountAmount xsi:nil="true" />

      <ShippingAmount xsi:nil="true" />

      <BaseUnitPrice>15</BaseUnitPrice>

      <AllowBackOrder xsi:nil="true" />

      <SubOrderLines />

    </CreateOrderLineInput>

    <CreateOrderLineInput>

      <ProductId>81</ProductId>

      <Quantity xsi:nil="true" />

      <ShipSubCustomerID xsi:nil="true" />

      <ShipAddressID xsi:nil="true" />

      <DiscountAmount xsi:nil="true" />

      <ShippingAmount xsi:nil="true" />

      <BaseUnitPrice xsi:nil="true" />

      <AllowBackOrder>false</AllowBackOrder>

      <SubOrderLines />

    </CreateOrderLineInput>

  </OrderLines>

</CreateOrderInput>

 

Once you click on “Send request” (in previous screen shot), the output would look like the following:

 

See also:

·            Creating Service Operations using Personify Data Services

·            Executing Service Operations (using .NET client)

·            CRUD Operations