HOW TO

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

Last Published: April 25, 2020

Summary

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.

Note:
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.

Procedure

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.

Note:
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.


Code:
' 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
Next

' 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

Article ID:000006224

Software:
  • Legacy Products

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Discover more on this topic