This sample illustrates how to develop a SOAP server object extension (SOE) with new methods that can return service layer information and perform a spatial query to find features near a location. The FindNearFeatures method returns the features of a user-defined layer that fall within the search distance of a location point.
This sample is divided into the following parts:
- The SOE implementation, which receives SOAP messages, processes requests, and generates SOAP responses.
- A simple desktop client to consume the custom SOE via SOAP.
Deploying the SOE from the .soe file (..\bin\Release\NetFindNearFeaturesSoapSOE_ent.soe
) does not require you to open Visual Studio. However, you can load the project (..\FindNearFeaturesSOAPSOE\NetFindNearFeaturesSoapSOE.sln
) in Visual Studio to debug, modify, and recompile the SOE code.
Features
- IRequestHandler2
- IMessage
- IXMLSerializeData
- Create SOAP SOE methods
- SOAP capabilities
- Spatial query
Sample data
Any dynamic map service published from ArcGIS Pro. This instruction uses the USA map service as the sample service to test with the SOE.
Instructions
Deploy the SOE
- Log in to ArcGIS Server Manager and click the Site tab.
- Click Extensions.
- Click Add Extension.
- Click Choose File and choose the NetFindNearFeaturesSoapSOE_ent.soe file (
..bin\Release\NetFindNearFeaturesSoapSOE_ent.soe
or..\bin\Debug\NetFindNearFeaturesSoapSOE_ent.soe
). - Click Add.
Enable the SOE on a map service
- Make sure you have published the USA map service using ArcGIS Pro. If not, refer to USA map service
- Log in to ArcGIS Server Manager and click the Services tab. Select USA map service and select Capabilities.
- In the list of available capabilities, find .NET Find Near Features SOAP SOE and check the box to enable it.
- Click the Save and Restart button to restart the service.
Test the SOE in the .NET SOAP client
-
In Visual Studio, open the FindNearFeaturesSoapClient solution (
NetFindNearFeaturesSoapClient.sln
).The application contains a simple Windows form with buttons and a text box. A Web Reference has been added to the project to reference the SOE SOAP endpoint.
-
Update the Web Reference.
<<<<<<< HEAD
- Make sure the USA Map service Sharing properties is shared with Everyone(public).
=======
- Make sure the USA map service's Sharing properties is shared with Everyone(public).
master
-
Right-click the Web Reference folder in Solution Explorer.
-
Click Properties.
-
Ensure that the Web Reference URL matches your own SOE's WSDL URL. The URL is in the following format:
http://<serverdomain>/<webadaptorname>/services/USA/MapServer/FindNearFeaturesSoapSOE?wsdl
-
Click Update Web Reference.
-
Update the service reference and URL in the code behind (Form1.cs).
-
Open Form1.cs.
-
Find the following two lines of code in each click event for the buttons:
var nearFeatsService = new localhost.USA_NetFindNearFeaturesSoapSOE(); nearFeatsService.Url = "https://<serverdomain>/<webadaptorname>/services/USA/MapServer/NetFindNearFeaturesSoapSOE";
-
Ensure that
nearFeatsService
references your SOAP SOE andnearFeatsService.Url
is correct
-
-
Run the application and click the buttons.
Layer information for all layers and features near the center of the default map extent for the service will be returned. All returned content displays in the rich text box in the form.
Test the SOE by sending XML requests in other SOAP clients
-
To test this SOE's GetLayerInfos operation in a SOAP client, you can try with the following request:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://examples.esri.com/schemas/NetFindNearFeaturesSoapSOE/1.0"> <soapenv:Header/> <soapenv:Body> <ns:GetLayerInfos/> </soapenv:Body> </soapenv:Envelope>
-
To test the FindNearFeatures operation, try with this request:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://examples.esri.com/schemas/NetFindNearFeaturesSoapSOE/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:esri="http://www.esri.com/schemas/ArcGIS/2.5.0"> <soapenv:Header/> <soapenv:Body> <ns:FindNearFeatures> <LayerID>0</LayerID> <Location xsi:type="esri:PointN"> <X>-110</X> <Y>30</Y> </Location> <Distance>2</Distance> </ns:FindNearFeatures> </soapenv:Body> </soapenv:Envelope>