arunpuriqi
Posts: 1
Joined: Mon Aug 29, 2016 11:19 am

Problem with AddUserWithUserTemplate

Mon Aug 29, 2016 11:30 am

I am using AddUserWithUserTemplate service on my server to create a new user.
This is the template response when I query for it using GetUserTemplates

Code: Select all

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Body>
      <GetUserTemplatesResponse xmlns="http://gpsgate.com/services/">
         <GetUserTemplatesResult>
            <SoapUserTemplate>
               <ID>16</ID>
               <Name>Test</Name>
               <Items>
                  <SoapUserTemplateItem>
                     <FieldID>userType.visible</FieldID>
                     <Required>false</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>username</FieldID>
                     <Required>true</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>password</FieldID>
                     <Required>false</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>name</FieldID>
                     <Required>true</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>surname</FieldID>
                     <Required>false</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>email</FieldID>
                     <Required>false</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>phoneNumber</FieldID>
                     <Required>false</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>description</FieldID>
                     <Required>false</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>expectedFuelConsumption</FieldID>
                     <Required>false</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>driverInfo.visible</FieldID>
                     <Required>false</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>driverInfo.driverID</FieldID>
                     <Required>false</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>driverInfo.defaultVehicle</FieldID>
                     <Required>false</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>roles</FieldID>
                     <Required>false</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>tags</FieldID>
                     <Required>false</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>device1.visible</FieldID>
                     <Required>false</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>device1.deviceDefinitionID</FieldID>
                     <Required>false</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>device1.deviceMapperID</FieldID>
                     <Required>true</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>device1.deviceIMEI</FieldID>
                     <Required>false</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>device1.devicePhoneNumber</FieldID>
                     <Required>false</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>device1.deviceStaticIP</FieldID>
                     <Required>false</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>device1.devicePassword</FieldID>
                     <Required>false</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>device1.deviceOperatorCountry</FieldID>
                     <Required>false</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>device1.deviceMobileNetworkID</FieldID>
                     <Required>false</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>device1.deviceAPN</FieldID>
                     <Required>false</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>device1.deviceGprsUsername</FieldID>
                     <Required>false</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>device1.deviceGprsPassword</FieldID>
                     <Required>false</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>device2.visible</FieldID>
                     <Required>false</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>device2.deviceDefinitionID</FieldID>
                     <Required>false</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>device2.deviceMapperID</FieldID>
                     <Required>true</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>device2.deviceIMEI</FieldID>
                     <Required>false</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>device2.devicePhoneNumber</FieldID>
                     <Required>false</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>device2.deviceStaticIP</FieldID>
                     <Required>false</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>device2.devicePassword</FieldID>
                     <Required>false</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>device2.deviceOperatorCountry</FieldID>
                     <Required>false</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>device2.deviceMobileNetworkID</FieldID>
                     <Required>false</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>device2.deviceAPN</FieldID>
                     <Required>false</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>device2.deviceGprsUsername</FieldID>
                     <Required>false</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>device2.deviceGprsPassword</FieldID>
                     <Required>false</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>device3.visible</FieldID>
                     <Required>false</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>device3.deviceDefinitionID</FieldID>
                     <Required>false</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>device3.deviceMapperID</FieldID>
                     <Required>true</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>device3.deviceIMEI</FieldID>
                     <Required>false</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>device3.devicePhoneNumber</FieldID>
                     <Required>false</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>device3.deviceStaticIP</FieldID>
                     <Required>false</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>device3.devicePassword</FieldID>
                     <Required>false</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>device3.deviceOperatorCountry</FieldID>
                     <Required>false</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>device3.deviceMobileNetworkID</FieldID>
                     <Required>false</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>device3.deviceAPN</FieldID>
                     <Required>false</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>device3.deviceGprsUsername</FieldID>
                     <Required>false</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>device3.deviceGprsPassword</FieldID>
                     <Required>false</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>trackRecorder.visible</FieldID>
                     <Required>false</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>markerColor</FieldID>
                     <Required>false</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>markerIconID</FieldID>
                     <Required>false</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>accumulators</FieldID>
                     <Required>false</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>customFieldTemplateID</FieldID>
                     <Required>false</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
                  <SoapUserTemplateItem>
                     <FieldID>odometer.useDeviceOdometer</FieldID>
                     <Required>false</Required>
                     <Visible>true</Visible>
                  </SoapUserTemplateItem>
               </Items>
            </SoapUserTemplate>
         </GetUserTemplatesResult>
      </GetUserTemplatesResponse>
   </soap:Body>
</soap:Envelope>
I use the following SOAP code to call AddUserWithUserTemplate function.

Code: Select all

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
        <AddUserWithUserTemplate xmlns="http://gpsgate.com/services/">
            <strSessionID>AAAAAAAAAAAAAAAAAAAA</strSessionID>
            <iApplicationID>0000</iApplicationID>
            <iUserTemplateID>16</iUserTemplateID>
            <strName>acme</strName>
            <strUsername>acme</strUsername>
            <strPassword>acme</strPassword>
            <strDescription>acme</strDescription>
        </AddUserWithUserTemplate>
    </soap:Body>
</soap:Envelope>
The user gets added but I always get the following response.

Code: Select all

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Body>
      <soap:Fault>
         <faultcode>soap:Server</faultcode>
         <faultstring>Server was unable to process request. ---> Object reference not set to an instance of an object.</faultstring>
         <detail/>
      </soap:Fault>
   </soap:Body>
</soap:Envelope>

Also, whenever I try to edit such a user on the web UI it throws following error

[img]
http://imgur.com/a/f6nLk
[/img]

If I create a user using UI with same template I do not get any error and editing user from web does not throw any error as well.

The patch version on server is

Patch.v4 [Patch] 4.0.0.4410

This service was working fine on older version of patch (I believer it was 4.0.0.4002)

I am stumped totally on ways to resolve this. My system depends upon this functionality. Please help out!

User avatar
johan
GpsGate
Posts: 15403
Joined: Wed Aug 04, 2004 10:40 pm
Location: Sweden
Contact: Website

Re: Problem with AddUserWithUserTemplate

Mon Aug 29, 2016 2:18 pm

Please update Patch.v4 from beta.gpsgate.com

1. Login to SiteAdmin
2. Go to Plugins
3. Change URL to beta.gpsgate.com
4. Update Patch.v4

This should resolve the issue. Let us know if you have any problems.
Regards,
Johan

GpsGate Support

Return to “GpsGate for Developers”