none
Dificuldade com WebServices RRS feed

  • Pergunta

  • Bom dia,

    Eu estou precisando de uma ajuda para consumir webservices ASMX pelo silverlight. Apenas consigo consumir webservice HTTPS já com HTTP e encontro o seguinte erro:

    "The provided URI scheme 'http' is invalid; expected 'https'.
    Parameter name: via"

    https://www.timheuer.com/foo.asmx
    

    Segue o meu código, note que tem 2 webreferences a

    "https://www.timheuer.com/foo.asmx" que funciona normalmente e a "http://localhost:4585/WebSite1/Service.asmx" <br/>
    que da a msg de erro acima.<br/>
    
    

    :

    ServicesReferences.ClientConfig

     

    <configuration>
     <system.serviceModel>
      <client>
       <endpoint address="http://localhost:4585/WebSite1/Service.asmx"
        binding="basicHttpBinding" bindingConfiguration="ServiceSoap"
        contract="WS.ServiceSoap" name="ServiceSoap" />
       <endpoint address="https://www.timheuer.com/foo.asmx" binding="basicHttpBinding"
        bindingConfiguration="fooSoap" contract="foo.fooSoap" name="fooSoap" />
      </client>
      <bindings>
       <basicHttpBinding>
        <binding name="ServiceSoap" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
         <security mode="Transport" />
        </binding>
        <binding name="fooSoap" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
         <security mode="Transport" />
        </binding>
       </basicHttpBinding>
      </bindings>
     </system.serviceModel>
    </configuration>
    
    ClientAccessPolicy.xml

     

     

    <?xml version="1.0" encoding="utf-8"?>
    <access-policy>
     <cross-domain-access>
      <policy>
       <allow-from http-request-headers="SOAPAction">
        <domain uri="http://*"/>
        <domain uri="https://*" />
       </allow-from>
       <grant-to>
        <resource include-subpaths="false" path="/"/>
       </grant-to>
      </policy>
     </cross-domain-access>
    </access-policy>
    
    

     

    crossdomain.xml

     

    <?xml version="1.0"?>
    <cross-domain-policy>
     <allow-access-from domain="*" />
     <allow-http-request-headers-from domain="*" headers="SOAPAction" />
    </cross-domain-policy>
    
    MainPage.xaml.vb

     

     

    Partial Public Class MainPage
      Inherits UserControl
      Dim ws As New WS.ServiceSoapClient
      Dim foo As New foo.fooSoapClient
      Public Sub New()
        InitializeComponent()
        AddHandler ws.HelloWorldCompleted, AddressOf ws_Completed
        AddHandler foo.HelloWorldCompleted, AddressOf foo_Completed
        ws.HelloWorldAsync()
        foo.HelloWorldAsync()
      End Sub
    
      Private Sub ws_Completed(ByVal sender As Object, ByVal e As SilverlightApplication1.WS.HelloWorldCompletedEventArgs)
        txt.Text = e.Result
      End Sub
      Private Sub foo_Completed(ByVal sender As Object, ByVal e As SilverlightApplication1.foo.HelloWorldCompletedEventArgs)
        txt2.Text = e.Result
      End Sub
    End Class
    

     

    quarta-feira, 6 de outubro de 2010 13:06

Respostas

Todas as Respostas