• hylim
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies

Hi i need some help for my callout webservice.

 

I have created a simple webservice which pass in a string and return "Hello 'strng'" from eclipse IDE and below is the generated apex code from WSDL

 

 

//Generated by wsdl2apex

public class AxisWS {
    public class sayhello_element {
        public String Input;
        private String[] Input_type_info = new String[]{'Input','http://www.w3.org/2001/XMLSchema','string','1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://webapp.wtp','true','false'};
        private String[] field_order_type_info = new String[]{'Input'};
    }
    public class HelloWord {
        public String endpoint_x = 'http://192.168.0.10:8080/AxisWS/services/HelloWord';
        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://webapp.wtp', 'AxisWS'};
        public String sayhello(String Input) {
            AxisWS.sayhello_element request_x = new AxisWS.sayhello_element();
            AxisWS.sayhelloResponse_element response_x;
            request_x.Input = Input;
            Map<String, AxisWS.sayhelloResponse_element> response_map_x = new Map<String, AxisWS.sayhelloResponse_element>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              '',
              'http://webapp.wtp',
              'sayhello',
              'http://webapp.wtp',
              'sayhelloResponse',
              'AxisWS.sayhelloResponse_element'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.sayhelloReturn;
        }
    }
    public class sayhelloResponse_element {
        public String sayhelloReturn;
        private String[] sayhelloReturn_type_info = new String[]{'sayhelloReturn','http://www.w3.org/2001/XMLSchema','string','1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://webapp.wtp','true','false'};
        private String[] field_order_type_info = new String[]{'sayhelloReturn'};
    }
}

 

 

 

and i have a apex class as below calling my WSDL apex:

 

public class WSContoller{ 
    public WSContoller(ApexPages.StandardController controller) {

    }

    public String getHelloName() {        
    string MyReturn;            
    AxisWS.HelloWord stub = new AxisWS.HelloWord(); 
    MyReturn = stub.sayhello('lhy');
     return MyReturn ;    
    }    
}

 

and lastly i created a Visualforce page to display the message from my webservice

 

 

<apex:page standardController="Account" extensions="WSContoller">
It will be a nice to get output from the controller<p>My webservice is now returning {!HelloName} !!
</p>
</apex:page>

 

i also setup my remote site

 

 

Remote Site Name: AxisWS *Remote Site URL: 192.168.0.10:8080

and when i open my account record i got this error

 

Content cannot be displayed: Web service callout failed: Unexpected element. Parser was expecting element 'http://schemas.xmlsoap.org/soap/envelope/:Envelope' but found ':HTML'

 

can anyone pinpoint where seems to be the problem? im still learing APEX :)

 

thanks!

 

 

  • August 04, 2013
  • Like
  • 0

Hi i need some help for my callout webservice.

 

I have created a simple webservice which pass in a string and return "Hello 'strng'" from eclipse IDE and below is the generated apex code from WSDL

 

 

//Generated by wsdl2apex

public class AxisWS {
    public class sayhello_element {
        public String Input;
        private String[] Input_type_info = new String[]{'Input','http://www.w3.org/2001/XMLSchema','string','1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://webapp.wtp','true','false'};
        private String[] field_order_type_info = new String[]{'Input'};
    }
    public class HelloWord {
        public String endpoint_x = 'http://192.168.0.10:8080/AxisWS/services/HelloWord';
        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://webapp.wtp', 'AxisWS'};
        public String sayhello(String Input) {
            AxisWS.sayhello_element request_x = new AxisWS.sayhello_element();
            AxisWS.sayhelloResponse_element response_x;
            request_x.Input = Input;
            Map<String, AxisWS.sayhelloResponse_element> response_map_x = new Map<String, AxisWS.sayhelloResponse_element>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              '',
              'http://webapp.wtp',
              'sayhello',
              'http://webapp.wtp',
              'sayhelloResponse',
              'AxisWS.sayhelloResponse_element'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.sayhelloReturn;
        }
    }
    public class sayhelloResponse_element {
        public String sayhelloReturn;
        private String[] sayhelloReturn_type_info = new String[]{'sayhelloReturn','http://www.w3.org/2001/XMLSchema','string','1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://webapp.wtp','true','false'};
        private String[] field_order_type_info = new String[]{'sayhelloReturn'};
    }
}

 

 

 

and i have a apex class as below calling my WSDL apex:

 

public class WSContoller{ 
    public WSContoller(ApexPages.StandardController controller) {

    }

    public String getHelloName() {        
    string MyReturn;            
    AxisWS.HelloWord stub = new AxisWS.HelloWord(); 
    MyReturn = stub.sayhello('lhy');
     return MyReturn ;    
    }    
}

 

and lastly i created a Visualforce page to display the message from my webservice

 

 

<apex:page standardController="Account" extensions="WSContoller">
It will be a nice to get output from the controller<p>My webservice is now returning {!HelloName} !!
</p>
</apex:page>

 

i also setup my remote site

 

 

Remote Site Name: AxisWS *Remote Site URL: 192.168.0.10:8080

and when i open my account record i got this error

 

Content cannot be displayed: Web service callout failed: Unexpected element. Parser was expecting element 'http://schemas.xmlsoap.org/soap/envelope/:Envelope' but found ':HTML'

 

can anyone pinpoint where seems to be the problem? im still learing APEX :)

 

thanks!

 

 

  • August 04, 2013
  • Like
  • 0