• Charlie1
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
I am trying to test a web service callout from Salesforce to a PHP web service but I am getting this error and I am struggling to find a solution.

This is the WSDL file (http://www.popo.it/WebServiceSOAP/server.php?wsdl) that has been imported in SF with WSDL2APEX.
The generated class is

//Generated by wsdl2apex

public class wsexample {
    public class helloRequestType {
        public String name;
        private String[] name_type_info = new String[]{'name','urn:server',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'urn:server','true','false'};
        private String[] field_order_type_info = new String[]{'name'};
    }
    public class wsexamplePort {
        public String endpoint_x = 'http://www.popo.it/WebServiceSOAP/server.php';
        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[]{'urn:server', 'wsexample'};
        public String hello(String name) {
            wsexample.helloRequestType request_x = new wsexample.helloRequestType();
            wsexample.helloResponseType response_x;
            request_x.name = name;
            Map<String, wsexample.helloResponseType> response_map_x = new Map<String, wsexample.helloResponseType>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              'urn:server#hello',
              'urn:server',
              'hello',
              'urn:server',
              'helloResponse',
              'wsexample.helloResponseType'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.return_x;
        }
    }
    public class helloResponseType {
        public String return_x;
        private String[] return_x_type_info = new String[]{'return','urn:server',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'urn:server','true','false'};
        private String[] field_order_type_info = new String[]{'return_x'};
    }
}

And the VF page using it is

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

with controller

public class WSContoller {

public String helloWorld;

public String getHelloWorld() {
    string MyReturn;
    wsexample.wsexamplePort stub = new wsexample.wsexamplePort();
    MyReturn = stub.hello('Nicola');
    return MyReturn ;
    }
   
}

The response from the WS tested in SoapClient.com is

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<helloResponse>
<great>Hello, Nicola!</great>
</helloResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Please, can you help me to find the error?

I am trying to test a web service callout from Salesforce to a PHP web service but I am getting this error and I am struggling to find a solution.

This is the WSDL file (http://www.popo.it/WebServiceSOAP/server.php?wsdl) that has been imported in SF with WSDL2APEX.
The generated class is

//Generated by wsdl2apex

public class wsexample {
    public class helloRequestType {
        public String name;
        private String[] name_type_info = new String[]{'name','urn:server',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'urn:server','true','false'};
        private String[] field_order_type_info = new String[]{'name'};
    }
    public class wsexamplePort {
        public String endpoint_x = 'http://www.popo.it/WebServiceSOAP/server.php';
        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[]{'urn:server', 'wsexample'};
        public String hello(String name) {
            wsexample.helloRequestType request_x = new wsexample.helloRequestType();
            wsexample.helloResponseType response_x;
            request_x.name = name;
            Map<String, wsexample.helloResponseType> response_map_x = new Map<String, wsexample.helloResponseType>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              'urn:server#hello',
              'urn:server',
              'hello',
              'urn:server',
              'helloResponse',
              'wsexample.helloResponseType'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.return_x;
        }
    }
    public class helloResponseType {
        public String return_x;
        private String[] return_x_type_info = new String[]{'return','urn:server',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'urn:server','true','false'};
        private String[] field_order_type_info = new String[]{'return_x'};
    }
}

And the VF page using it is

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

with controller

public class WSContoller {

public String helloWorld;

public String getHelloWorld() {
    string MyReturn;
    wsexample.wsexamplePort stub = new wsexample.wsexamplePort();
    MyReturn = stub.hello('Nicola');
    return MyReturn ;
    }
   
}

The response from the WS tested in SoapClient.com is

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<helloResponse>
<great>Hello, Nicola!</great>
</helloResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Please, can you help me to find the error?