function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
amine7amine7 

problem: Illegal view ID Data Not Found?inline=1. The ID must begin with /

hello there, i'm facing a problem when triying to call a webservice from a visualforce page, i need some help pleaze

 

here is my visualforce page

 

<apex:page standardController="Order_Product__c" extensions="Weather">
   <apex:form >
      <apex:pageBlock id="out">
     
         <apex:pageBlockSection >
             <apex:panelGroup >
                <apex:pageBlockSection >   
                   <apex:outputLabel for="searchCityName">Search the City</apex:outputLabel>
                   <apex:outputLabel for="searchCountryName">Search the Country</apex:outputLabel>
                </apex:pageBlockSection>  
                  
                <apex:pageBlockSection >
                      <apex:inputText id="searchCityName" value="{!searchCityName}"/>
                      <apex:inputText id="searchCountryName" value="{!searchCountryName}"/>
                </apex:pageBlockSection>
                      <apex:commandButton value="Go!" action="{!getMeteo}" status="status" reRender="out"/>
                    
              </apex:panelGroup>
           
        </apex:pageBlockSection>
      
        
        <apex:actionStatus id="status" startText="requesting..."/>       
      
        <apex:pageBlockSection title="la meteo"  columns="1">
        <apex:page standardController="Order_Product__c" extensions="Weather" id="out">
        <apex:outputText >{!meteo}</apex:outputText>
       
        </apex:page>
         
          
        </apex:pageBlockSection>
        </apex:pageBlock>  
     
   </apex:form>
</apex:page>

 

the webservice

//Generated by wsdl2apex

public class wwwWebservicexNet {
    public class GetWeather_element {
        public String CityName;
        public String CountryName;
        private String[] CityName_type_info = new String[]{'CityName','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] CountryName_type_info = new String[]{'CountryName','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.webserviceX.NET','true','false'};
        private String[] field_order_type_info = new String[]{'CityName','CountryName'};
    }
    public class GetCitiesByCountry_element {
        public String CountryName;
        private String[] CountryName_type_info = new String[]{'CountryName','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.webserviceX.NET','true','false'};
        private String[] field_order_type_info = new String[]{'CountryName'};
    }
    public class GlobalWeatherSoap {
        public String endpoint_x = 'http://www.webservicex.com/globalweather.asmx';
        public Map<String,String> inputHttpHeaders_x;
        public Map<String,String> outputHttpHeaders_x;
        public String clientCertName_x;
        public String clientCert_x;
        public String clientCertPasswd_x;
        public Integer timeout_x;
        private String[] ns_map_type_info = new String[]{'http://www.webserviceX.NET', 'wwwWebservicexNet'};
        public String GetCitiesByCountry(String CountryName) {
            wwwWebservicexNet.GetCitiesByCountry_element request_x = new wwwWebservicexNet.GetCitiesByCountry_element();
            wwwWebservicexNet.GetCitiesByCountryResponse_element response_x;
            request_x.CountryName = CountryName;
            Map<String, wwwWebservicexNet.GetCitiesByCountryResponse_element> response_map_x = new Map<String, wwwWebservicexNet.GetCitiesByCountryResponse_element>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              'http://www.webserviceX.NET/GetCitiesByCountry',
              'http://www.webserviceX.NET',
              'GetCitiesByCountry',
              'http://www.webserviceX.NET',
              'GetCitiesByCountryResponse',
              'wwwWebservicexNet.GetCitiesByCountryResponse_element'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.GetCitiesByCountryResult;
        }
        public String GetWeather(String CityName,String CountryName) {
            wwwWebservicexNet.GetWeather_element request_x = new wwwWebservicexNet.GetWeather_element();
            wwwWebservicexNet.GetWeatherResponse_element response_x;
            request_x.CityName = CityName;
            request_x.CountryName = CountryName;
            Map<String, wwwWebservicexNet.GetWeatherResponse_element> response_map_x = new Map<String, wwwWebservicexNet.GetWeatherResponse_element>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              'http://www.webserviceX.NET/GetWeather',
              'http://www.webserviceX.NET',
              'GetWeather',
              'http://www.webserviceX.NET',
              'GetWeatherResponse',
              'wwwWebservicexNet.GetWeatherResponse_element'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.GetWeatherResult;
        }
    }
    public class GetWeatherResponse_element {
        public String GetWeatherResult;
        private String[] GetWeatherResult_type_info = new String[]{'GetWeatherResult','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.webserviceX.NET','true','false'};
        private String[] field_order_type_info = new String[]{'GetWeatherResult'};
    }
    public class GetCitiesByCountryResponse_element {
        public String GetCitiesByCountryResult;
        private String[] GetCitiesByCountryResult_type_info = new String[]{'GetCitiesByCountryResult','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.webserviceX.NET','true','false'};
        private String[] field_order_type_info = new String[]{'GetCitiesByCountryResult'};
    }
}

my controller

 

public class Weather {

private final Order_Product__c  OrderProduct;
String searchCityName;
String searchCountryName;

Public Weather (ApexPages.StandardController stdController){
    this.OrderProduct= (Order_Product__c)stdController.getRecord();
}
public void setSearchCityName(String s) {
      
   }
public void setSearchCountryName(String d) {
      
   }
public String getSearchCityName() {
        searchCityName='Entrez la Ville';
      return searchCityName;
   }
public String getSearchCountryName() {
      searchCountryName='Entrez le Pays';
      return searchCountryName;
   }
String status ='Success';
public void setMeteo(){}
public string getMeteo(){
 
try{
String status='success';
wwwWebservicexNet.GlobalWeatherSoap stub = new wwwWebservicexNet.GlobalWeatherSoap();
stub.timeout_x = 110000;
String weather= stub.GetWeather( searchCityName,searchCountryName);

system.debug('debugging ::'+ String.valueOf(weather));
String meteo= String.valueOf(weather);
return meteo;
}catch(exception e){ Status = 'FAILURE'+e;}return status;

}

}

thanks in advance ...

 

Best Answer chosen by Admin (Salesforce Developers) 
aballardaballard

I'm not sure exactly what you are trying to do.  But your action method geMeteo, called from the command button is invalid.   An action method returns a page reference (aka view id) for the page you want to go to (or null to stay on the same page).  Hence the "illegal view id" message.   What your method is returning is the actual output of the request.

 

Souds like you need to fetch the content and display it in a separate component.

All Answers

aballardaballard

I'm not sure exactly what you are trying to do.  But your action method geMeteo, called from the command button is invalid.   An action method returns a page reference (aka view id) for the page you want to go to (or null to stay on the same page).  Hence the "illegal view id" message.   What your method is returning is the actual output of the request.

 

Souds like you need to fetch the content and display it in a separate component.

This was selected as the best answer
amine7amine7

thanks for the reply..., what i was triying to do is to output the request of my web service in a visualforce page, now i've fixed the problem but another problem has emerged when i changed my StandardController from the custom one: Order_product__c to the basic one :Contact

Content cannot be displayed: Invalid conversion from runtime type SOBJECT:Contact to SOBJECT:Order_Product__c