How To: Share objects across multiple Web services (.NET 1.0 and 1.1)


ArcWeb Services contains common objects used by multiple Web services. For example, the Route Finder Web Service implements a Geometry object, as does the Map Image Web Service.

Instructions provided describe how to use an object returned from one Web service as an input request parameter for another Web service, when developing an application using .NET 1.0 and 1.1 technology.

When developing an application that consumes ArcWeb Services using a pre-2.0 .NET technology, it is not possible to directly use an object returned from one service as an input for another service. This is due to how these early versions of .NET deal with namespace organization.


Break down the object into simple parts (e.g., string, integers) and rebuild with the second Web service.

The following snippet of VB.NET code illustrates returning a geometry object from the Route Finder service, and using it to create a geometry object to place on a map using the Map Image service.

The VB.NET code below must be built upon in order to function properly in your solution. Not all required object properties have been set in an attempt to maintain brevity and focus on this document's purpose.

' return route from Route Finder service

myRouteInfo = myRouteFinder.findRoute(myRouteStops, myRouteFinderOptions, myToken)
myRouteGeometry = myRouteInfo.routePath
myRouteSimplePoints = myRouteGeometry.points
ReDim myMapSimplePoints(myRouteSimplePoints.Length - 1)

' Loop thru points in route line geometry
' and create a mirror map image
' SimplePoint array

For i = 0 To (myRouteSimplePoints.Length - 1)
Dim myMapSimplePoint As New mapimage.SimplePoint()
myMapSimplePoint.x = myRouteSimplePoints(i).x
myMapSimplePoint.y = myRouteSimplePoints(i).y
myMapSimplePoints(i) = New mapimage.SimplePoint()
myMapSimplePoints(i) = myMapSimplePoint

' build the Map Image geometry object

Dim myParts(0) As Integer
myParts(0) = 0
myMapGeometry.points = myMapSimplePoints
myMapGeometry.parts = myParts
myMapGeometry.type = 2
myMapLineDescription.geometry = myMapGeometry

Dim mldsc(0) As mapimage.LineDescription
mldsc(0) = myMapLineDescription
myMapImageOptions.lines = mldsc

' return map that includes the line
' geometry from the Map Image service and
' display it in the application

myMapImageInfo = myMapImage.getMap(myEnvelope, myMapImageOptions, myToken)
Image1.ImageUrl = myMapImageInfo.mapUrl