vb.net - WCF client side authentication -


i'm totatally newby in consuming wcf services... reading "professional wcf 4 windows communication foundation .net 4" more server base related client consuming... so, have connect web service post data , response performed action...

i had wsdl address reference (obviously user name , password) no additional info/docs... in vb 2012, referenced web reference , got proxy built... config is

<?xml version="1.0" encoding="utf-8"?> <configurationsnapshot xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns="urn:schemas-microsoft-com:xml-wcfconfigurationsnapshot">    <behaviors />    <bindings>       <binding digest="system.servicemodel.configuration.basichttpbindingelement, system.servicemodel, version=4.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089:&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-16&quot;?&gt;&lt;data name=&quot;gestionecheckinv1implservicesoapbinding&quot;&gt;&lt;security mode=&quot;transport&quot; /&gt;&lt;/data&gt;" bindingtype="basichttpbinding" name="gestionecheckinv1implservicesoapbinding" />       <binding digest="system.servicemodel.configuration.basichttpbindingelement, system.servicemodel, version=4.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089:&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-16&quot;?&gt;&lt;data name=&quot;gestionecheckinv1implservicesoapbinding1&quot; /&gt;" bindingtype="basichttpbinding" name="gestionecheckinv1implservicesoapbinding1" />    </bindings>    <endpoints>       <endpoint normalizeddigest="&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-16&quot;?&gt;&lt;data address=&quot;https://rerprod.turitweb.it/ws/checkinv1&quot; binding=&quot;basichttpbinding&quot; bindingconfiguration=&quot;gestionecheckinv1implservicesoapbinding&quot; contract=&quot;servicereference1.gestionecheckinv1impl&quot; name=&quot;gestionecheckinv1implport&quot; /&gt;" digest="&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-16&quot;?&gt;&lt;data address=&quot;https://rerprod.turitweb.it/ws/checkinv1&quot; binding=&quot;basichttpbinding&quot; bindingconfiguration=&quot;gestionecheckinv1implservicesoapbinding&quot; contract=&quot;servicereference1.gestionecheckinv1impl&quot; name=&quot;gestionecheckinv1implport&quot; /&gt;" contractname="servicereference1.gestionecheckinv1impl" name="gestionecheckinv1implport" />    </endpoints> </configurationsnapshot> 

so, in code, wrote

dim address new system.servicemodel.endpointaddress("https://rerprod.turitweb.it/ws/checkinv1") dim binding system.servicemodel.basichttpbinding = new system.servicemodel.basichttpbinding() binding.opentimeout = new timespan(0, 0, 5) binding.closetimeout = new timespan(0, 0, 5) binding.sendtimeout = new timespan(0, 0, 5) binding.receivetimeout = new timespan(0, 0, 5) binding.security.mode = system.servicemodel.basichttpsecuritymode.transport  dim serviceclient new servicereference1.gestionecheckinv1implclient(binding, address)  dim credentialbehaviour = serviceclient.endpoint.behaviors.find(of system.servicemodel.description.clientcredentials)() credentialbehaviour.username.username = "myusername" credentialbehaviour.username.password = "mypassword"  serviceclient.open()  'loaded object model accordingly no problem dim daymov new servicereference1.inviamovimentazione(daymovements)  'and perform post action expecting results dim results list(of servicereference1.risultatogiorno) = serviceclient.inviamovimentazione(daymov.movimentazione).tolist 

but here code fails in serviceclient.inviamovimentazione(...) method "the http request forbidden client authentication scheme 'anonymous'." exception...

following channelfactory credentials + object read only indication, evev tried complete substitution of credential behaviour as

dim credentialbehaviour = serviceclient.endpoint.behaviors.find(of system.servicemodel.description.clientcredentials)() dim logincredentials system.servicemodel.description.clientcredentials = new system.servicemodel.description.clientcredentials() logincredentials.username.username = "myusername" logincredentials.username.password = "mypassword"  serviceclient.endpoint.behaviors.remove(credentialbehaviour) serviceclient.endpoint.behaviors.add(logincredentials) 

with no luck... service provider not available provide further info if i'm first user of service, and, again, i'm totally newby in wcf, i've no clue i'm doing wrong...

any hint??

tia

andrea


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -