Help creating a "Hello World" sample

I need some help trying to get a simple “Hello World” application working. I’ve created 3 xml files (see attached) all of which have been uploaded to my luup files. On the create device screen I specified my “D_HelloWorld1.xml” and “I_HelloWorld1.xml” files along with a description. The other fields I left blank (Device type, Internal ID, IP Address, MAC). After I added the device I reloaded the unit. Once it was refreshed I found that the device id for it was 12 so using HTTP get I tested it to see if I can get “Hello World” from the device.

“GET /data_request?id=action&DeviceNum=12&serviceId=urn:upnp-org:serviceId:HelloWorld1&action=GetTarget”

Whenever I execute this I keep getting “ERROR: Invalid Service” returned to me.
I use HTTP gets for all of my other devices and all work fine so I know it is something I defined incorrectly in one of these 3 files. I think I understand the structure but I’m a little foggy on what names I can use whenever I create a new service. I assumed that so long as it was unique and referenced properly in the I_HelloWorld1.xml file everything would work.

In D_HelloWorld1.xml I have defined the service using the following names. Is there maybe something wrong with the names that I chose?

serviceType = urn:schemas-upnp-org:service:HelloWorld:1
serviceId = urn:upnp-org:serviceId:HelloWorld1

D_HelloWorld1.xml

<?xml version="1.0"?>
<root xmlns="urn:schemas-upnp-org:device-1-0">
  <specVersion>
    <major>1</major>
    <minor>0</minor>
  </specVersion>
  <device>
    <deviceType>urn:schemas-upnp-org:device:testdevice:1</deviceType>
    <serviceList>
		<service>
			<serviceType>urn:schemas-upnp-org:service:HelloWorld:1</serviceType>
			<serviceId>urn:upnp-org:serviceId:HelloWorld1</serviceId>
			<SCPDURL>S_HelloWorld1.xml</SCPDURL>
		</service>
    </serviceList>
    <implementationList>
      <implementationFile>I_HelloWorld1.xml</implementationFile>
    </implementationList>
  </device>
</root>

I_HelloWorld1.xml

<?xml version="1.0"?>
<implementation>
  <actionList>
    <action>
      <serviceId>urn:upnp-org:serviceId:HelloWorld1</serviceId>
      <name>GetTarget</name>
      <run>
			luup.variable_set("urn:upnp-org:serviceId:HelloWorld1", "Target", "Hello World", lul_device)
      </run>
    </action>
   </actionList>
</implementation>

S_HelloWorld1.xml

<?xml version="1.0"?>
<scpd xmlns="urn:schemas-upnp-org:service-1-0">
  <specVersion>
    <major>1</major>
    <minor>0</minor>
  </specVersion>
  <serviceStateTable>
    <stateVariable sendEvents="no">
      <name>Target</name>
      <sendEventsAttribute>no</sendEventsAttribute> 
      <dataType>string</dataType>
      <defaultValue></defaultValue>
    </stateVariable>
  </serviceStateTable>
  <actionList>
    <name>GetTarget</name>
      <argumentList>
        <argument>
          <name>RetTargetValue</name>
          <direction>out</direction>
          <relatedStateVariable>Target</relatedStateVariable>
        </argument>
      </argumentList>
    </action>
    <action>
   </actionList>
</scpd>

You should ALWAYS run your XML files through a structure verification tool.
Try:

<?xml version="1.0"?>
<scpd xmlns="urn:schemas-upnp-org:service-1-0">
  <specVersion>
    <major>1</major>
    <minor>0</minor>
  </specVersion>
  <serviceStateTable>
    <stateVariable sendEvents="no">
      <name>Target</name>
      <sendEventsAttribute>no</sendEventsAttribute> 
      <dataType>string</dataType>
      <defaultValue></defaultValue>
    </stateVariable>
  </serviceStateTable>
  <actionList>
    <action>
      <name>GetTarget</name>
    <argumentList>
      <argument>
        <name>RetTargetValue</name>
        <direction>out</direction>
        <relatedStateVariable>Target</relatedStateVariable>
      </argument>
    </argumentList>
    </action>
  </actionList>
</scpd>

Thanks a bunch! Indeed, I really should have verified that first before posting.
For those interested, I also had to change the “run” xml node to “job”. With Richard’s revised “S_HelloWorld1.xml” file and this “I_HelloWorld1.xml” file this example works perfectly.

<?xml version="1.0"?>
<implementation>
  <actionList>
    <action>
      <serviceId>urn:upnp-org:serviceId:HelloWorld1</serviceId>
      <name>GetTarget</name>
      <job>
			luup.variable_set("urn:upnp-org:serviceId:HelloWorld1", "Target", "Hello World", lul_device)
			return 4, 5
      </job>
    </action>
   </actionList>
</implementation>

Run should have worked.

Job is for things that take time … like making a web or ping request.

You’re right. It looks like I made 2 changes to the implementation file, that, and I added the “return 4, 5” line. I changed job back to run and it still works so I guess it was only the return line that I needed.