How to pass parameter to IUPnPService.InvokeAction?

I have define the following SCPD document for my UPnP device:

<?xml version="1.0"?>
<scpd xmlns="urn:schemas-upnp-org:service-1-0" >
    <specVersion>
    <major>1</major>
    <minor>0</minor>
    </specVersion>
    <actionList>
    <action>
        <name>Echo</name>
        <argumentList>
        <argument>
            <name>InText</name>
            <relatedStateVariable>Text</relatedStateVariable>
            <direction>in</direction>
        </argument>
        <argument>
            <name>ReturnText</name>
            <relatedStateVariable>Text</relatedStateVariable>
            <direction>out</direction>
        </argument>
        </argumentList>
    </action>
    </actionList>
    <serviceStateTable>
    <stateVariable sendEvents="no">
        <name>Text</name>
        <dataType>string</dataType>
    </stateVariable>
    </serviceStateTable>
</scpd>

I registered my UPnP device too. I also able to retrieve my UPnPDevice. How am I going to invoke the echo action as defined in SCPD document?

The code to invoke action should be something like:

var o: IUPnPDeviceFinder;
    d: IUPnPDevice;
    s: IUPnPService;
    E: IEnumVARIANT;
    K: OleVariant;
    iFetched: Cardinal;
    V1, V2: OleVariant;
    r: HRESULT;
begin
  o := CoUPnPDeviceFinder.Create;
  d := o.FindByUDN('uuid:a6d332da-f8ce-43ce-8210-79eacd4231c6');

  E := d.Services._NewEnum as IEnumVARIANT;
  E.Reset;
  CheckOSError(E.Next(1, K, iFetched));

  s := IDispatch(K) as IUPnPService;

  r := s.InvokeAction('Echo', v1, v2);
  ShowMessage(v2);
end;

How to form v1 and v2 parameters for InvokeAction?

Answers


According to MSDN Docs you should pass arguments as a Variant Array. In Delphi you can use VarArrayOf or VarArrayCreate function


Need Your Help

Configure JCache implementation in Spring

spring ehcache jcache

Looking at the Ehcahce implementation of net.sf.cache.JS107, I am trying to achieve the following code snippet to produce the JCache implementation as a Spring managed bean..