none
Problem in connecting to WCF web service using gSOAP

    Question

  • Hello, I am writing a simple cmd client to try to consume the WCF web service i developed in order to test how to connect to the Web service using unmanaged C++.

    I have been following this tutorial http://www.blinnov.com/2008/01/22/wcf-service-unmanaged-client/en/ step by step but still not managed to consume the service successfully.

    #include "BasicHttpBinding_USCOREIService1.nsmap"
    
    
    #include "soapBasicHttpBinding_USCOREIService1Proxy.h"
    
    
    #include <iostream>
    #include <string>
    
    using namespace std;
    
    
    int main(int argc, char **argv)
    {
     BasicHttpBinding_USCOREIService1Proxy myProxy;
     static const char* const endPoint = "http://localhost:50181/Service1.svc";
    
     myProxy.soap_endpoint = endPoint;
     _ns1__GetData param;
     _ns1__GetDataResponse response;
     param.fileName = &std::string("house.ifc");
    
     if( myProxy.GetData(&param, &response) == SOAP_OK) {
      cout << "Hello" << endl; //Succeeded
     }
     else
     {
      myProxy.soap_stream_fault(std::cerr);
     }
    
     return 0;
    }

     

    The console always gives me

     

    Error 415 fault: SOAP-ENV:Server[no subcode] 
    "HTTP Error" Detail: HTTP/1.1 415 Unsupported Media Type

     

    I have been trying to connect to the service all the day but still not managed to consume it, I am really desperate as this is part of my graduation project and If i fail I will go a long way backward.

     

    Note: I am using BasicHttpBinding to use soap version 1.1 message.

    I could listen to other alternatives as long as it able me to connect to WCF service using unmanaged C++

    Sunday, December 26, 2010 8:59 AM

Answers

  • probably you send a wrong content-type http header (it should be text/xml).

    you can verify it using a tool like Fiddler.

    you would need to ask a gsoap forums on how to change it though.


    http://webservices20.blogspot.com/
    WCF Security, Interoperability And Performance Blog
    • Marked as answer by Bin-ze Zhao Monday, December 27, 2010 9:32 AM
    Sunday, December 26, 2010 5:25 PM

All replies

  • probably you send a wrong content-type http header (it should be text/xml).

    you can verify it using a tool like Fiddler.

    you would need to ask a gsoap forums on how to change it though.


    http://webservices20.blogspot.com/
    WCF Security, Interoperability And Performance Blog
    • Marked as answer by Bin-ze Zhao Monday, December 27, 2010 9:32 AM
    Sunday, December 26, 2010 5:25 PM
  • Thanks for your reply.

    Although i couldn't manage to make fiddler see the HTTP request made from my cmd client(although i have set the proxy in the myProxy to http:\\127.0.0.1.:8888) but i'll research the possibility of the wrong content-type http header at the gSOAP forums as you advised.

     

    Sunday, December 26, 2010 10:44 PM
  • You can host your wcf service in IIS, and then use your local ip address to access the service instead of 127.0.0.1(this is a loop back address, fiddler cannot catch the traffic in it.)

    Sunday, December 26, 2010 10:56 PM
  • override the client url so it will send the request directly to http://localhost:8888/.

    this will show you the request.


    http://webservices20.blogspot.com/
    WCF Security, Interoperability And Performance Blog
    Sunday, December 26, 2010 10:57 PM
  • I have done what you said (by changing the endPoint to http://localhost:8888 instead of http://localhost:50181/Service1.svc) to send the request to fiddler instead.

    What i have found is that the request header's content type is application/soap+xml; charset=utf-8) and the response header's content type is text/html.

    So i guess you are right i have to find a way to send the request as text/xml i'll ask at gSOAP forums.

    EDIT: Do you know any good gSOAP forum out there ?

    Monday, December 27, 2010 10:49 AM
  • here is gsoap mailing list:

    http://tech.groups.yahoo.com/group/gsoap/

    here is its user guide in the relevant section:

    http://www.cs.fsu.edu/~engelen/soapdoc2.html#tth_sEc9.2

    what you want is to change the request soap version to soap11 (not soap12 as now), which will change the content-type header to "text/xml" (not "text/html")


    http://webservices20.blogspot.com/
    WCF Security, Interoperability And Performance Blog
    Monday, December 27, 2010 4:55 PM
  • Till now i didn't receive an answer in the mailing list despite sending the problem yesterday .

    But what if i made the wcf service binding be WSHTTPBinding so that it can use soap v1.2 will it going to work ?

    Tuesday, December 28, 2010 10:43 AM
  • On 12/28/2010 5:43 AM, R4md4c wrote:
    > Till now i didn't receive an answer in the mailing list despite sending
    > the problem yesterday .
    >
    > But what if i made the wcf service binding be WSHTTPBinding so that it
    > can use soap v1.2 will it going to work ?
     
    In this Web config that was implementing WCF Web service, SOAP was used.
     
     
    <?xml version="1.0"?>
    <configuration>
    <configSections>
    <section name="enterpriseLibrary.ConfigurationSource"
    type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationSourceSection,
    Microsoft.Practices.EnterpriseLibrary.Common, Version=3.1.0.0,
    Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    <sectionGroup name="system.web.extensions"
    type="System.Web.Configuration.SystemWebExtensionsSectionGroup,
    System.Web.Extensions, Version=3.5.0.0, Culture=neutral,
    PublicKeyToken=31BF3856AD364E35">
    <sectionGroup name="scripting"
    type="System.Web.Configuration.ScriptingSectionGroup,
    System.Web.Extensions, Version=3.5.0.0, Culture=neutral,
    PublicKeyToken=31BF3856AD364E35">
    <section name="scriptResourceHandler"
    type="System.Web.Configuration.ScriptingScriptResourceHandlerSection,
    System.Web.Extensions, Version=3.5.0.0, Culture=neutral,
    PublicKeyToken=31BF3856AD364E35" requirePermission="false"
    allowDefinition="MachineToApplication" />
    <sectionGroup name="webServices"
    type="System.Web.Configuration.ScriptingWebServicesSectionGroup,
    System.Web.Extensions, Version=3.5.0.0, Culture=neutral,
    PublicKeyToken=31BF3856AD364E35">
    <section name="jsonSerialization"
    type="System.Web.Configuration.ScriptingJsonSerializationSection,
    System.Web.Extensions, Version=3.5.0.0, Culture=neutral,
    PublicKeyToken=31BF3856AD364E35" requirePermission="false"
    allowDefinition="Everywhere" />
    <section name="profileService"
    type="System.Web.Configuration.ScriptingProfileServiceSection,
    System.Web.Extensions, Version=3.5.0.0, Culture=neutral,
    PublicKeyToken=31BF3856AD364E35" requirePermission="false"
    allowDefinition="MachineToApplication" />
    <section name="authenticationService"
    type="System.Web.Configuration.ScriptingAuthenticationServiceSection,
    System.Web.Extensions, Version=3.5.0.0, Culture=neutral,
    PublicKeyToken=31BF3856AD364E35" requirePermission="false"
    allowDefinition="MachineToApplication" />
    <section name="roleService"
    type="System.Web.Configuration.ScriptingRoleServiceSection,
    System.Web.Extensions, Version=3.5.0.0, Culture=neutral,
    PublicKeyToken=31BF3856AD364E35" requirePermission="false"
    allowDefinition="MachineToApplication" />
    </sectionGroup>
    </sectionGroup>
    </sectionGroup>
    <sectionGroup name="applicationSettings"
    type="System.Configuration.ApplicationSettingsGroup, System,
    Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    <section name="KN.Tiers.Services.Properties.Settings"
    type="System.Configuration.ClientSettingsSection, System,
    Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
    requirePermission="false" />
    </sectionGroup>
    </configSections>
    <enterpriseLibrary.ConfigurationSource selectedSource="File
    Configuration Source">
    <sources>
    <add name="File Configuration Source"
    type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationSource,
    Microsoft.Practices.EnterpriseLibrary.Common, Version=3.1.0.0,
    Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
    filePath="C:\Projects\KN\Tiers\services\EntLib.config" />
    </sources>
    </enterpriseLibrary.ConfigurationSource>
    <system.diagnostics>
    <sources>
    <source name="System.ServiceModel" switchValue="Off,
    ActivityTracing" propagateActivity="true">
    <listeners>
    <add type="System.Diagnostics.DefaultTraceListener"
    name="Default">
    <filter type="" />
    </add>
    <add name="ServiceModelTraceListener">
    <filter type="" />
    </add>
    </listeners>
    </source>
    </sources>
    <sharedListeners>
    <add
    initializeData="C:\Projects\KN\Tiers\Services\Web_tracelog2.svclog"
    type="System.Diagnostics.XmlWriterTraceListener, System,
    Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
    name="ServiceModelTraceListener" traceOutputOptions="Timestamp">
    <filter type="" />
    </add>
    </sharedListeners>
    </system.diagnostics>
    <connectionStrings>
    <add name="LinksEntities"
    connectionString="metadata=res://*/;provider=System.Data.SqlClient;provider
    connection string="Data Source=.;Initial Catalog=Links;Persist
    Security Info=True;User
    ID=Mainweb;Password=&YGV6tfc;MultipleActiveResultSets=True""
    providerName="System.Data.EntityClient" />
    <add name="MainWebDBEntities1"
    connectionString="metadata=res://*/;provider=System.Data.SqlClient;provider
    connection string="Data Source=.;Initial Catalog=MainWebDB;Persist
    Security Info=True;User
    ID=MainWeb;Password=&YGV6tfc;MultipleActiveResultSets=True""
    providerName="System.Data.EntityClient" />
    <add name="NetworkNowEntities"
    connectionString="metadata=res://*/;provider=System.Data.SqlClient;provider
    connection string="Data Source=.;Initial Catalog=NetworkNow;Persist
    Security Info=True;User
    ID=Mainweb;Password=&YGV6tfc;MultipleActiveResultSets=True""
    providerName="System.Data.EntityClient" />
    </connectionStrings>
    <appSettings>
    <add key="DatabaseInstance" value="MainWebDB_Net" />
    <add key="SqlDependencyDatabaseInstances"
    value="MainWebDB_Net,LinksDB_Net" />
    <add key="AFKN_RSS_Profile"
    value="C:\Projects\KN\Tiers\Services\App\BLL\RSS\AFKN_RSS_Profile.xml" />
    <add key="CoPLinksXMLPath" value="CoP_Links_XML\DefaultLinks.xml" />
    <add key="CoPHomePageXMLPath"
    value="CoP_HomePage_XML\AvailableWidgets.xml" />
    <add key="CoPHomePageTemplateXMLPath"
    value="CoP_HomePage_XML\Templates.xml" />
    </appSettings>
    <system.web>
    <webServices>
    <soapExtensionTypes>
    <add
    type="KN.Tiers.Services.ServiceExceptionHandling.LoggingSoapExtension,
    KN.Tiers.Services" priority="1" group="High" />
    </soapExtensionTypes>
    <protocols>
    <add name="HttpGet" />
    <add name="HttpPost" />
    </protocols>
    </webServices>
    <siteMap defaultProvider="GlobalNavigationSiteMap" enabled="true">
    <providers>
    <add name="GlobalNavigationSiteMap"
    type="KN.Tiers.Services.Navigation.KNSiteMapProvider"
    securityTrimmingEnabled="true"
    siteMapFile="~/App_Themes/AFKN/GlobalNav.sitemap" />
    </providers>
    </siteMap>
    <identity impersonate="true" userName="triune\TFSSetup"
    password="&YGV6tfc" />
    <compilation debug="true">
    <assemblies>
    <add assembly="System.Core, Version=3.5.0.0, Culture=neutral,
    PublicKeyToken=B77A5C561934E089" />
    <add assembly="System.Web.Extensions, Version=3.5.0.0,
    Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <add assembly="System.Xml.Linq, Version=3.5.0.0,
    Culture=neutral, PublicKeyToken=B77A5C561934E089" />
    <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0,
    Culture=neutral, PublicKeyToken=B77A5C561934E089" />
    </assemblies>
    </compilation>
    <authentication mode="Windows" />
    <pages smartNavigation="false" theme="AFKN">
    <controls>
    <add tagPrefix="asp" namespace="System.Web.UI"
    assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral,
    PublicKeyToken=31BF3856AD364E35" />
    <add tagPrefix="asp" namespace="System.Web.UI.WebControls"
    assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral,
    PublicKeyToken=31BF3856AD364E35" />
    </controls>
    </pages>
    <httpHandlers>
    <remove verb="*" path="*.asmx" />
    <add verb="*" path="*.asmx" validate="false"
    type="System.Web.Script.Services.ScriptHandlerFactory,
    System.Web.Extensions, Version=3.5.0.0, Culture=neutral,
    PublicKeyToken=31BF3856AD364E35" />
    <add verb="*" path="*_AppService.axd" validate="false"
    type="System.Web.Script.Services.ScriptHandlerFactory,
    System.Web.Extensions, Version=3.5.0.0, Culture=neutral,
    PublicKeyToken=31BF3856AD364E35" />
    <add verb="GET,HEAD" path="ScriptResource.axd" validate="false"
    type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions,
    Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    </httpHandlers>
    <httpModules>
    <add name="ScriptModule" type="System.Web.Handlers.ScriptModule,
    System.Web.Extensions, Version=3.5.0.0, Culture=neutral,
    PublicKeyToken=31BF3856AD364E35" />
    </httpModules>
    </system.web>
    <system.codedom>
    <compilers>
    <compiler language="c#;cs;csharp" extension=".cs"
    type="Microsoft.CSharp.CSharpCodeProvider,System, Version=2.0.0.0,
    Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
    <providerOption name="CompilerVersion" value="v3.5" />
    <providerOption name="WarnAsError" value="false" />
    </compiler>
    </compilers>
    </system.codedom>
    <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules>
    <remove name="ScriptModule" />
    <add name="ScriptModule" preCondition="managedHandler"
    type="System.Web.Handlers.ScriptModule, System.Web.Extensions,
    Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    </modules>
    <handlers>
    <remove name="WebServiceHandlerFactory-Integrated" />
    <remove name="ScriptHandlerFactory" />
    <remove name="ScriptHandlerFactoryAppServices" />
    <remove name="ScriptResource" />
    <add name="ScriptHandlerFactory" verb="*" path="*.asmx"
    preCondition="integratedMode"
    type="System.Web.Script.Services.ScriptHandlerFactory,
    System.Web.Extensions, Version=3.5.0.0, Culture=neutral,
    PublicKeyToken=31BF3856AD364E35" />
    <add name="ScriptHandlerFactoryAppServices" verb="*"
    path="*_AppService.axd" preCondition="integratedMode"
    type="System.Web.Script.Services.ScriptHandlerFactory,
    System.Web.Extensions, Version=3.5.0.0, Culture=neutral,
    PublicKeyToken=31BF3856AD364E35" />
    <add name="ScriptResource" verb="GET,HEAD"
    path="ScriptResource.axd" preCondition="integratedMode"
    type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions,
    Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    </handlers>
    </system.webServer>
    <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
    <assemblyIdentity name="System.Web.Extensions"
    publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="1.0.0.0-1.1.0.0"
    newVersion="3.5.0.0" />
    </dependentAssembly>
    <dependentAssembly>
    <assemblyIdentity name="System.Web.Extensions.Design"
    publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="1.0.0.0-1.1.0.0"
    newVersion="3.5.0.0" />
    </dependentAssembly>
    </assemblyBinding>
    </runtime>
    <system.serviceModel>
    <extensions>
    <behaviorExtensions>
    <add name="WCFErrorHandlingBehavior"
    type="KN.Tiers.Services.ServiceExceptionHandling.WCFErrorHandlerBehavior, KN.Tiers.Services,
    Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
    </behaviorExtensions>
    </extensions>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
    <bindings>
    <customBinding>
    <binding name="MessageBrokerSoap12">
    <textMessageEncoding maxReadPoolSize="64"
    maxWritePoolSize="16" messageVersion="Soap12" writeEncoding="utf-8">
    <readerQuotas maxDepth="32"
    maxStringContentLength="2147483647" maxArrayLength="16384"
    maxBytesPerRead="4096" maxNameTableCharCount="16384" />
    </textMessageEncoding>
    <httpTransport manualAddressing="false"
    maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
    allowCookies="false" authenticationScheme="Anonymous"
    bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
    keepAliveEnabled="true" maxBufferSize="65536"
    proxyAuthenticationScheme="Anonymous" realm="" transferMode="Buffered"
    unsafeConnectionNtlmAuthentication="false" useDefaultWebProxy="true" />
    </binding>
    </customBinding>
    <basicHttpBinding>
    <binding name="MessageBrokerSoap" closeTimeout="00:01:00"
    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
    allowCookies="false" bypassProxyOnLocal="false"
    hostNameComparisonMode="StrongWildcard" maxBufferSize="65536"
    maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
    messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
    useDefaultWebProxy="true">
    <readerQuotas maxDepth="32"
    maxStringContentLength="2147483647" maxArrayLength="16384"
    maxBytesPerRead="4096" maxNameTableCharCount="16384" />
    <security mode="None">
    <transport clientCredentialType="None"
    proxyCredentialType="None" realm="" />
    <message clientCredentialType="UserName"
    algorithmSuite="Default" />
    </security>
    </binding>
    <binding name="basicHttpBinding" closeTimeout="00:01:00"
    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
    allowCookies="false" bypassProxyOnLocal="false"
    hostNameComparisonMode="StrongWildcard" maxBufferSize="65536"
    maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647"
    messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
    useDefaultWebProxy="true">
    <readerQuotas maxDepth="32"
    maxStringContentLength="2147483647" maxArrayLength="16384"
    maxBytesPerRead="4096" maxNameTableCharCount="16384" />
    <security mode="None">
    <transport clientCredentialType="None"
    proxyCredentialType="None" realm="" />
    <message clientCredentialType="UserName"
    algorithmSuite="Default" />
    </security>
    </binding>
    <binding name="NewBindingsMaxSizes"
    maxReceivedMessageSize="2147483647">
    <readerQuotas maxDepth="64"
    maxStringContentLength="2147483647" maxArrayLength="2147483647"
    maxBytesPerRead="4096" maxNameTableCharCount="16384" />
    </binding>
    </basicHttpBinding>
    <wsHttpBinding>
    <binding name="NewBindingsMaxSizes"
    maxReceivedMessageSize="2147483647">
    <readerQuotas maxDepth="64"
    maxStringContentLength="2147483647" maxArrayLength="2147483647"
    maxBytesPerRead="4096" maxNameTableCharCount="16384" />
    </binding>
    <binding name="NewBindingsMaxSizesNoSecurity"
    maxReceivedMessageSize="2147483647">
    <readerQuotas maxDepth="64"
    maxStringContentLength="2147483647" maxArrayLength="2147483647"
    maxBytesPerRead="4096" maxNameTableCharCount="16384" />
    <security mode="None" />
    </binding>
    <binding name="TransactionBindingsMaxSizes"
    transactionFlow="true" maxReceivedMessageSize="2147483647">
    <readerQuotas maxDepth="64"
    maxStringContentLength="2147483647" maxArrayLength="2147483647"
    maxBytesPerRead="4096" maxNameTableCharCount="16384" />
    <reliableSession ordered="true" inactivityTimeout="00:10:00"
    enabled="false" />
    </binding>
    <binding name="TransactionBindingsMaxSizesNoSecurity"
    transactionFlow="true" maxReceivedMessageSize="2147483647">
    <readerQuotas maxDepth="64"
    maxStringContentLength="2147483647" maxArrayLength="2147483647"
    maxBytesPerRead="4096" maxNameTableCharCount="16384" />
    <reliableSession ordered="true" inactivityTimeout="00:10:00"
    enabled="false" />
    <security mode="None" />
    </binding>
    </wsHttpBinding>
    </bindings>
    <services>
    <service
    behaviorConfiguration="KN.Tiers.Services.App.BLL.Community.CommunityBehavior"
    name="KN.Tiers.Services.App.BLL.Community.Community">
    <endpoint address="/wsSoap" binding="wsHttpBinding"
    bindingConfiguration="NewBindingsMaxSizesNoSecurity"
    contract="KN.Tiers.Services.App.BLL.Community.ServiceContracts.ICommunity">
    <identity>
    <dns value="localhost" />
    </identity>
    </endpoint>
    <endpoint address="/BasicSoap" binding="basicHttpBinding"
    bindingConfiguration="NewBindingsMaxSizes" name="basicHttpBinding"
    contract="KN.Tiers.Services.App.BLL.Community.ServiceContracts.ICommunity"
    />
    <endpoint address="mex" binding="mexHttpBinding"
    contract="IMetadataExchange" />
    </service>
    <service
    behaviorConfiguration="KN.Tiers.Services.App.BLL.Cloud.CloudManagerBehavior"
    name="KN.Tiers.Services.App.BLL.Cloud.CloudManager">
    <endpoint address="" binding="wsHttpBinding"
    bindingConfiguration="NewBindingsMaxSizes" name="CloudManager"
    contract="KN.Tiers.Services.App.BLL.Cloud.ServiceContracts.ICloudManager">
    <identity>
    <dns value="localhost" />
    </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding"
    contract="IMetadataExchange" />
    </service>
    <service
    behaviorConfiguration="KN.Tiers.Services.App.BLL.NetworkNow.NetworkNowManagerBehavior"
    name="KN.Tiers.Services.App.BLL.NetworkNow.NetworkNowManager">
    <endpoint address="" binding="wsHttpBinding"
    bindingConfiguration="TransactionBindingsMaxSizesNoSecurity"
    name="NetworkNowManager"
    contract="KN.Tiers.Services.App.BLL.NetworkNow.ServiceContracts.INetworkNowManager">
    <identity>
    <dns value="localhost" />
    </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding"
    contract="IMetadataExchange" />
    <host>
    <baseAddresses>
    <add
    baseAddress="http://localhost:8080/App/BLL/NetworkNow/NetworkNowManager.svc"
    />
    </baseAddresses>
    </host>
    </service>
    <service
    behaviorConfiguration="KN.Tiers.Services.App.BLL.ActionItem.ActionItemManagerBehavior"
    name="KN.Tiers.Services.App.BLL.ActionItem.ActionItemManager">
    <endpoint address="" binding="wsHttpBinding"
    bindingConfiguration="TransactionBindingsMaxSizesNoSecurity"
    name="ActionItemManager"
    contract="KN.Tiers.Services.App.BLL.ActionItem.IActionItemManager">
    <identity>
    <dns value="localhost" />
    </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding"
    contract="IMetadataExchange" />
    <host>
    <baseAddresses>
    <add
    baseAddress="http://localhost:8080/App/BLL/ActionItem/ActionItemManager.svc"
    />
    </baseAddresses>
    </host>
    </service>
    <service
    behaviorConfiguration="KN.Tiers.Services.App.BLL.Links.LinkManagerBehavior"
    name="KN.Tiers.Services.App.BLL.Links.LinkManager">
    <endpoint address="/wsSoap" binding="wsHttpBinding"
    bindingConfiguration="TransactionBindingsMaxSizes" name="LinkService"
    contract="KN.Tiers.Services.App.BLL.Links.ServiceContracts.ILinkManager">
    <identity>
    <dns value="localhost" />
    </identity>
    </endpoint>
    <endpoint address="/BasicSoap" binding="basicHttpBinding"
    bindingConfiguration="NewBindingsMaxSizes" name="basicHttpBinding"
    contract="KN.Tiers.Services.App.BLL.Links.ServiceContracts.ILinkManager" />
    <endpoint address="mex" binding="mexHttpBinding"
    bindingConfiguration="" contract="IMetadataExchange" />
    <host>
    <baseAddresses>
    <add
    baseAddress="http://localhost:8080/app/bll/links/LinkManager.svc" />
    </baseAddresses>
    </host>
    </service>
    <service
    behaviorConfiguration="KN.Tiers.Services.App.BLL.Wiki.WikiManagerBehavior"
    name="KN.Tiers.Services.App.BLL.Wiki.WikiManager">
    <endpoint address="" binding="wsHttpBinding"
    bindingConfiguration="TransactionBindingsMaxSizesNoSecurity"
    name="WikiManager"
    contract="KN.Tiers.Services.App.BLL.Wiki.ServiceContracts.IWikiManager">
    <identity>
    <dns value="localhost" />
    </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding"
    contract="IMetadataExchange" />
    <host>
    <baseAddresses>
    <add
    baseAddress="http://localhost:8080/app/bll/Wiki/WikiManager.svc" />
    </baseAddresses>
    </host>
    </service>
    <service
    behaviorConfiguration="KN.Tiers.Services.App.BLL.LMS.LMSManagerBehavior"
    name="KN.Tiers.Services.App.BLL.LMS.LMSManager">
    <endpoint address="" binding="wsHttpBinding"
    bindingConfiguration="TransactionBindingsMaxSizesNoSecurity"
    name="LMSManager"
    contract="KN.Tiers.Services.App.BLL.LMS.ServiceContracts.ILMSManager">
    <identity>
    <dns value="localhost" />
    </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding"
    contract="IMetadataExchange" />
    <host>
    <baseAddresses>
    <add
    baseAddress="http://localhost:8080/app/bll/LMS/LMSManager.svc" />
    </baseAddresses>
    </host>
    </service>
    </services>
    <behaviors>
    <serviceBehaviors>
    <behavior
    name="KN.Tiers.Services.App.BLL.Community.CommunityBehavior">
    <serviceThrottling maxConcurrentCalls="32"
    maxConcurrentSessions="32" maxConcurrentInstances="520" />
    <serviceMetadata httpGetEnabled="true" />
    <serviceDebug includeExceptionDetailInFaults="true" />
    <WCFErrorHandlingBehavior />
    </behavior>
    <behavior
    name="KN.Tiers.Services.App.BLL.NetworkNow.NetworkNowManagerBehavior">
    <serviceThrottling maxConcurrentCalls="32"
    maxConcurrentSessions="32" maxConcurrentInstances="520" />
    <serviceMetadata httpGetEnabled="true" />
    <serviceDebug includeExceptionDetailInFaults="true" />
    <WCFErrorHandlingBehavior />
    </behavior>
    <behavior
    name="KN.Tiers.Services.App.BLL.Cloud.CloudManagerBehavior">
    <serviceThrottling maxConcurrentCalls="32"
    maxConcurrentSessions="32" maxConcurrentInstances="520" />
    <serviceMetadata httpGetEnabled="true" />
    <serviceDebug includeExceptionDetailInFaults="true" />
    <WCFErrorHandlingBehavior />
    </behavior>
    <behavior
    name="KN.Tiers.Services.App.BLL.ActionItem.ActionItemManagerBehavior">
    <serviceMetadata httpGetEnabled="true" />
    <serviceDebug includeExceptionDetailInFaults="false" />
    </behavior>
    <behavior
    name="KN.Tiers.Services.App.BLL.Links.LinkManagerBehavior">
    <serviceMetadata httpGetEnabled="true" />
    <serviceDebug includeExceptionDetailInFaults="false" />
    <WCFErrorHandlingBehavior />
    </behavior>
    <behavior
    name="KN.Tiers.Services.App.BLL.Wiki.WikiManagerBehavior">
    <serviceMetadata httpGetEnabled="true" />
    <serviceDebug includeExceptionDetailInFaults="false" />
    <WCFErrorHandlingBehavior />
    </behavior>
    <behavior name="KN.Tiers.Services.App.BLL.LMS.LMSManagerBehavior">
    <serviceMetadata httpGetEnabled="true" />
    <serviceDebug includeExceptionDetailInFaults="false" />
    <WCFErrorHandlingBehavior />
    </behavior>
    </serviceBehaviors>
    </behaviors>
    <client>
    <endpoint
    address="http://localhost:8080/App/BLL/MessageBroker/MessageBroker.asmx"
    binding="basicHttpBinding" bindingConfiguration="MessageBrokerSoap"
    contract="MessageBrokerReference.MessageBrokerSoap"
    name="MessageBrokerSoap" />
    <endpoint
    address="http://localhost:8080/App/BLL/MessageBroker/MessageBroker.asmx"
    binding="customBinding" bindingConfiguration="MessageBrokerSoap12"
    contract="MessageBrokerReference.MessageBrokerSoap"
    name="MessageBrokerSoap12" />
    <endpoint
    address="http://localhost:8080/App/BLL/Links/LinkManager.svc/wsSoap"
    binding="wsHttpBinding"
    bindingConfiguration="TransactionBindingsMaxSizes"
    contract="LinkManagerReference.ILinkManager" name="LinkService">
    <identity>
    <dns value="localhost" />
    </identity>
    </endpoint>
    <endpoint
    address="http://localhost:8080/App/BLL/Links/LinkManager.svc/BasicSoap"
    binding="basicHttpBinding" bindingConfiguration="basicHttpBinding"
    contract="LinkManagerReference.ILinkManager" name="basicHttpBinding" />
    </client>
    </system.serviceModel>
    <applicationSettings>
    <KN.Tiers.Services.Properties.Settings>
    <setting
    name="KN_Tiers_Community_ConfigManagerReference_ConfigManager"
    serializeAs="String">
    <value>http://localhost:8080/App/BLL/Configuration/ConfigManager.asmx</value>
    </setting>
    </KN.Tiers.Services.Properties.Settings>
    </applicationSettings>
    </configuration>
     
    Tuesday, December 28, 2010 11:19 AM
  • wshttp will not work since it requires more standards which gsoap does not support.

    you can try to use a custom binding with these elements:

    <textMessageEncoding messageVersion="Soap12" />

    <httpTransport />

    if you have a special setting on the basic http binding see here how to convert it to custom binding:

    http://webservices20.blogspot.com/2009/08/bindingbox-convert-wcf-bindings.html


    http://webservices20.blogspot.com/
    WCF Security, Interoperability And Performance Blog
    Tuesday, December 28, 2010 4:28 PM
  • I did a new custom binding with these tags as you said

     

    <bindings>
     <customBinding>
     <binding name="CustomBinding">
     <textMessageEncoding messageVersion="Soap12" />
     <httpTransport />
     </binding>
     </customBinding>
     </bindings>
     
    

     

    And then generated a new code client using soapcpp2.exe and made the changes necessary to the code.

    But a new error message appeared

     

    SOAP 1.2 fault: SOAP-ENV:Sender["http://schemas.microsoft.com/ws/2005/05/addressing/none":ActionNotSupported]
    "The message with Action '' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and recei
    ver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None)."
    Detail: [no detail]

     

    So i guess from this message there is a problem in the client's configuration if that is, Is there a something like app.config in gsoap ?

     

     

    Tuesday, December 28, 2010 7:16 PM
  • please publish the full web.config - the error complains that no ws-addressing was sent, but if the configuration I suggested above is applied then no ws-a should be required.

    also publish the soap that the client sends + http headers.


    http://webservices20.blogspot.com/
    WCF Security, Interoperability And Performance Blog
    Tuesday, December 28, 2010 9:10 PM
  • Here is the web.config

     

    <?xml version="1.0"?>
    <configuration>
    
    
     <configSections>
      <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
      <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
       <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
       <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
       <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" />
       <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
       <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
       <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
       </sectionGroup>
      </sectionGroup>
      </sectionGroup>
     </configSections> 
    
    
     <appSettings/>
     <connectionStrings/>
    
     <system.web>
      <compilation debug="true">
    
       <assemblies>
       <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
       <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
       </assemblies>
    
      </compilation>
      <authentication mode="Windows" />
    
    
      <pages>
      <controls>
       <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      </controls>
      </pages>
    
      <httpHandlers>
      <remove verb="*" path="*.asmx"/>
      <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
      </httpHandlers>
      <httpModules>
      <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      </httpModules>
    
    
     </system.web>
    
     <system.codedom>
      <compilers>
      <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4"
         type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
       <providerOption name="CompilerVersion" value="v3.5"/>
       <providerOption name="WarnAsError" value="false"/>
      </compiler>
      </compilers>
     </system.codedom>
    
     <system.webServer>
      <validation validateIntegratedModeConfiguration="false"/>
      <modules>
      <add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      </modules>
      <handlers>
      <remove name="WebServiceHandlerFactory-Integrated"/>
      <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode"
        type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode"
        type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      </handlers>
     </system.webServer>
    
    
     <system.serviceModel>
     <bindings>
      <customBinding>
      <binding name="CustomBinding">
       <textMessageEncoding messageVersion="Soap12" />
       <httpTransport />
      </binding>
      </customBinding>
     </bindings>
     <services>
      <service behaviorConfiguration="WcfRead.Service1Behavior" name="WcfRead.Service1">
      <endpoint address="" binding="customBinding" bindingConfiguration="CustomBinding"
       contract="WcfRead.IService1">
       <identity>
       <dns value="localhost" />
       </identity>
      </endpoint>
      <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>
     </services>
     <behaviors>
      <serviceBehaviors>
      <behavior name="WcfRead.Service1Behavior">
       <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
       <serviceMetadata httpGetEnabled="true"/>
       <serviceDebug includeExceptionDetailInFaults="false"/>
      </behavior>
      </serviceBehaviors>
     </behaviors>
     </system.serviceModel>
    </configuration>
    
    

     

    Here is the client request i got from fiddler

     

    <?xml version="1.0" encoding="UTF-8"?>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns3="http://schemas.microsoft.com/2003/10/Serialization/" xmlns:ns1="http://tempuri.org/"><SOAP-ENV:Body><ns1:GetData><ns1:fileName></ns1:fileName></ns1:GetData></SOAP-ENV:Body></SOAP-ENV:Envelope>
    

     

    Tuesday, December 28, 2010 9:31 PM
  • this soap should work.

    try to setup a wcf client and see how the soap it produce (and http headers) differs.


    http://webservices20.blogspot.com/
    WCF Security, Interoperability And Performance Blog
    Tuesday, December 28, 2010 9:53 PM
  • Here is the wcf client made with C# request (changed the endpoint address to localhost:8888)

    <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Body><GetData xmlns="http://tempuri.org/"><fileName>house.ifc</fileName></GetData></s:Body></s:Envelope>
    

    It is obvious that there is  difference between both headers(the one in c++ and c#)

    The question is how to make the c++ client to send such a soap request?.

    Tuesday, December 28, 2010 10:03 PM
  • there are no differences actually. it is ok to use differenct prefixes as long as the namespaces are the same. please check the http headers, mainly the soapaction and content-type
    http://webservices20.blogspot.com/
    WCF Security, Interoperability And Performance Blog
    Tuesday, December 28, 2010 10:08 PM
  • The http header of the wcf client written in C# is 

    Content-Type: application/soap+xml; charset=utf-8; action="http://tempuri.org/IService1/GetData"

    While the C++ client

    Content-Type: application/soap+xml; charset=utf-8

    SOAPAction: "http://tempuri.org/IService1/GetData"

     

    I see no difference in both headers :(

     

    Tuesday, December 28, 2010 10:15 PM
  • there is a big difference - in c# the action is part of the content-type header, and there is no separate soapaction header as in cpp.

    to verify this is the issue you can try to call the service "manually" using webclient or httprequest and send the cpp soap with the c# header, which should work. this would prove the problem is with the cpp headers. which again force you to get some gsoap answers...

    I guess you could do some workarounds on the server side, like implementing a custom transport/encoder that changes the incoming http headers, but this seems overkill for something which I expect gsoap to support.

    please let us know if you hear anything from the gsoap community.


    http://webservices20.blogspot.com/
    WCF Security, Interoperability And Performance Blog
    Tuesday, December 28, 2010 10:29 PM
  • I wrote a simple console application with C# and used HttpWebRequest.

    I set the ContentType to application/soap+xml; charset=utf-8; action="http://tempuri.org/IService1/GetData"

    Added also SOAPAction header with value "http://tempuri.org/IService1/GetData"

    And the service worked flawlessly and stopped functioning when i removed the action in the ContentType i wrote above so i guess you are right the problem is in the C++ sent headers.

    I am going to ask about how to make gsoap send the request with the ContentType used above.

     

    Thanks a lot for your helping.

    Wednesday, December 29, 2010 12:09 AM
  • I solved the problem of writing an unmanaged C++ gsoap client to connect to the WCF service.

    By using the prior approach i wanted to implement by making a custom binding that sends message version soap1.1 and the gsoap client uses the same message version such that the format of the sent header and the expected header that the service expects is the same.

    This was achieved by :-

    By replacing SOAP-ENV and SOAP-ENC namespaces that resides in the *.nsmap file and the *Proxy.cpp to

    {"SOAP-ENV", "http://schemas.xmlsoap.org/soap/envelope/", NULL, NULL},
    
    {"SOAP-ENC", "http://schemas.xmlsoap.org/soap/encoding/", NULL, NULL} 
    
    {"xsi", "http://www.w3.org/2001/XMLSchema-instance", NULL, NULL},

    The above three lines tells the client to send SOAP message with version 1.1 instead of the default generated message version 1.2

    I hope that this post be helpful to people who faces the same problem.

    • Proposed as answer by FugersonHall Thursday, May 05, 2011 11:46 PM
    Saturday, January 01, 2011 1:47 PM
  • Thanks for this post, and it removed the error of "Unsupported Media Type". But after that, I get SOAP_FAULT error. I am using basichttpbinding. Any ideas. Thanks.

     

    Thursday, May 05, 2011 9:07 PM
  • I got the solution, and it is from the method in the WCF. Now it work. Thanks for the great post.
    Thursday, May 05, 2011 11:46 PM