Guten Morgen und Hallo an Alle!
Um den Zugriff per Soap und C++ auf einen Webservice zu testen habe ich als kleines Testprogramm einen WCF Server geschrieben, der eine Datumsabfrage zu Verfügung stellt. Auf diesen greife ich mit einem C++ Client via gSoap zu und frage das aktuelle Datum ab.
Die Übermittlung mit http Binding funktioniert einwandfrei!
Jetzt ist es für ein Projekt zwingend(!) notwendig, dass dieser Zugriff mit https durchgeführt wird!
Ich habe mich schon in das Thema eingelesen, allerdings bekomme ich das nicht zum laufen.
Meine App.config für http Binding sieht folgendermaßen aus:
XML-Daten
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24:
| <?xml version="1.0"?> <configuration> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> </startup> <system.serviceModel> <bindings /> <behaviors> <serviceBehaviors> <behavior name="MetaInformations"> <serviceMetadata httpGetEnabled="true" httpGetUrl="http://localhost:8500/MetaInfo" httpsGetEnabled="false" httpsGetUrl="https://localhost:8500/MetaInfo" httpsGetBinding="" policyVersion="Default" /> </behavior> </serviceBehaviors> </behaviors> <services> <service behaviorConfiguration="MetaInformations" name="Host.Service"> <endpoint address="http://localhost:8001/Service" binding="basicHttpBinding" bindingConfiguration="" name="MyEndPoint" bindingName="" contract="IHostFunctions" /> </service> </services> </system.serviceModel> </configuration> |
Die config für mexHttpsBinding:
XML-Daten
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24:
| <?xml version="1.0"?> <configuration> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> </startup> <system.serviceModel> <bindings /> <behaviors> <serviceBehaviors> <behavior name="MetaInformations"> <serviceMetadata httpGetEnabled="false" httpGetUrl="http://localhost:8500/MetaInfo" httpsGetEnabled="true" httpsGetUrl="https://localhost:8500/MetaInfo" httpsGetBinding="" policyVersion="Default" /> </behavior> </serviceBehaviors> </behaviors> <services> <service behaviorConfiguration="MetaInformations" name="Host.Service"> <endpoint address="https://localhost:8100/Service" binding="mexHttpsBinding" bindingConfiguration="" name="MyEndPoint" bindingName="" contract="IHostFunctions" /> </service> </services> </system.serviceModel> </configuration> |
Für https habe ich in der config die mexHttpsBinding eingestellt, allerdings habe ich das Probelm, dass ich im Programmaufruf nicht das Passende Binding finde:
C#-Quelltext
1: 2: 3: 4: 5: 6:
| static void Main(string[] args) { Uri baseAddress = new Uri("https://localhost:8500/MetaInfo"); ServiceHost s_host = new ServiceHost(typeof(Hostfunctions),baseAddress); s_host.AddServiceEndpoint(typeof(HostInterface), new BasicHttpBinding(), "Datumsabfrage"); ... |
Funktioniert das mit gSoap überhaupt?
Ich habe versucht, mit wshttpBinding das zu machen, allerdings gibt's da den Fehler, dass gsoap mit gSoap1.1 und gSoap 1.2 durcheinander kommt und bei der Abfrage der Daten das Charset anmeckert.
Könnt ihr mir helfen, wie ich das mit https und gSoap zum Laufen bekomme?
Mfg