How to use gSOAP with Qt for Web Service Client
-
i was following
http://qt-project.org/wiki/How_to_use_gSOAP_with_Qt_for_Web_Service_
tutorial but i when i execute wsdl2h program i get this error :
An error occurred while parsing WSDL or XSD from 'http://localhost:11061/WebServ
ice.asmx'
Error 3 fault: SOAP-ENV:Client [no subcode]
"Validation constraint violation: tag name or namespace mismatch in element 'htm
l'"
Detail: [no detail]
HTTP/1.1 200 OK
Cache-Control: private, max-age=0
Content-Type: text/html; charset=utf-8
Server: Microsoft-IIS/8.0
X-AspNet-Version: 4.0.30319
X-SourceFiles: =?UTF-8?B?QzpcVXNlcnNcZGFuaWFsXERvY3VtZW50c1xWaXN1YWwgU3R1ZGlvIDI
wMTJcV2ViU2l0ZXNcV2ViU2l0ZTNcV2ViU2VydmljZS5hc214?=
X-Powered-By: ASP.NET
Date: Sat, 04 May 2013 15:57:51 GMT
Connection: close
Content-Length: 3071<html>
<!-- ** HERE ** --><head><link rel="alternate" type="text/xml" href="/WebService.asmx?disco" /> <style type="text/css"> BODY { color: #000000; background-color: white; font-family: Ver
dana; margin-left: 0px; margin-top: 0px; }
#content { margin-left: 30px; font-size: .70em; padding-bottom:
2em; }
A:link { color: #336699; font-weight: bold; text-decoration: und
erline; }
A:visited { color: #6699cc; font-weight: bold; text-decoration:
underline; }
A:active { color: #336699; font-weight: bold; text-decoration: u
nderline; }
A:hover { color: cc3300; font-weight: bold; text-decoration: und
erline; }
P { color: #000000; margin-top: 0px; margin-bottom: 12px; font-f
amily: Verdana; }
pre { background-color: #e5e5cc; padding: 5px; font-family: Cour
ier New; font-size: x-small; margin-top: -5px; border: 1px #f0f0e0 solid; }
td { color: #000000; font-family: Verdana; font-size: .7em; }
h2 { font-size: 1.5em; font-weight: bold; margin-top: 25px; marg
in-bottom: 10px; border-top: 1px solid #003
Ive done These steps :
- Creating ASP.net web service with this WSDL :
<wsdl:definitions 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://Mysite.ir/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://Mysite.ir/">
wsdl:types
<s:schema elementFormDefault="qualified" targetNamespace="http://Mysite.ir/">
<s:element name="GetContact">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="id" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="GetContactResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="GetContactResult" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>
<wsdl:message name="GetContactSoapIn">
<wsdl:part name="parameters" element="tns:GetContact"/>
</wsdl:message>
<wsdl:message name="GetContactSoapOut">
<wsdl:part name="parameters" element="tns:GetContactResponse"/>
</wsdl:message>
<wsdl:portType name="WebServiceSoap">
<wsdl:operation name="GetContact">
<wsdl:input message="tns:GetContactSoapIn"/>
<wsdl:output message="tns:GetContactSoapOut"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="WebServiceSoap" type="tns:WebServiceSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="GetContact">
<soap:operation soapAction="http://Mysite.ir/GetContact" 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="WebServiceSoap12" type="tns:WebServiceSoap">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="GetContact">
<soap12:operation soapAction="http://Mysite.ir/GetContact" 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="WebService">
<wsdl:port name="WebServiceSoap" binding="tns:WebServiceSoap">
<soap:address location="http://localhost:11061/WebService.asmx"/>
</wsdl:port>
<wsdl:port name="WebServiceSoap12" binding="tns:WebServiceSoap12">
<soap12:address location="http://localhost:11061/WebService.asmx"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
after that i copy :
wsdl:types
<s:schema elementFormDefault="qualified" targetNamespace="http://Mysite.ir/">
<s:element name="GetContact">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="id" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="GetContactResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="GetContactResult" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>from wsdl and past it on typemap.dat file
and then i added
myns = "http://Mysite.ir/"
to that file
after that ive entered follwing command in cmd :
C:\Gsoap\gsoap-2.8\gsoap\bin\win32>wsdl2h -s -t C:\Gsoap\gsoap-2.8\gsoap\WS\typemap.dat -o contact.h http://localhost:11061/WebService.asmx
where's my problem ?
Thank in advance.
- Creating ASP.net web service with this WSDL :
-
Hi,
This error comes from the gsoap side not Qt, please ask the question on the gsoap mailing list.
-
Hi
Okay
sorry -
http://localhost:11061/WebService.asmx is returning an HTML document. wsdl2h is expecting to get a WSDL xml document.
-
Thanks.
That was it.