Webservice works with SoapSonar but not with Visual Studio Winform
- by Rebol Tutorial
I have generated a wsdl file with Visual Studio which is here;
http://reboltutorial.com/webservices/discordian.wsdl
Implementation is a cgi instead of a .net framework program but that should not matter as it is the purposes of webservices.
I tested it successfully with SoapSonar:
But under Visual Studio it fails with this code:
private void button1_Click(object sender, EventArgs e)
{
RebolTutorial.ServiceSoapClient Discordian = new RebolTutorial.ServiceSoapClient("ServiceSoap");
int year = int.Parse(this.year.Text);
int month = int.Parse(this.month.Text);
int day = int.Parse(this.day.Text);
response.Text = Discordian.Discordian(year,month,day);
}
Any reason you can see ? Thanks.
Request below:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://reboltutorial.com/">
<soap:Body>
<tns:Discordian>
<tns:year>2010</tns:year>
<tns:month>5</tns:month>
<tns:day>1</tns:day>
</tns:Discordian>
</soap:Body>
</soap:Envelope>
as well as WSDL if needed:
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://reboltutorial.com/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://reboltutorial.com/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://reboltutorial.com/">
<s:element name="Discordian">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="year" type="s:int" />
<s:element minOccurs="1" maxOccurs="1" name="month" type="s:int" />
<s:element minOccurs="1" maxOccurs="1" name="day" type="s:int" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="DiscordianResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="DiscordianResult" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>
<wsdl:message name="DiscordianSoapIn">
<wsdl:part name="parameters" element="tns:Discordian" />
</wsdl:message>
<wsdl:message name="DiscordianSoapOut">
<wsdl:part name="parameters" element="tns:DiscordianResponse" />
</wsdl:message>
<wsdl:portType name="ServiceSoap">
<wsdl:operation name="Discordian">
<wsdl:input message="tns:DiscordianSoapIn" />
<wsdl:output message="tns:DiscordianSoapOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ServiceSoap" type="tns:ServiceSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="Discordian">
<soap:operation soapAction="http://reboltutorial.com/Discordian" 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="ServiceSoap12" type="tns:ServiceSoap">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="Discordian">
<soap12:operation soapAction="http://reboltutorial.com/Discordian" 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="Service">
<wsdl:port name="ServiceSoap" binding="tns:ServiceSoap">
<soap:address location="http://reboltutorial.com/cgi-bin/discordian.cgi" />
</wsdl:port>
<wsdl:port name="ServiceSoap12" binding="tns:ServiceSoap12">
<soap12:address location="http://reboltutorial.com/cgi-bin/discordian.cgi" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>