POST
|
Thanks Kevin. I did go ahead and use warning messages and that's giving me what I need. TT
... View more
05-27-2014
09:14 AM
|
0
|
0
|
236
|
POST
|
I have a geoprocessing service that takes a list of x,y locations, snaps them to a road network and reports information about the snapped location (snapped x y, milepost, milepost offset ect...). This service will sometimes be called with a very large list of locations to process (>10,000) and I want to track the progress of the script. The process will be initiated by a user from a javascript based application. If I enable Info message level reporting on the service I can use arcpy.AddMessage in the python script that implements the service to report % completion as I work through the list of locations on the server. But this also parrots back all the input parameters (including the entire list of locations) on every call to checkStatus. Very verbose. I'm searching for a way to report back % completion of the script without having each checkStatus request containing such a large payload. I tried using the Upload capability of geoprocessing services to upload the large locations list and rewrote the geoprocessing script to accept a GPDataFile parameter of the form, {itemID: "guid"}, thinking that the messages returned in the checkStatus would just parrot back the {itemID: "guid"}; but it doesn't, it still sends back the entire locations list in the messages on checkStatus calls. Any idea's on how I can accomplish tracking without exchanging such large messages? I thought about just enabling warning level messages and using arcpy.AddWarning to report % completion but that just seems like using an inappropriate messaging system to report informative messages. Tom AZ Dept. of Transportation
... View more
05-27-2014
07:14 AM
|
0
|
2
|
374
|
POST
|
I'm encountering this issue also. In my code I'm extending esri/layers/GraphicsLayer as follows: in a file my/GL.js define(["dojo/_base/declare", "esri/layers/GraphicsLayer"], function (declare, esriGL) {
return declare(esriGL, {
constructor: function (options, graphics, symbol) {
// graphics & symbol arguments optional
// if present, do something interesting with them
}
});
}); then sometimes my GL gets called like this: require(["my/GL"], function (myGL) {
var gl = new myGL({id: "someId"}, null, null);
}); This code runs successfully in 3.8 but fails in 3.9. I suspect that at @ 3.9 esri/layers/GraphicsLayer is looking for some newly introduced, undocumented 2nd parameter in its constructor (or some other dojo declare lifecycle function), is finding null and throwing a "plugins" error similar to what tcoopman describes. However, even when I augment my custom layer with a dojo preamble function, which should result in the null arguments not getting passed along to the superclass's constructor, I still get the error. So I'm not really sure what's going on?? define(["dojo/_base/declare", "esri/layers/GraphicsLayer"], function (declare, esriGL) {
return declare(esriGL, {
preamble: function (options, graphics, symbol) { return [options]; },
constructor: function (options, graphics, symbol) {
// graphics & symbol arguments optional
// if present, do something interesting with them
}
});
}); Tom Az Dept. of Transportation
... View more
04-17-2014
10:33 AM
|
0
|
3
|
637
|
POST
|
I wanted to see what ArcGIS Server was actually passing into the MyCustomTypeCollection constructor and I believe the answer is nothing.
public MyCustomTypeCollection(string namespaceURI) : base(namespaceURI)
{
SoapSOE1.logger.LogMessage(ServerLogger.msgType.warning, "collection constructor", -1, namespaceURI);
}
The construction fails (see image of log) and I'm assuming that is because Server is trying to invoke a no parameter constructor and not finding one; hence the behavior change outlined in the previous post when changing to a hard coded namespace. [ATTACH=CONFIG]19787[/ATTACH] I got that pattern from the CustomLayerInfos constructor in ESRI's FindNearFeaturesSoapSOE sample. That CustomLayerInfos object is a Server output though, not an input so apparently that idiom only applies to outputs of a soap service. TT
... View more
12-07-2012
05:55 AM
|
0
|
0
|
406
|
POST
|
No, I don't have a working debugger; ArcGIS Server is on a different machine than my development workstation. I have been logging for debugging. Using the runtime type name without any other casting still doesn't work.
logger.LogMessage(ServerLogger.msgType.warning, "segment extraction", -1, typeof(MyCustomTypeCollection).Name);
object myTypeColl = reqParams.GetObject(idx, c_ns_soe, typeof(MyCustomTypeCollection).Name);
Logger output: [ATTACH=CONFIG]19783[/ATTACH] Comment out that GetObject call and it runs without problem. My xml/soap comfort level is not that high and I get tangled up in namespace issues but I was thinking more about the change in behavior (throwing a invalid cast instead of the HRESULT: 0x80043068 error)when going from a passed in namespace
public MyCustomTypeCollection(string namespaceURI) : base(namespaceURI) { }
to a hardcoded one
public MyCustomTypeCollection() : base("http://www.myOrg.com/schemas/1.0") { }
In the "passed in" case ArcGIS Server is supplying the namespace when instantiating MyCustomTypeCollection. How is the namespace being set when it instantiates the MyCustomType's contained in that collection? I order to get something up and running now I rewrote the service to take a string and I have the client build a delimited string of the MyCustomType payload data. Thanks again for the help.
... View more
12-07-2012
04:58 AM
|
0
|
0
|
406
|
POST
|
I do have an entry in XmlSupportAdot.dat for MyCustomTypeCollection. I modified the constructor on my collection class to also use a static string and I do have a change of behaviour - I'm now getting invalid cast exception. I'll have to play around with this more to see what is happening. [ATTACH=CONFIG]19734[/ATTACH] Since I have been able to get a working method that I can pass a custom object to, I also considered passing the collection as an attribute on a custom object but got bogged down in the wsdl syntax and the serialize/deserialize code for that scenario. Do you have any examples of what that looks like? Thanks, Tom
... View more
12-05-2012
01:01 PM
|
0
|
0
|
406
|
POST
|
Erin, Thank you for your response and your carefully written questions and responses on this thread - they've helped me digest the many layers of abstraction that go along with SOAP SOE's (difficult, even with having experience writing REST SOE's). I now have an SOE working that has methods for passing in string, string[] and a custom type and outputting string, string[] and arrays of custom types but still have been unsuccessful writing a method that takes an array of custom types as input. The critical parts of my code are listed below: wsdl <xs:element name="TestArrayArguments">
<xs:complexType>
<xs:sequence>
<xs:element name="aCustomTypeCollection" type="tns:MyCustomTypeCollection" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="MyCustomTypeCollection">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="MyCustomType" type="tns:MyCustomType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="MyCustomType">
<xs:sequence>
<xs:element name="ID" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:element name="TestArrayArgumentsResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="Result" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
<message name="TestArrayArgumentsIn">
<part name="parameters" element="e:TestArrayArguments" />
</message>
<message name="TestArrayArgumentsOut">
<part name="parameters" element="e:TestArrayArgumentsResponse" />
</message>
<operation name="TestArrayArguments">
<input message="e:TestArrayArgumentsIn" />
<output message="e:TestArrayArgumentsOut" />
</operation>
server side SOE code:
private void TestArrayArguments(IMessage reqMsg, IMessage respMsg)
{
IXMLSerializeData reqParams = reqMsg.Parameters;
string retString = "";
int idx = reqParams.Find("aCustomTypeCollection");
if (idx == -1)
throw new ArgumentNullException("PROBLEM MAPPING FIELD TO INDEX");
retString += "field index is " + idx;
MyCustomTypeCollection myTypeColl = (MyCustomTypeCollection)reqParams.GetObject(idx, c_ns_soe, "MyCustomTypeCollection");
respMsg.Name = "TestArrayArgumentsResponse";
respMsg.NamespaceURI = c_ns_soe;
respMsg.Parameters.AddString("Result", retString);
}
My custom types:
using System;
using System.Runtime.InteropServices;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.SOESupport;
namespace SoapSOE1
{
[ComVisible(true)]
[Guid("FCA9A8B6-4B78-45CB-B240-AEA7A6E2F489")]
[ClassInterface(ClassInterfaceType.None)]
public class MyCustomType : IXMLSerialize
{
public string ID { get; set; }
public void Serialize(IXMLSerializeData data)
{
data.TypeName = this.GetType().Name;
data.TypeNamespaceURI = SoapSOE1.c_ns_soe;
data.AddString("ID", ID);
}
public void Deserialize(IXMLSerializeData data)
{
int idx = FindMandatoryParam("ID", data);
this.ID = data.GetString(idx);
}
private int FindMandatoryParam(string fieldName, IXMLSerializeData data)
{
int idx = data.Find(fieldName);
if (idx == -1)
throw new MissingMandatoryFieldException(fieldName);
return idx;
}
internal class MissingMandatoryFieldException : Exception
{
internal MissingMandatoryFieldException(string fieldName) : base("Missing mandatory field: " + fieldName) { }
}
}
[ComVisible(true)]
[Guid("D2BC82CA-F8C5-46AD-BFD6-0B80760A351E")]
[ClassInterface(ClassInterfaceType.None)]
public class MyCustomTypeCollection : SerializableList<MyCustomType>
{
public MyCustomTypeCollection(string namespaceURI) : base(namespaceURI) { }
}
}
I've carefully constructed my XmlSupportAdot.dat file (everything works if I just send an instance of my custom type and not an array so I know this file is getting seen). I've registered my dll on the server as described in NIM083300. I'm getting the same "Exception from HRESULT: 0x80043068" you describe when executing the GetObject call. If I comment out that line I get no error and can see that the field is correctly mapped to index zero. At this point I'm not trying to access the contents of the input array, I'm just trying to instantiate MyCustomTypeCollection using the GetObject call. Attached is a snapshot of the HTTP calls taking place when I try to invoke the SOE method from a client. [ATTACH=CONFIG]19719[/ATTACH] I'd greatly appreciate any suggestions you may have. Have you been successful in doing this before? Thank you for your time, Tom AZ Dept of Transportation
... View more
12-05-2012
06:52 AM
|
0
|
0
|
665
|
POST
|
Erin, the originator of this thread, writes that a SOAP SOE was written that successfully sends an array of strings as input. I have a working SOAP SOE that takes a custom type but have had no luck with sending arrays (either with my custom type or even with simple types). Does any one know of samples out there that show the correct syntax for this?
... View more
11-21-2012
10:06 AM
|
0
|
0
|
665
|
POST
|
I got help with a workaround on the other side of this issue, so I'm back with an in_memory workspace. Thanks for all your assistance. Tom AzDOT
... View more
09-13-2012
01:55 PM
|
0
|
0
|
419
|
POST
|
Leaving off the default parameters didn't work, also tried mzcoyle suggesting about putting the field info in a list and iterating through the list when adding fields - similiarly, no work. What's happening in the showGpMessage call in the latest code sample? All the AV setting's are disabled; going to have to work the AV issue with IT before I can test it.
... View more
09-13-2012
11:29 AM
|
0
|
0
|
419
|
POST
|
They're running Microsoft Forefront Endpoint on workstations and servers. The problem with the pre-built template is that I don't know what fields I'll be adding until run time. I'm reading through xml that defines the schema as well as carrying the data that will end up in the feature classes; and dynamically building the fc's based upon what I find in the xml. [ATTACH=CONFIG]17675[/ATTACH]
... View more
09-13-2012
10:18 AM
|
0
|
0
|
419
|
POST
|
I'd like to investigate the role that antivirus software has on this but I have no control over that environment, either on my workstation or on the ArcGIS Server machine, where this script is ultimately headed. Given the new problems I'm having regarding in_memory datasets I'm wondering if anyone has any further ideas on this problem?
... View more
09-13-2012
09:05 AM
|
0
|
0
|
741
|
POST
|
Hoping to repeat the lightening fast resolution to an earlier question I posted, I'd like to ask for help with this follow on to my original issue. The solution to my first post involved using an in_memory workspace to build feature classes. My current issue is that I need to publish that geo proc to ArcGIS Server 10.1, but the publish fails with a consolidating data failure error. The following code focuses the core issue: import arcpy if __name__ == '__main__': fc = arcpy.CreateFeatureclass_management("in_memory", "fc1", "POINT", "", "DISABLED", "DISABLED", "", "", "0", "0", "0") arcpy.Delete_management(fc) If you create a script tool around this code, run it and try and publish the result to AGS you are alerted that the in_memory workspace has been identified as needing to be copied to AGS. [ATTACH=CONFIG]17644[/ATTACH] Continuing with the publish fails. [ATTACH=CONFIG]17645[/ATTACH] I've tried adding "in_memory" as a registered folder in AGS Data Store but that doesn't work. Any ideas?
... View more
09-12-2012
09:05 PM
|
0
|
2
|
4331
|
POST
|
Curtis's suggestion about building and adding fields to an in memory feature class did the trick. Here's the final code. Thanks everyone. TT
import arcpy
import os, sys
def addCoreFields(fc):
arcpy.AddField_management(fc, "AssetObjectId", "LONG", "", "", "", "", "NULLABLE", "NON_REQUIRED", "")
arcpy.AddField_management(fc, "AssetId", "LONG", "", "", "", "", "NULLABLE", "NON_REQUIRED", "")
arcpy.AddField_management(fc, "AssetObjectStatus", "TEXT", "", "", "32", "", "NULLABLE", "NON_REQUIRED", "")
arcpy.AddField_management(fc, "Status", "TEXT", "", "", "32", "", "NULLABLE", "NON_REQUIRED", "")
arcpy.AddField_management(fc, "Feature", "TEXT", "", "", "32", "", "NULLABLE", "NON_REQUIRED", "")
arcpy.AddField_management(fc, "SubFeature", "TEXT", "", "", "32", "", "NULLABLE", "NON_REQUIRED", "")
arcpy.AddField_management(fc, "AssetCode", "TEXT", "", "", "32", "", "NULLABLE", "NON_REQUIRED", "")
arcpy.AddField_management(fc, "LaneLocation", "TEXT", "", "", "32", "", "NULLABLE", "NON_REQUIRED", "")
arcpy.AddField_management(fc, "Route", "TEXT", "", "", "32", "", "NULLABLE", "NON_REQUIRED", "")
arcpy.AddField_management(fc, "FromMilepost", "LONG", "", "", "", "", "NULLABLE", "NON_REQUIRED", "")
arcpy.AddField_management(fc, "FromOffset", "DOUBLE", "", "", "", "", "NULLABLE", "NON_REQUIRED", "")
arcpy.AddField_management(fc, "ToMilepost", "LONG", "", "", "", "", "NULLABLE", "NON_REQUIRED", "")
arcpy.AddField_management(fc, "ToOffset", "DOUBLE", "", "", "", "", "NULLABLE", "NON_REQUIRED", "")
if __name__ == '__main__':
scriptPath = sys.path[0]
dataGDB = os.path.join(scriptPath, "data.gdb")
if arcpy.Exists(dataGDB): arcpy.Delete_management(dataGDB)
arcpy.CreateFileGDB_management(scriptPath, "data")
for name in ['one', 'two', 'three']:
fc = arcpy.CreateFeatureclass_management("in_memory", name, "POINT", "", "DISABLED", "DISABLED", "", "", "0", "0", "0")
addCoreFields(fc)
arcpy.CopyFeatures_management(fc, os.path.join(dataGDB, name))
arcpy.Delete_management(fc)
... View more
09-11-2012
09:51 AM
|
0
|
0
|
741
|
POST
|
Yes, its always the AddField tool that causes the problem. Your comment about not releasing locks fast enough is a dead on description of the behavior I'm seeing. I just tried inserting an arcpy.exist call between each addfield call to try and slow things down a bit but still the same problem. So to really force the issue, I inserted a python time.sleep call between each addfield trying first a tenth of second - same problem, a full second and fixed! Before your response, I put all those core fields in a template fc and use that for the initial schema definition. But I still have unique fields that get added to the created fc's and now with that extra second of execution time per added per field my geo proc just got a lot slower. Thanks for the help, Tom Tyndall Sr. GIS Programmer Arizona Dept. of Transportation
... View more
09-11-2012
08:35 AM
|
0
|
0
|
741
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|