Dynamic legend problem

2033
10
07-09-2010 01:15 AM
ManuelFrias
New Contributor III
Hi,

I need some advice with the Dynamic legend made by Robert. It doesn't work from outside our local network.

So when I open the legend I find that it's pointing to the domain name of our server (see legendRequest.jpg). It can't be reached from outside our office since it is behind a proxy server.

When I try http://maps.helcom.fi/website/restLegend/restLegend.asmx?WSDL the result gives the value of the server (see wsdl.jpg) I wonder if that is the error. Where is that defined? Is there any way to change it?

In LiveMapsWidget.mxml the the wsdl is defined properly, ie, to the address that's reachable from outside the LAN:

<mx:WebService id="webService" wsdl="http://maps.helcom.fi/website/restLegend/restLegend.asmx?wsdl" showBusyCursor="false">

Thanks,
Manolo
0 Kudos
10 Replies
by Anonymous User
Not applicable
Original User: rscheitlin

Manolo,

   In your restLegend.asmx web service application there is this function

''generates object for the specified MapServerLegendClass
    Private Function legendClass(ByVal lclass As MapServerLegendClass) As jcLegend
        Dim jcLeg As New jcLegend
        jcLeg.label = lclass.Label
        ''!--you may need the line below if you webserver return a image url that is not a 
        ''fully(qualified) url address--!
        ''jcLeg.url = Replace(lclass.SymbolImage.ImageURL, "calhalgis", "gis.calhouncounty.org")
        jcLeg.url = lclass.SymbolImage.ImageURL
        Return jcLeg
    End Function


So in your case it would be

''jcLeg.url = Replace(lclass.SymbolImage.ImageURL, "helcom03.hcdomain1.local", "maps.helcom.fi")
0 Kudos
ManuelFrias
New Contributor III
Manolo,

   In your restLegend.asmx web service application there is this function

''generates object for the specified MapServerLegendClass
    Private Function legendClass(ByVal lclass As MapServerLegendClass) As jcLegend
        Dim jcLeg As New jcLegend
        jcLeg.label = lclass.Label
        ''!--you may need the line below if you webserver return a image url that is not a 
        ''fully(qualified) url address--!
        ''jcLeg.url = Replace(lclass.SymbolImage.ImageURL, "calhalgis", "gis.calhouncounty.org")
        jcLeg.url = lclass.SymbolImage.ImageURL
        Return jcLeg
    End Function


So in your case it would be

''jcLeg.url = Replace(lclass.SymbolImage.ImageURL, "helcom03.hcdomain1.local", "maps.helcom.fi")


Hi Robert,

unfortunately that didn't work. Right after I click on the legend button there is a request to the root of my internal server searching for the crossdomain.xml and after several requests to the asmx web service a request is made to fetch the image from the right address, ie, the one which is public (see legendRequest1.JPG). That happened also before the change you suggested.

The service description (?wsdl) points also to the internal server as I wrote in my earlier message.

I have been thinking where the request to the crossdomain and the asmx come from but I can't figure it out. If those request were made to maps.helcom.fi that would solve the problem. Or maybe there is something I am missing...

Manolo
0 Kudos
ManuelFrias
New Contributor III
Well, I think I found a workaround.

I found out that the endpointURI property of webService was pointing to my internal server. So I added this line to the function showStateLegend:

webService.endpointURI = webService.endpointURI.replace("helcom03.hcdomain1.local","maps.helcom.fi"); 


And that seems to work right now. I just wanted to share if anyone stumbles on the same problem.

Manolo
0 Kudos
by Anonymous User
Not applicable
Original User: nathanenge

RS,
I think I'm having the same issue - sort of.
From inside the network, I can see the legend symbols. It work when I use both 'mapservicesca' (local host name) and the URL: www.mapservices.ca.

HOwever, from outside the network, The images do not show up...I uncommented that bit of code you had suggested, and replaced it with "mapservicesca" and "mapservices.ca" but still the symbols links are broken.

I can see the WSDL output here from outside the network, so I don't know what is up. I just applied the SP2 to 9.3.1 and had to muck around with the folder permissions again for the server directory. In anycase any type of troubleshooting from you would be greatly appreciated.

By the way, I've decided that (in the other thread about the legend showing up on shortcut bar) to make live layers a shortcut, and have it open up in legend window first. easiest.

the actual map app is here: www.mapservices.ca/bin-release
the map service is here: www.mapservices.ca/ArcGIS/rest/services/FireSmartProp/MapServer/
the restLegend app is here: http://www.mapservices.ca/restLegend/restLegend.asmx?wsdl
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Nathan,

  Open http://www.mapservices.ca/restLegend/restLegend.asmx in a web browser in that machine and test it directly from the server by entering the appropriate values and see if the url of the images is what you expect.
0 Kudos
by Anonymous User
Not applicable
Original User: nathanenge

Nope, the url resolves to the localhost machine:
<?xml version="1.0" encoding="utf-8" ?>
- <rLegend xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://gis.calhouncounty.org/">
<ServiceName>mapservices.ca</ServiceName>

- <Layers>
- <jLayers>
<layerId>0</layerId>

<layerName>FireSmartProperties</layerName>

<lMaxScale>0</lMaxScale>

<lMinScale>0</lMinScale>

- <clegend>
- <jcLegend>
<label>Low < 21</label>

<url>http://mapservicesca/arcgisoutput/_ags_leg3254af0347b4430d8113341652086cd7.png</url>

</jcLegend>


- <jcLegend>
<label>Moderate 21 - 29</label>

<url>http://mapservicesca/arcgisoutput/_ags_lega4e45e4d9c4346d9aeb54e360570816c.png</url>

</jcLegend>


- <jcLegend>
<label>High 30 - 35</label>

<url>http://mapservicesca/arcgisoutput/_ags_legeb089bbc1d9840f78c80a0b5e67ab36e.png</url>

</jcLegend>


- <jcLegend>
<label>Extreme > 35</label>

<url>http://mapservicesca/arcgisoutput/_ags_legc9efad23d0a147168d33433b67f26594.png</url>

</jcLegend>


</clegend>


</jLayers>


</Layers>


</rLegend>




I made the changees in the restLegend.vb to:
Private Function legendClass(ByVal lclass As MapServerLegendClass) As jcLegend
Dim jcLeg As New jcLegend
jcLeg.label = lclass.Label
''!--you may need the line below if you webserver return a image url that is not a
''fully(qualified) url address--!
jcLeg.url = Replace(lclass.SymbolImage.ImageURL, "mapservicesca", "mapservices.ca")
jcLeg.url = lclass.SymbolImage.ImageURL
Return jcLeg
End Function

then restarted IIS7. but still resolved to local machine. Manually typing in the external address http://www.mapservices.ca/arcgisoutput/_ags_lega9c85f6870584cf4b850f1e10a72d5ca.png
I can see that image in the external machine. so how do I replace the local host machine name with the www.mapservices.ca ?
I thought I did that with the code above?
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Nathan,

   For you to make changes in the vb file you will have to recompile the changes so the dll is re-written. Are you opening the ASP.net project in Visual Studio and making the edits and then recompiling?
0 Kudos
by Anonymous User
Not applicable
Original User: nathanenge

I'm assuming, I just have to open up VS2008
Open Web Site...
Select restLegend
Edit the restLegend.vb function:

''generates object for the specified MapServerLegendClass
PrivateFunction legendClass(ByVal lclass As MapServerLegendClass) As jcLegend
Dim jcLeg AsNew jcLegend
jcLeg.label = lclass.Label
''!--you may need the line below if you webserver return a image url that is not a
''fully(qualified) url address--!
jcLeg.url = Replace(lclass.SymbolImage.ImageURL, "mapservicesca", "mapservices.ca")
jcLeg.url = lclass.SymbolImage.ImageURL
Return jcLeg
EndFunction


Then hit the Build Solution / Build Web Site and voila? Since I had used your compiled Install file, I didn't see much of what was going on.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Nathan,

   I provided the source for the web service in the original thread and you would have to open that in VS. I created the source in VS2005 so I am not sure the changes that would have to be made (if any) for VS2008. If you try to open the website in VS I think that it is read only.
0 Kudos