Trying to get soapclient add xsi:type to request









up vote
1
down vote

favorite












So Im passing a field of array items to a web service call and the request and response looks ok, but Im trying to get the Value attribute to tell the type, so this is my fields:



$fields = array(
"Password"=>'password',
"entity"=>array(
"Name" =>"namehere",
"Id"=>'1234',
"Attributes"=>
array(
array(
"AttributeType"=>'SingleLineOfText',
"Key"=>'Key1',
"Value"=>'1',
),
array(
"AttributeType"=>'SingleLineOfText',
"Key"=>'Key2',
"Value"=>'2',
),
array(
"AttributeType"=>'DateAndTime',
"Key"=>'Key3',
"Value"=>'2016-09-16T00:00:00'
)

)
)
);


So my REQUEST is :



<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-
ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="http://tempuri.org/"><SOAP-ENV:Body><ns1:Create>
<ns1:Password>password</ns1:Password><ns1:entity>
<ns1:Name>namehere</ns1:Name><ns1:Id>1234</ns1:Id><ns1:Attributes><ns1:Attribute>
<ns1:AttributeType>SingleLineOfText</ns1:AttributeType>
<ns1:Key>Key1</ns1:Key><ns1:Value>1</ns1:Value>
</ns1:Attribute><ns1:Attribute>
<ns1:AttributeType>SingleLineOfText</ns1:AttributeType>
<ns1:Key>Key2</ns1:Key><ns1:Value>2</ns1:Value>
</ns1:Attribute><ns1:Attribute>
<ns1:AttributeType>DateAndTime</ns1:AttributeType>
<ns1:Key>Key3</ns1:Key><ns1:Value>2016-09-16T00:00:00</ns1:Value></ns1:Attribute></ns1:Attributes></ns1:entity>
</ns1:Create></SOAP-ENV:Body></SOAP-ENV:Envelope>


So you can see < ns1:Value >1< /ns1:Value > but I need it to be like able to determine what the type is so like < Value xsi:type="xsd:string" >1< /Value> or < Value xsi:type="xsd:dateTime" >2016-09-16T00:00:00< /Value> if its a date field, I have tried to do loop through and assign it but it does not seem to work, here is the loop I have tried



foreach($fields['entity']['Attributes'] as $attribute)
echo $attribute['Value'] = new SoapVar($attribute, XSD_STRING, "string", "http://www.w3.org/2001/XMLSchema");










share|improve this question

























    up vote
    1
    down vote

    favorite












    So Im passing a field of array items to a web service call and the request and response looks ok, but Im trying to get the Value attribute to tell the type, so this is my fields:



    $fields = array(
    "Password"=>'password',
    "entity"=>array(
    "Name" =>"namehere",
    "Id"=>'1234',
    "Attributes"=>
    array(
    array(
    "AttributeType"=>'SingleLineOfText',
    "Key"=>'Key1',
    "Value"=>'1',
    ),
    array(
    "AttributeType"=>'SingleLineOfText',
    "Key"=>'Key2',
    "Value"=>'2',
    ),
    array(
    "AttributeType"=>'DateAndTime',
    "Key"=>'Key3',
    "Value"=>'2016-09-16T00:00:00'
    )

    )
    )
    );


    So my REQUEST is :



    <?xml version="1.0" encoding="UTF-8"?>
    <SOAP-ENV:Envelope xmlns:SOAP-
    ENV="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:ns1="http://tempuri.org/"><SOAP-ENV:Body><ns1:Create>
    <ns1:Password>password</ns1:Password><ns1:entity>
    <ns1:Name>namehere</ns1:Name><ns1:Id>1234</ns1:Id><ns1:Attributes><ns1:Attribute>
    <ns1:AttributeType>SingleLineOfText</ns1:AttributeType>
    <ns1:Key>Key1</ns1:Key><ns1:Value>1</ns1:Value>
    </ns1:Attribute><ns1:Attribute>
    <ns1:AttributeType>SingleLineOfText</ns1:AttributeType>
    <ns1:Key>Key2</ns1:Key><ns1:Value>2</ns1:Value>
    </ns1:Attribute><ns1:Attribute>
    <ns1:AttributeType>DateAndTime</ns1:AttributeType>
    <ns1:Key>Key3</ns1:Key><ns1:Value>2016-09-16T00:00:00</ns1:Value></ns1:Attribute></ns1:Attributes></ns1:entity>
    </ns1:Create></SOAP-ENV:Body></SOAP-ENV:Envelope>


    So you can see < ns1:Value >1< /ns1:Value > but I need it to be like able to determine what the type is so like < Value xsi:type="xsd:string" >1< /Value> or < Value xsi:type="xsd:dateTime" >2016-09-16T00:00:00< /Value> if its a date field, I have tried to do loop through and assign it but it does not seem to work, here is the loop I have tried



    foreach($fields['entity']['Attributes'] as $attribute)
    echo $attribute['Value'] = new SoapVar($attribute, XSD_STRING, "string", "http://www.w3.org/2001/XMLSchema");










    share|improve this question























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      So Im passing a field of array items to a web service call and the request and response looks ok, but Im trying to get the Value attribute to tell the type, so this is my fields:



      $fields = array(
      "Password"=>'password',
      "entity"=>array(
      "Name" =>"namehere",
      "Id"=>'1234',
      "Attributes"=>
      array(
      array(
      "AttributeType"=>'SingleLineOfText',
      "Key"=>'Key1',
      "Value"=>'1',
      ),
      array(
      "AttributeType"=>'SingleLineOfText',
      "Key"=>'Key2',
      "Value"=>'2',
      ),
      array(
      "AttributeType"=>'DateAndTime',
      "Key"=>'Key3',
      "Value"=>'2016-09-16T00:00:00'
      )

      )
      )
      );


      So my REQUEST is :



      <?xml version="1.0" encoding="UTF-8"?>
      <SOAP-ENV:Envelope xmlns:SOAP-
      ENV="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:ns1="http://tempuri.org/"><SOAP-ENV:Body><ns1:Create>
      <ns1:Password>password</ns1:Password><ns1:entity>
      <ns1:Name>namehere</ns1:Name><ns1:Id>1234</ns1:Id><ns1:Attributes><ns1:Attribute>
      <ns1:AttributeType>SingleLineOfText</ns1:AttributeType>
      <ns1:Key>Key1</ns1:Key><ns1:Value>1</ns1:Value>
      </ns1:Attribute><ns1:Attribute>
      <ns1:AttributeType>SingleLineOfText</ns1:AttributeType>
      <ns1:Key>Key2</ns1:Key><ns1:Value>2</ns1:Value>
      </ns1:Attribute><ns1:Attribute>
      <ns1:AttributeType>DateAndTime</ns1:AttributeType>
      <ns1:Key>Key3</ns1:Key><ns1:Value>2016-09-16T00:00:00</ns1:Value></ns1:Attribute></ns1:Attributes></ns1:entity>
      </ns1:Create></SOAP-ENV:Body></SOAP-ENV:Envelope>


      So you can see < ns1:Value >1< /ns1:Value > but I need it to be like able to determine what the type is so like < Value xsi:type="xsd:string" >1< /Value> or < Value xsi:type="xsd:dateTime" >2016-09-16T00:00:00< /Value> if its a date field, I have tried to do loop through and assign it but it does not seem to work, here is the loop I have tried



      foreach($fields['entity']['Attributes'] as $attribute)
      echo $attribute['Value'] = new SoapVar($attribute, XSD_STRING, "string", "http://www.w3.org/2001/XMLSchema");










      share|improve this question













      So Im passing a field of array items to a web service call and the request and response looks ok, but Im trying to get the Value attribute to tell the type, so this is my fields:



      $fields = array(
      "Password"=>'password',
      "entity"=>array(
      "Name" =>"namehere",
      "Id"=>'1234',
      "Attributes"=>
      array(
      array(
      "AttributeType"=>'SingleLineOfText',
      "Key"=>'Key1',
      "Value"=>'1',
      ),
      array(
      "AttributeType"=>'SingleLineOfText',
      "Key"=>'Key2',
      "Value"=>'2',
      ),
      array(
      "AttributeType"=>'DateAndTime',
      "Key"=>'Key3',
      "Value"=>'2016-09-16T00:00:00'
      )

      )
      )
      );


      So my REQUEST is :



      <?xml version="1.0" encoding="UTF-8"?>
      <SOAP-ENV:Envelope xmlns:SOAP-
      ENV="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:ns1="http://tempuri.org/"><SOAP-ENV:Body><ns1:Create>
      <ns1:Password>password</ns1:Password><ns1:entity>
      <ns1:Name>namehere</ns1:Name><ns1:Id>1234</ns1:Id><ns1:Attributes><ns1:Attribute>
      <ns1:AttributeType>SingleLineOfText</ns1:AttributeType>
      <ns1:Key>Key1</ns1:Key><ns1:Value>1</ns1:Value>
      </ns1:Attribute><ns1:Attribute>
      <ns1:AttributeType>SingleLineOfText</ns1:AttributeType>
      <ns1:Key>Key2</ns1:Key><ns1:Value>2</ns1:Value>
      </ns1:Attribute><ns1:Attribute>
      <ns1:AttributeType>DateAndTime</ns1:AttributeType>
      <ns1:Key>Key3</ns1:Key><ns1:Value>2016-09-16T00:00:00</ns1:Value></ns1:Attribute></ns1:Attributes></ns1:entity>
      </ns1:Create></SOAP-ENV:Body></SOAP-ENV:Envelope>


      So you can see < ns1:Value >1< /ns1:Value > but I need it to be like able to determine what the type is so like < Value xsi:type="xsd:string" >1< /Value> or < Value xsi:type="xsd:dateTime" >2016-09-16T00:00:00< /Value> if its a date field, I have tried to do loop through and assign it but it does not seem to work, here is the loop I have tried



      foreach($fields['entity']['Attributes'] as $attribute)
      echo $attribute['Value'] = new SoapVar($attribute, XSD_STRING, "string", "http://www.w3.org/2001/XMLSchema");







      php arrays soap






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 9 at 21:32









      LookingToHelp

      61




      61



























          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53233522%2ftrying-to-get-soapclient-add-xsitype-to-request%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53233522%2ftrying-to-get-soapclient-add-xsitype-to-request%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Use pre created SQLite database for Android project in kotlin

          Darth Vader #20

          Ondo