You need to sign in to do that
Don't have an account?
Generate from WSDL (System.CalloutException: IO Exception: Read timed out)
We are struggling to get Salesforce to do a Web Service Callout to a Web Service we have written in VB.Net
We have managed to get the StikeIron sample to work in Salesforce as detailed in the example:
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_callouts_wsdl2apex.htm
We have
1. Written and tested a WebService in VB.Net.
2. Saved the WSDL and edited it to make it work
3. Used 'Generate from WSDL' to create the classes
4. Built a Visual force page.
And we get this error:
Visualforce Error
Help for this Page
System.CalloutException: IO Exception: Read timed out
Class.alphaIndexCoUk.CNetWebServiceSimpleSoap.HelloWorld: line 30, column 1
Class.alphaIndexCoUkSample.__sfdc_hellow: line 8, column 1
Looking at the Log our web service generates, Salesforce is not connecting to the webservice.
The code used is as follows:
1. ASMX FILE
Imports System.Web.Services Imports System.Web.Services.Protocols Imports System.ComponentModel ' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. ' <System.Web.Script.Services.ScriptService()> _ <System.Web.Services.WebService(Namespace:="http://alpha-index.co.uk/")> _ <System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _ <ToolboxItem(False)> _ Public Class CNetWebServiceSimple Inherits System.Web.Services.WebService <WebMethod()> _ Public Function HelloWorld() As String Return "Hello World" End Function End Class
2. WSDL FILE
<?xml version="1.0" encoding="utf-8"?> <wsdl:definitions xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://webservice.alpha-index.co.uk/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" targetNamespace="http://webservice.alpha-index.co.uk/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> <wsdl:types> <s:schema elementFormDefault="qualified" targetNamespace="http://webservice.alpha-index.co.uk/"> <s:element name="HelloWorld"> <s:complexType /> </s:element> <s:element name="HelloWorldResponse"> <s:complexType> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="HelloWorldResult" type="s:string" /> </s:sequence> </s:complexType> </s:element> </s:schema> </wsdl:types> <wsdl:message name="HelloWorldSoapIn"> <wsdl:part name="parameters" element="tns:HelloWorld" /> </wsdl:message> <wsdl:message name="HelloWorldSoapOut"> <wsdl:part name="parameters" element="tns:HelloWorldResponse" /> </wsdl:message> <wsdl:portType name="CNetWebServiceSimpleSoap"> <wsdl:operation name="HelloWorld"> <wsdl:input message="tns:HelloWorldSoapIn" /> <wsdl:output message="tns:HelloWorldSoapOut" /> </wsdl:operation> </wsdl:portType> <wsdl:binding name="CNetWebServiceSimpleSoap" type="tns:CNetWebServiceSimpleSoap"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" /> <wsdl:operation name="HelloWorld"> <soap:operation soapAction="http://webservice.alpha-index.co.uk/HelloWorld" style="document" /> <wsdl:input> <soap:body use="literal" /> </wsdl:input> <wsdl:output> <soap:body use="literal" /> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:binding name="CNetWebServiceSimpleSoap12" type="tns:CNetWebServiceSimpleSoap"> <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" /> <wsdl:operation name="HelloWorld"> <soap12:operation soapAction="http://webservice.alpha-index.co.uk/HelloWorld" style="document" /> <wsdl:input> <soap12:body use="literal" /> </wsdl:input> <wsdl:output> <soap12:body use="literal" /> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="CNetWebServiceSimple"> <wsdl:port name="CNetWebServiceSimpleSoap" binding="tns:CNetWebServiceSimpleSoap"> <soap:address location="http://webservices.alpha-index.co.uk/CNetWebService/CNetWebServiceSimple.asmx" /> </wsdl:port> <wsdl:port name="CNetWebServiceSimpleSoap12" binding="tns:CNetWebServiceSimpleSoap12"> <soap12:address location="http://webservices.alpha-index.co.uk/CNetWebService/CNetWebServiceSimple.asmx" /> </wsdl:port> </wsdl:service> </wsdl:definitions>
BUT WE REMOVE SOME CODE LINES, BECAUSE WE GET THE FOLLOWING ERROR:
Error: Failed to parse wsdl: Found more than one wsdl:binding. WSDL with multiple binding not supported
THIS IS THE E=WSDL EDITED SO 'GENERATE FROM WSDL' WORKED:
<?xml version="1.0" encoding="utf-8"?> <wsdl:definitions xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://alpha-index.co.uk/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" targetNamespace="http://alpha-index.co.uk/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> <wsdl:types> <s:schema elementFormDefault="qualified" targetNamespace="http://alpha-index.co.uk/"> <s:element name="HelloWorld"> <s:complexType /> </s:element> <s:element name="HelloWorldResponse"> <s:complexType> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="HelloWorldResult" type="s:string" /> </s:sequence> </s:complexType> </s:element> </s:schema> </wsdl:types> <wsdl:message name="HelloWorldSoapIn"> <wsdl:part name="parameters" element="tns:HelloWorld" /> </wsdl:message> <wsdl:message name="HelloWorldSoapOut"> <wsdl:part name="parameters" element="tns:HelloWorldResponse" /> </wsdl:message> <wsdl:portType name="CNetWebServiceSimpleSoap"> <wsdl:operation name="HelloWorld"> <wsdl:input message="tns:HelloWorldSoapIn" /> <wsdl:output message="tns:HelloWorldSoapOut" /> </wsdl:operation> </wsdl:portType> <wsdl:binding name="CNetWebServiceSimpleSoap" type="tns:CNetWebServiceSimpleSoap"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" /> <wsdl:operation name="HelloWorld"> <soap:operation soapAction="http://alpha-index.co.uk/HelloWorld" style="document" /> <wsdl:input> <soap:body use="literal" /> </wsdl:input> <wsdl:output> <soap:body use="literal" /> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="CNetWebServiceSimple"> <wsdl:port name="CNetWebServiceSimpleSoap" binding="tns:CNetWebServiceSimpleSoap"> <soap:address location="http://webservices.alpha-index.co.uk/CNetWebService/CNetWebServiceSimple.asmx" /> </wsdl:port> </wsdl:service> </wsdl:definitions>
3. Generated Apex Class
//Generated by wsdl2apex public class alphaIndexCoUk { public class HelloWorld_element { private String[] apex_schema_type_info = new String[]{'http://alpha-index.co.uk/','true','false'}; private String[] field_order_type_info = new String[]{}; } public class HelloWorldResponse_element { public String HelloWorldResult; private String[] HelloWorldResult_type_info = new String[]{'HelloWorldResult','http://www.w3.org/2001/XMLSchema','string','0','1','false'}; private String[] apex_schema_type_info = new String[]{'http://alpha-index.co.uk/','true','false'}; private String[] field_order_type_info = new String[]{'HelloWorldResult'}; } public class CNetWebServiceSimpleSoap { public String endpoint_x = 'http://webservices.alpha-index.co.uk/CNetWebService/CNetWebServiceSimple.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://alpha-index.co.uk/', 'alphaIndexCoUk'}; public String HelloWorld() { alphaIndexCoUk.HelloWorld_element request_x = new alphaIndexCoUk.HelloWorld_element(); alphaIndexCoUk.HelloWorldResponse_element response_x; Map<String, alphaIndexCoUk.HelloWorldResponse_element> response_map_x = new Map<String, alphaIndexCoUk.HelloWorldResponse_element>(); response_map_x.put('response_x', response_x); WebServiceCallout.invoke( this, request_x, response_map_x, new String[]{endpoint_x, 'http://alpha-index.co.uk/HelloWorld', 'http://alpha-index.co.uk/', 'HelloWorld', 'http://alpha-index.co.uk/', 'HelloWorldResponse', 'alphaIndexCoUk.HelloWorldResponse_element'} ); response_x = response_map_x.get('response_x'); return response_x.HelloWorldResult; } } }
4. Custom Apex class
public class alphaIndexCoUkSample { public string hellow{ get{ alphaIndexCoUk.CNetWebServiceSimpleSoap dns = new alphaIndexCoUk.CNetWebServiceSimpleSoap (); return dns.HelloWorld(); } set; } }
5. Visual force page to show HelloWorld
<apex:page controller="alphaIndexCoUkSample"> <apex:form ><apex:inputText value="{!hellow}"/></apex:form> <!-- Begin Default Content REMOVE THIS --> <h1>Congratulations</h1> This is your new Page <!-- End Default Content REMOVE THIS --> </apex:page>
The Web Service can be found at: http://webservices.alpha-index.co.uk/CNetWebService/CNetWebServiceSimple.asm
x
(add ?WSDL to see the WSDL)
And we've published a sample .Net page to show the web service working
http://dirdb.alpha-index.co.uk/WebServiceTest/TestWebService.aspx
All the web service does is return 'Hello World' and record the call to a log file.
Clicking on [Test Hello World] runs the Web Service
And clicking on [View Hello World Log] displays the last log entry (we used this to see if Salesforce was reaching our web service)
I hope that anyone can help me with this problem.
Thanks in advance
Pablo