Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consuming wcf service(WSHttpbinding) in Node.js #12

Open
praj25 opened this issue Mar 10, 2016 · 1 comment
Open

Consuming wcf service(WSHttpbinding) in Node.js #12

praj25 opened this issue Mar 10, 2016 · 1 comment

Comments

@praj25
Copy link

praj25 commented Mar 10, 2016

@yaronn I am trying to consume a WCF service using NodeJS. I tried BasicHttpBinding with security mode="TransportWithMessageCredential". It is working fine. But if I try to consume the service with WsHttpBinding and security mode="TransportWithMessageCredential",

*The following error is thrown:
*

"The message could not be processed. This is most likely because the action 'http://tempuri.org/IService1/GetData' is incorrect or because the message contains an invalid or expired security context token or because there is a mismatch between bindings. The security context token would be invalid if the service aborted the channel due to inactivity. To prevent the service from aborting idle sessions prematurely increase the Receive timeout on the service endpoint's binding."

This is my NodeJS Code

var WSHttpBinding = require('wcf.js').WSHttpBinding
, Proxy = require('wcf.js').Proxy
, binding = new WSHttpBinding(
{
SecurityMode: "TransportWithMessageCredential"
, TransportClientCredentialType:"None"
, MessageClientCredentialType: "UserName"
})
, proxy = new Proxy(binding, "https://localhost:44301/Service1.svc")
, message = '<Envelope xmlns="http://www.w3.org/2003/05/soap-envelope">'+ '<Body>'+ '<GetData xmlns="http://tempuri.org/">'+ '<value>12345</value>'+ '</GetData>'+ '</Body>'+ '</Envelope>'

proxy.ClientCredentials.Username.Username = "xyz"
proxy.ClientCredentials.Username.Password = "xyz"
proxy.send(message, "http://tempuri.org/IService1/GetData", function(response, ctx) {
console.log(response)
});

This is my web config
<bindings> <wsHttpBinding> <binding name="WsHttpBinding" maxReceivedMessageSize="104857600" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:01:00" sendTimeout="00:01:00" messageEncoding="Text" textEncoding="utf-8"> <security mode="TransportWithMessageCredential"> <transport clientCredentialType="None"/> <message clientCredentialType="UserName"/> </security> </binding> </wsHttpBinding> </bindings> <services> <service name="WcfService1.Service1" behaviorConfiguration="DefaultServiceBehaviors"> <endpoint address="" binding="wsHttpBinding" contract="WcfService1.IService1" name="WsHttpEndpoint" bindingConfiguration="WsHttpBinding"/> </service> </services>

@yaronn
Copy link
Owner

yaronn commented Mar 12, 2016

try to compare the outgping message from node.js and a working wcf client (you can publish both here for review).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants