Action Message Format Vuser Functions (AMF) > Using AMF functions

Example: Using AMF functions.

The following code section shows a typical AMF VUser sequence. Headers are defined and then used in the call.

amf_define_header_set("Id=amf_header_set",
  HEADER,
  "Name=Credentials",
  "MustUnderstand=false",
  "Data=<object><string name=\"password\">qa</  string>"
  "<string name=\"userid\">myUserID</string></object>",
  HEADER,
  "Name=SimpleHeader",
  "MustUnderstand=false",
  "Data=<object><string name=\"Number\">"
  "12345678987654321.555444333222111</string>"
  "<string name=\"String\">qwerty</string></object>",
  HEADER,
  "Name=AMF custom Header1",
  "MustUnderstand=true",
  "Data=<object><string name=\"name\">"
  "QA Tester</string>"
  "<number name=\""age\">32</number>"
  "<string name=\"phone\">555-1234</string>"
  "<date name=\"curr_date\""
  "localOffset=\"-180\">09-Apr-1968 15:59:59.000</date>"
  "</object>",
  LAST );


amf_define_envelope_header_set(
  "Id=envelope_header_set",
  HEADER,
  "<strictArray length=\"3\"><string>EnvHead1</string>"
  "<boolean>true</boolean>"
  "<object><object name=\"qname\">"
  "<string name=\"localPart\">Header1</string>"
  "<string name=\"namespaceURI\">"
  "http://myNameSpaceServer.org/xsd</string></object>"
  "<object name=\"content\"><string name=\"Number\""
  ">-0.0000000000000123</string>"
  "<string name=\"String\">First Header</string>"
  "</object></strictArray>",
  LAST );

amf_define_envelope_header_set(
  "Id=envelope_header_set_1",
  HEADER,
  "<strictArray length=\"3\"><string>EnvHead3</string>"
  "<boolean>false</boolean>"
  "<object><object name=\"qname\">"
  "<string name=\"localPart\">Header3</string>"
  "<string name=\"namespaceURI\">"
  "http://myNameSpaceServer.org/xsd</string>"
  "</object><object name=\"content\">"
  "<string name=\"Number\">789</string>"
  "<string name=\"String\">Third Header</string>"
 "</object></strictArray>",
  LAST );

amf_call("EchoAMF.EchoAMF.EchoAny",
  "Gateway=http://myGateway/AMF/EchoAMF/gateway.aspx",
  "AMFHeaderSetId=amf_header_set",
  "Snapshot=t8.inf",
  MESSAGE,
  "Method=EchoAMF.EchoAMF.EchoAny",
  "TargetObjectId=/1",
  "EnvelopeHeaderSetId=envelope_header_set",
  BEGIN_ARGUMENTS,
  "<strictArray length=\"8\"><boolean>true</boolean>"
  "<boolean>false</"boolean>"
  "<boolean>false</boolean><undefined/><undefined/>"
  "<boolean>true</boolean>"
  "<undefined/><undefined/></strictArray>",
  END_ARGUMENTS,
  MESSAGE,
  "Method=EchoAMF.EchoAMF.EchoAny",
  "TargetObjectId=/2",
  BEGIN_ARGUMENTS,
  "<strictArray length=\"8\"><boolean>true</boolean>"
  "<boolean>false</"boolean>"
  "<boolean>false</boolean><undefined/><undefined/>"
  "<boolean>true</boolean><undefined/><undefined/>"
  "</strictArray>",
  END_ARGUMENTS,
  MESSAGE,
  "Method=EchoAMF.EchoAMF.EchoAny",
  "TargetObjectId=/3",
  "EnvelopeHeaderSetId=envelope_header_set_1",
  BEGIN_ARGUMENTS,
  "<strictArray length=\"8\"><boolean>true</boolean>"
  "<boolean>false</boolean><boolean>false</boolean>"
  "<undefined/><undefined/><boolean>true</boolean>"
  "<undefined/><undefined/></strictArray>",
  END_ARGUMENTS,
  LAST );