我在wsdl文件上使用gsoap工具wsdl2h,该文件是在Visual Studio中为WCF服务添加服务引用时由Windows客户端自动生成的。
wsdl2h -o service.h service.wsdl ** The gSOAP WSDL/Schema processor for C and C++, wsdl2h release 2.8.9 ** Copyright (C) 2000-2012 Robert van Engelen, Genivia Inc. ** All Rights Reserved. This product is provided "as is", without any warranty. ** The wsdl2h tool is released under one of the following two licenses: ** GPL or the commercial license by Genivia Inc. Use option -l for details. Saving service.h Cannot open file 'typemap.dat' Problem reading type map file 'typemap.dat'. Using internal type definitions for C++ instead. Reading file 'service.wsdl'... Connecting to 'http://tempuri.org/' to retrieve schema... Connected, receiving... Redirected to 'http://www.tempuri.org/'... Connecting to 'http://www.tempuri.org/' to retrieve schema... Connected, receiving... An error occurred while parsing schema from '' Error 3 fault: SOAP-ENV:Client [no subcode] "Validation constraint violation: tag name or namespace mismatch in element 'html'" Detail: [no detail] HTTP/1.1 200 OK Date: Tue, 04 Sep 2012 15:01:27 GMT Server: Apache Last-Modified: Sat, 01 Sep 2012 12:46:28 GMT ETag: "16ca6ab-441-4c0d3100" Accept-Ranges: bytes Content-Length: 1089 Connection: close Content-Type: text/html; charset=UTF-8 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US" xml:lang="en-US"> <!-- ** HERE ** --> <head profile="http://gmpg.org/xfn/11"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Tempuri</title> <link rel="stylesheet" href="/style.css" type="text/css" media="screen" /></head> <body> <div id="wrap"> <div id="topnavbar"> </div> <div id="header"> <div class="headerleft"> <h4><a href="/">Tempuri</a></h4> </div> </div> <div id="navbar"> <div id="navbarleft"> <ul id="nav"> <li><a href="/">Startseite</a></li></ul> </div> <div id="navbarright"> </div> </div> <div class="clear"></div> <div id="content"> <div id="sidebar"> <ul id="sidebarwidgeted"> <li class="widget widget_recent_entries"><span>Menü</span><ul> <li><a href="/">Startseite</a></li></ul> </li></ul> </div> <div id="contentleft"><div class="postarea"> </div></div> </div> <div class="clear"></div> <div id="footer"> <p></p> </div> </div></body> </html If this schema namespace is considered "built-in", then add namespaceprefix = <namespaceURI> to typemap.dat.
这个wsdl文件有什么问题? 我必须修改它吗?
这是wsdl文件:
<?xml version="1.0" encoding="utf-8"?> <wsdl:definitions xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:tns="http://tempuri.org/" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="TycoFileDownload" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> <wsp:Policy wsu:Id="WSHttpBinding_ITycoFileDownload_policy"> <wsp:ExactlyOne> <wsp:All> <sp:SymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> <wsp:Policy> <sp:ProtectionToken> <wsp:Policy> <sp:SecureConversationToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient"> <wsp:Policy> <sp:RequireDerivedKeys /> <sp:BootstrapPolicy> <wsp:Policy> <sp:SignedParts> <sp:Body /> <sp:Header Name="To" Namespace="http://www.w3.org/2005/08/addressing" /> <sp:Header Name="From" Namespace="http://www.w3.org/2005/08/addressing" /> <sp:Header Name="FaultTo" Namespace="http://www.w3.org/2005/08/addressing" /> <sp:Header Name="ReplyTo" Namespace="http://www.w3.org/2005/08/addressing" /> <sp:Header Name="MessageID" Namespace="http://www.w3.org/2005/08/addressing" /> <sp:Header Name="RelatesTo" Namespace="http://www.w3.org/2005/08/addressing" /> <sp:Header Name="Action" Namespace="http://www.w3.org/2005/08/addressing" /> </sp:SignedParts> <sp:EncryptedParts> <sp:Body /> </sp:EncryptedParts> <sp:SymmetricBinding> <wsp:Policy> <sp:ProtectionToken> <wsp:Policy> <sp:SpnegoContextToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient"> <wsp:Policy> <sp:RequireDerivedKeys /> </wsp:Policy> </sp:SpnegoContextToken> </wsp:Policy> </sp:ProtectionToken> <sp:AlgorithmSuite> <wsp:Policy> <sp:Basic256 /> </wsp:Policy> </sp:AlgorithmSuite> <sp:Layout> <wsp:Policy> <sp:Strict /> </wsp:Policy> </sp:Layout> <sp:IncludeTimestamp /> <sp:EncryptSignature /> <sp:OnlySignEntireHeadersAndBody /> </wsp:Policy> </sp:SymmetricBinding> <sp:Wss11> <wsp:Policy /> </sp:Wss11> <sp:Trust10> <wsp:Policy> <sp:MustSupportIssuedTokens /> <sp:RequireClientEntropy /> <sp:RequireServerEntropy /> </wsp:Policy> </sp:Trust10> </wsp:Policy> </sp:BootstrapPolicy> </wsp:Policy> </sp:SecureConversationToken> </wsp:Policy> </sp:ProtectionToken> <sp:AlgorithmSuite> <wsp:Policy> <sp:Basic256 /> </wsp:Policy> </sp:AlgorithmSuite> <sp:Layout> <wsp:Policy> <sp:Strict /> </wsp:Policy> </sp:Layout> <sp:IncludeTimestamp /> <sp:EncryptSignature /> <sp:OnlySignEntireHeadersAndBody /> </wsp:Policy> </sp:SymmetricBinding> <sp:Wss11 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> <wsp:Policy /> </sp:Wss11> <sp:Trust10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> <wsp:Policy> <sp:MustSupportIssuedTokens /> <sp:RequireClientEntropy /> <sp:RequireServerEntropy /> </wsp:Policy> </sp:Trust10> <wsaw:UsingAddressing /> </wsp:All> </wsp:ExactlyOne> </wsp:Policy> <wsp:Policy wsu:Id="WSHttpBinding_ITycoFileDownload_GetUpdate_Input_policy"> <wsp:ExactlyOne> <wsp:All> <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> <sp:Body /> <sp:Header Name="To" Namespace="http://www.w3.org/2005/08/addressing" /> <sp:Header Name="From" Namespace="http://www.w3.org/2005/08/addressing" /> <sp:Header Name="FaultTo" Namespace="http://www.w3.org/2005/08/addressing" /> <sp:Header Name="ReplyTo" Namespace="http://www.w3.org/2005/08/addressing" /> <sp:Header Name="MessageID" Namespace="http://www.w3.org/2005/08/addressing" /> <sp:Header Name="RelatesTo" Namespace="http://www.w3.org/2005/08/addressing" /> <sp:Header Name="Action" Namespace="http://www.w3.org/2005/08/addressing" /> </sp:SignedParts> <sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> <sp:Body /> </sp:EncryptedParts> </wsp:All> </wsp:ExactlyOne> </wsp:Policy> <wsp:Policy wsu:Id="WSHttpBinding_ITycoFileDownload_GetUpdate_output_policy"> <wsp:ExactlyOne> <wsp:All> <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> <sp:Body /> <sp:Header Name="To" Namespace="http://www.w3.org/2005/08/addressing" /> <sp:Header Name="From" Namespace="http://www.w3.org/2005/08/addressing" /> <sp:Header Name="FaultTo" Namespace="http://www.w3.org/2005/08/addressing" /> <sp:Header Name="ReplyTo" Namespace="http://www.w3.org/2005/08/addressing" /> <sp:Header Name="MessageID" Namespace="http://www.w3.org/2005/08/addressing" /> <sp:Header Name="RelatesTo" Namespace="http://www.w3.org/2005/08/addressing" /> <sp:Header Name="Action" Namespace="http://www.w3.org/2005/08/addressing" /> </sp:SignedParts> <sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> <sp:Body /> </sp:EncryptedParts> </wsp:All> </wsp:ExactlyOne> </wsp:Policy> <wsp:Policy wsu:Id="WSHttpBinding_ITycoFileDownload_GetLicenseAgreement_Input_policy"> <wsp:ExactlyOne> <wsp:All> <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> <sp:Body /> <sp:Header Name="To" Namespace="http://www.w3.org/2005/08/addressing" /> <sp:Header Name="From" Namespace="http://www.w3.org/2005/08/addressing" /> <sp:Header Name="FaultTo" Namespace="http://www.w3.org/2005/08/addressing" /> <sp:Header Name="ReplyTo" Namespace="http://www.w3.org/2005/08/addressing" /> <sp:Header Name="MessageID" Namespace="http://www.w3.org/2005/08/addressing" /> <sp:Header Name="RelatesTo" Namespace="http://www.w3.org/2005/08/addressing" /> <sp:Header Name="Action" Namespace="http://www.w3.org/2005/08/addressing" /> </sp:SignedParts> <sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> <sp:Body /> </sp:EncryptedParts> </wsp:All> </wsp:ExactlyOne> </wsp:Policy> <wsp:Policy wsu:Id="WSHttpBinding_ITycoFileDownload_GetLicenseAgreement_output_policy"> <wsp:ExactlyOne> <wsp:All> <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> <sp:Body /> <sp:Header Name="To" Namespace="http://www.w3.org/2005/08/addressing" /> <sp:Header Name="From" Namespace="http://www.w3.org/2005/08/addressing" /> <sp:Header Name="FaultTo" Namespace="http://www.w3.org/2005/08/addressing" /> <sp:Header Name="ReplyTo" Namespace="http://www.w3.org/2005/08/addressing" /> <sp:Header Name="MessageID" Namespace="http://www.w3.org/2005/08/addressing" /> <sp:Header Name="RelatesTo" Namespace="http://www.w3.org/2005/08/addressing" /> <sp:Header Name="Action" Namespace="http://www.w3.org/2005/08/addressing" /> </sp:SignedParts> <sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> <sp:Body /> </sp:EncryptedParts> </wsp:All> </wsp:ExactlyOne> </wsp:Policy> <wsdl:types> <xsd:schema targetNamespace="http://tempuri.org/Imports"> <xsd:import namespace="http://tempuri.org/" /> <xsd:import namespace="http://schemas.microsoft.com/2003/10/Serialization/" /> <xsd:import namespace="http://schemas.microsoft.com/Message" /> </xsd:schema> </wsdl:types> <wsdl:message name="ITycoFileDownload_GetUpdate_InputMessage"> <wsdl:part name="parameters" element="tns:GetUpdate" /> </wsdl:message> <wsdl:message name="ITycoFileDownload_GetUpdate_OutputMessage"> <wsdl:part name="parameters" element="tns:GetUpdateResponse" /> </wsdl:message> <wsdl:message name="ITycoFileDownload_GetLicenseAgreement_InputMessage"> <wsdl:part name="parameters" element="tns:GetLicenseAgreement" /> </wsdl:message> <wsdl:message name="ITycoFileDownload_GetLicenseAgreement_OutputMessage"> <wsdl:part name="parameters" element="tns:GetLicenseAgreementResponse" /> </wsdl:message> <wsdl:portType name="ITycoFileDownload"> <wsdl:operation name="GetUpdate"> <wsdl:input wsaw:Action="http://tempuri.org/ITycoFileDownload/GetUpdate" message="tns:ITycoFileDownload_GetUpdate_InputMessage" /> <wsdl:output wsaw:Action="http://tempuri.org/ITycoFileDownload/GetUpdateResponse" message="tns:ITycoFileDownload_GetUpdate_OutputMessage" /> </wsdl:operation> <wsdl:operation name="GetLicenseAgreement"> <wsdl:input wsaw:Action="http://tempuri.org/ITycoFileDownload/GetLicenseAgreement" message="tns:ITycoFileDownload_GetLicenseAgreement_InputMessage" /> <wsdl:output wsaw:Action="http://tempuri.org/ITycoFileDownload/GetLicenseAgreementResponse" message="tns:ITycoFileDownload_GetLicenseAgreement_OutputMessage" /> </wsdl:operation> </wsdl:portType> <wsdl:binding name="WSHttpBinding_ITycoFileDownload" type="tns:ITycoFileDownload"> <wsp:PolicyReference URI="#WSHttpBinding_ITycoFileDownload_policy" /> <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" /> <wsdl:operation name="GetUpdate"> <soap12:operation soapAction="http://tempuri.org/ITycoFileDownload/GetUpdate" style="document" /> <wsdl:input> <wsp:PolicyReference URI="#WSHttpBinding_ITycoFileDownload_GetUpdate_Input_policy" /> <soap12:body use="literal" /> </wsdl:input> <wsdl:output> <wsp:PolicyReference URI="#WSHttpBinding_ITycoFileDownload_GetUpdate_output_policy" /> <soap12:body use="literal" /> </wsdl:output> </wsdl:operation> <wsdl:operation name="GetLicenseAgreement"> <soap12:operation soapAction="http://tempuri.org/ITycoFileDownload/GetLicenseAgreement" style="document" /> <wsdl:input> <wsp:PolicyReference URI="#WSHttpBinding_ITycoFileDownload_GetLicenseAgreement_Input_policy" /> <soap12:body use="literal" /> </wsdl:input> <wsdl:output> <wsp:PolicyReference URI="#WSHttpBinding_ITycoFileDownload_GetLicenseAgreement_output_policy" /> <soap12:body use="literal" /> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="TycoFileDownload"> <wsdl:port name="WSHttpBinding_ITycoFileDownload" binding="tns:WSHttpBinding_ITycoFileDownload"> <soap12:address location="http://localhost:8733/Design_Time_Addresses/TycoUpdateServerLibrary/Service1/" /> <wsa10:EndpointReference> <wsa10:Address>http://localhost:8733/Design_Time_Addresses/TycoUpdateServerLibrary/Service1/</wsa10:Address> <Identity xmlns="http://schemas.xmlsoap.org/ws/2006/02/addressingidentity"> <Dns>localhost</Dns> </Identity> </wsa10:EndpointReference> </wsdl:port> </wsdl:service> </wsdl:definitions>
我已经将followig添加到<types>
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
现在它产生一个头文件。