Forum Discussion

minoseah629's avatar
minoseah629
Occasional Contributor
8 years ago
Solved

soapui mockservice https

System.ArgumentException
The provided URI scheme 'http' is invalid; expected 'https'.
Parameter name: via
   at System.ServiceModel.Channels.TransportChannelFactory`1.ValidateScheme(Uri via)
   at System.ServiceModel.Channels.HttpChannelFactory`1.ValidateCreateChannelParameters(EndpointAddress remoteAddress, Uri via)
   at System.ServiceModel.Channels.HttpsChannelFactory`1.OnCreateChannelCore(EndpointAddress address, Uri via)
   at System.ServiceModel.Channels.ChannelFactoryBase`1.InternalCreateChannel(EndpointAddress address, Uri via)
   at System.ServiceModel.Channels.SecurityChannelFactory`1.OnCreateChannel(EndpointAddress address, Uri via)
   at System.ServiceModel.Channels.ChannelFactoryBase`1.InternalCreateChannel(EndpointAddress address, Uri via)
   at System.ServiceModel.Channels.ServiceChannelFactory.ServiceChannelFactoryOverRequest.CreateInnerChannelBinder(EndpointAddress to, Uri via)
   at System.ServiceModel.Channels.ServiceChannelFactory.CreateServiceChannel(EndpointAddress address, Uri via)
   at System.ServiceModel.Channels.ServiceChannelFactory.CreateChannel(Type channelType, EndpointAddress address, Uri via)
   at System.ServiceModel.ChannelFactory`1.CreateChannel(EndpointAddress address, Uri via)
   at System.ServiceModel.ClientBase`1.CreateChannel()
   at System.ServiceModel.ClientBase`1.CreateChannelInternal()
   at System.ServiceModel.ClientBase`1.get_Channel()
   at ForceDevelopmentServices.SOAAccessions.AccessionsServiceClient.ForceDevelopmentServices.SOAAccessions.AccessionsService.retrieveCommissionAgreement(retrieveCommissionAgreementRequest request) in C:\Repos\usaf-forcedevelopmentservices\ForceDevelopmentServices\Service References\SOAAccessions\Reference.cs:line 1284
   at ForceDevelopmentServices.SOAAccessions.AccessionsServiceClient.retrieveCommissionAgreement(FilterCriteria Filter) in C:\Repos\usaf-forcedevelopmentservices\ForceDevelopmentServices\Service References\SOAAccessions\Reference.cs:line 1290
   at ForceDevelopmentServices.ServiceCode.Common.SOA.Accessions.GetCommissionAgreementDaily(Int32 days) in C:\Repos\usaf-forcedevelopmentservices\ForceDevelopmentServices\ServiceCode\Common\SOA\Accessions.cs:line 38
   at ForceDevelopmentServices.ServiceImplementation.SOA.AccessionsData.GetCommissionAgreementDetailDaily(Int32 days, IAccessions soaCall) in C:\Repos\usaf-forcedevelopmentservices\ForceDevelopmentServices\ServiceImplementation\SOA\AccessionsData.svc.cs:line 37
   at FDSTest.SOA.AccessionsDataTests.Validates_notEmptyList_whenMockService_GetCommissionAgreementDetailDaily() in C:\Repos\usaf-forcedevelopmentservices\FDSTest\SOA\AccessionsDataTests.cs:line 109

Hello, 

I imported a wsdl into SOAP UI OS.  

I created a mock Service. 

 

When I turn on the mock Service and browse to it, I get a http version of wsdl. 

 

I looked around to find a way to go through HTTPs using this link : https://www.soapui.org/soap-mocking/tips-and-tricks/securing-mockservices-with-ssl.html.

 

No issue so far. 

 

With SoapUI and its mock service capability, I could use it as a way to test my application without having to develop a fake service.  

 

So with the create mock Service from SOAP UI, I used the http url provided by SOAPUI.  

 

But with the wsdl, it needs to go through HTTPs only.  

 

While using Visual Studio, here is a part of the app.config for test.

 

 <system.serviceModel>
    <client>
      <endpoint address="http://mymachine:8088/mockAccessionsServiceSOAP" binding="customBinding" bindingConfiguration="CustomSoaBinding" contract="SOAAccessions.AccessionsService" name="AccessionsServiceSOA" />

 

When I leave the app.config alone, I get this type of error:

 

 

System.ArgumentException
The provided URI scheme 'http' is invalid; expected 'https'.
Parameter name: via
   at System.ServiceModel.Channels.TransportChannelFactory`1.ValidateScheme(Uri via)
   at System.ServiceModel.Channels.HttpChannelFactory`1.ValidateCreateChannelParameters(EndpointAddress remoteAddress, Uri via)
   at System.ServiceModel.Channels.HttpsChannelFactory`1.OnCreateChannelCore(EndpointAddress address, Uri via)
   at System.ServiceModel.Channels.ChannelFactoryBase`1.InternalCreateChannel(EndpointAddress address, Uri via)
   at System.ServiceModel.Channels.SecurityChannelFactory`1.OnCreateChannel(EndpointAddress address, Uri via)
   at System.ServiceModel.Channels.ChannelFactoryBase`1.InternalCreateChannel(EndpointAddress address, Uri via)
   at System.ServiceModel.Channels.ServiceChannelFactory.ServiceChannelFactoryOverRequest.CreateInnerChannelBinder(EndpointAddress to, Uri via)
   at System.ServiceModel.Channels.ServiceChannelFactory.CreateServiceChannel(EndpointAddress address, Uri via)
   at System.ServiceModel.Channels.ServiceChannelFactory.CreateChannel(Type channelType, EndpointAddress address, Uri via)
   at System.ServiceModel.ChannelFactory`1.CreateChannel(EndpointAddress address, Uri via)
   at System.ServiceModel.ClientBase`1.CreateChannel()
   at System.ServiceModel.ClientBase`1.CreateChannelInternal()
   at System.ServiceModel.ClientBase`1.get_Channel()
   at ForceDevelopmentServices.SOAAccessions.AccessionsServiceClient.ForceDevelopmentServices.SOAAccessions.AccessionsService.retrieveCommissionAgreement(retrieveCommissionAgreementRequest request) in C:\Repos\usaf-forcedevelopmentservices\ForceDevelopmentServices\Service References\SOAAccessions\Reference.cs:line 1284
   at ForceDevelopmentServices.SOAAccessions.AccessionsServiceClient.retrieveCommissionAgreement(FilterCriteria Filter) in C:\Repos\usaf-forcedevelopmentservices\ForceDevelopmentServices\Service References\SOAAccessions\Reference.cs:line 1290
   at ForceDevelopmentServices.ServiceCode.Common.SOA.Accessions.GetCommissionAgreementDaily(Int32 days) in C:\Repos\usaf-forcedevelopmentservices\ForceDevelopmentServices\ServiceCode\Common\SOA\Accessions.cs:line 38
   at ForceDevelopmentServices.ServiceImplementation.SOA.AccessionsData.GetCommissionAgreementDetailDaily(Int32 days, IAccessions soaCall) in C:\Repos\usaf-forcedevelopmentservices\ForceDevelopmentServices\ServiceImplementation\SOA\AccessionsData.svc.cs:line 37
   at FDSTest.SOA.AccessionsDataTests.Validates_notEmptyList_whenMockService_GetCommissionAgreementDetailDaily() in C:\Repos\usaf-forcedevelopmentservices\FDSTest\SOA\AccessionsDataTests.cs:line 109

 

When I added the s at the end of http, I get this error. 

 

 

System.ServiceModel.CommunicationException
An error occurred while making the HTTP request to https://mymachine:8088/mockAccessionsServiceSOAP. This could be due to the fact that the server certificate is not configured properly with HTTP.SYS in the HTTPS case. This could also be caused by a mismatch of the security binding between the client and the server.
Server stack trace: 
   at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason)
   at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
   at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
   at System.ServiceModel.Channels.SecurityChannelFactory`1.SecurityRequestChannel.Request(Message message, TimeSpan timeout)
   at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at ForceDevelopmentServices.SOAAccessions.AccessionsService.retrieveCommissionAgreement(retrieveCommissionAgreementRequest request)
   at ForceDevelopmentServices.SOAAccessions.AccessionsServiceClient.ForceDevelopmentServices.SOAAccessions.AccessionsService.retrieveCommissionAgreement(retrieveCommissionAgreementRequest request) in C:\Repos\usaf-forcedevelopmentservices\ForceDevelopmentServices\Service References\SOAAccessions\Reference.cs:line 1284
   at ForceDevelopmentServices.SOAAccessions.AccessionsServiceClient.retrieveCommissionAgreement(FilterCriteria Filter) in C:\Repos\usaf-forcedevelopmentservices\ForceDevelopmentServices\Service References\SOAAccessions\Reference.cs:line 1290
   at ForceDevelopmentServices.ServiceCode.Common.SOA.Accessions.GetCommissionAgreementDaily(Int32 days) in C:\Repos\usaf-forcedevelopmentservices\ForceDevelopmentServices\ServiceCode\Common\SOA\Accessions.cs:line 38
   at ForceDevelopmentServices.ServiceImplementation.SOA.AccessionsData.GetCommissionAgreementDetailDaily(Int32 days, IAccessions soaCall) in C:\Repos\usaf-forcedevelopmentservices\ForceDevelopmentServices\ServiceImplementation\SOA\AccessionsData.svc.cs:line 37
   at FDSTest.SOA.AccessionsDataTests.Validates_notEmptyList_whenMockService_GetCommissionAgreementDetailDaily() in C:\Repos\usaf-forcedevelopmentservices\FDSTest\SOA\AccessionsDataTests.cs:line 109

System.Net.WebException
The underlying connection was closed: An unexpected error occurred on a send.
   at System.Net.HttpWebRequest.GetResponse()
   at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)

System.IO.IOException
The handshake failed due to an unexpected packet format.
   at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Net.TlsStream.ProcessAuthentication(LazyAsyncResult result)
   at System.Net.TlsStream.Write(Byte[] buffer, Int32 offset, Int32 size)
   at System.Net.ConnectStream.WriteHeaders(Boolean async)

 

 I then change the binding from the custombinding to a basicHttpBinding, this error appear most promising considering I could see some of the data from my mock service. 

 

+		$exception	{"The content type application/soap+xml;charset=UTF-8 of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 1024 bytes of the response were: '<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:v2=\"http://mil.dod.af.A1.personnel.dataservices.accessions/v2.0\" xmlns:mil=\"http://mil.dod.af.A1.personnel.dataservices.cleartext\">\n   <soap:Header/>\n   <soap:Body>\n      <v2:retrieveCommissionAgreementResponse>\n         <!--Zero or more repetitions:-->\n         <CommisionAgreement Id=\"123\">\n            <!--Optional:-->\n            <v2:Adn>\n               <!--Optional:-->\n               <mil:Code>123</mil:Code>\n               <!--Optional:-->\n               <mil:Value>456</mil:Value>\n            </v2:Adn>\n            <!--Optional:-->\n            <v2:CompCategory>\n               <!--Optional:-->\n               <mil:Code>123</mil:Code>\n               <!--Optional:-->\n               <mil:Value>456</mil:Value>\n            </v2:CompCategory>\n            <!--Optional:-->\n            <v2:EffectiveBeginDate>2001-01-10</v2:EffectiveBeginDate>\n            <!--Optional:-->\n            <v2:SourceOfCommission>\n               <!--Optional:-->\n       '."}	System.ServiceModel.ProtocolException

I do not have the option to update the original wsdl as it was provided to me as a service we consume for use. 

  • Since no one replied, I eventually figured it out. 

     

    Steps taken: 

    1. Start up mock Service.

    2. Create a console app. 

    3. Added Service Reference to mock Service wsdl.

    4. With this new Service Reference, app.config is generated. 

    5. Copied over appropriate binding and client endpoint to test project app.config.

    6. Ran test.

     

7 Replies

  • minoseah629's avatar
    minoseah629
    Occasional Contributor

    Since no one replied, I eventually figured it out. 

     

    Steps taken: 

    1. Start up mock Service.

    2. Create a console app. 

    3. Added Service Reference to mock Service wsdl.

    4. With this new Service Reference, app.config is generated. 

    5. Copied over appropriate binding and client endpoint to test project app.config.

    6. Ran test.

     

  • miras's avatar
    miras
    New Contributor

    Hello minoseah629,

     

    Yes, it's first document I've studied.

    Generally I have service provider for one integration and it requires mutual connection (present certificate first). The problem is in my kestore or on service provider side, I need to be sure so I want to emulate service provider service with soapui (mock service). It works perfect for http but I would expect after mock service is enabled in soapui properties, automatically https connection is open but it doesn't.

    • minoseah629's avatar
      minoseah629
      Occasional Contributor

      i suggest starting up a new discussion because i didnt have the issue you are describing.