last day (15 days later) » 

9:32 PM
0
Q: C# Could not find default endpoint element that references contract

OrionI am try for 2 weeks to get this working and still nothing :( This is the WCF Url > http://api.proactiveclothing.com/services/Product.svc I've added it as a Service Reference in Visual Studio. When I access the code as below. ServiceReference1.ProductDataServiceClient f = new Service...

 
The service must be referencing another service and that's the error you are receiving on your end. The WCF test tool provides the same results. Does not appear to be coming from your code.
 
Please point me in the right direction on how to resolve the service. I'm going nuts with this for 2 weeks now :(
 
Is it your service? do you have access to the configuration file of it? It is a reference missing on its end.
 
Yes it's my service. I downloaded the xsd and wsdl files from promostandards.org/service/overview and followed their example on setting it up. but it's not working
 
Your client side set up appears to be fine as it was generated by VS successfully. Include as part of your question the WCF config in order to troubleshoot further.
 
9:32 PM
adding config file and other information now..
Hi
Thank you so much for your assistance, greatly appreciated
I've added more information, will wait for you to take a look and advise further
 
Yep, looking at it, gimme a sec
 
sure
 
Where is your WCF hosted? is it at: api.proactiveclothing.com/services/Product.svc
 
correct
that is on our web server, which I have access to
 
9:48 PM
Do you implement a third party service provided by Proactive?
My apologies, just reading through
 
cool
 
Just to make sure we are on the same page, you have your WCF deployed on your server at api.proactiveclothing.com/services/Product.svc. Does this WCF links to another WCF?
 
We are trying to use the templates provided by Promo Standards in Canada...our client is also based in Canada. but we are doing a test on the Proactive site 1st
correct, we have the WCF hosted on our server at api.proactiveclothing.com and it does not link to any other service.
 
Gotcha
The exception you are receiving appears that your WCF tries to speak to itself kind of thing. That's where the issue resides.
To sum up, your client is fine
it speaks with the service
which tries itself to speak with a service using the same contract that's why I got confused
Is "Proactive.Product.ProductDataServiceClient" a WCF client proxy?
 
I think so, I was only able to instantiate that, so I went with it...I'm not 100% clued up with WCF and web services to be honest
 
9:54 PM
Okay, I think that's your issue
Just to make sure, can you check if Proactive.Product.ProductDataServiceClient inherits from ClientBase<T> of some sort?
 
will check now..
here is part of the class def
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
public partial class ProductDataServiceClient : System.ServiceModel.ClientBase<ProductDataService>, ProductDataService
 
Okay, great, that's your issue
 
should I remove the inheritance?
 
your service must not implement ClientBase or anything. Just to confirm, your interface is: "ProductDataService" right? I do not see any methods inside...
 
I'm not too sure...that class code was auto generated when I created the data contracts from the xsd and wsdl files using svcutil.exe
 
9:58 PM
Okay, gimme a sec
 
so I assumed that class was correct
 
It doesn't appear to be correct as the service contract (i.e. the interface "ProductDataService") must have methods.
I am going to try to generate the proper contracts and get back to you
 
ok thank so much..
I can send the code I used for the svcutil.exe?
 
Sure, go ahead, I'll check it out
 
ok looking for it :(
found it..I saved it as an image, will type it out now
this is the command I used
C:\test> "C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\svcutil.exe" .\ProductDataService.wsdl *.xsd
 
10:11 PM
Okay, I have generated it again just to make sure.
Could you please run the following commad:
 
sure
 
Okay, first to make sure, run it from VS command prompt
do you know how to access it?
 
I do
 
okay great, so open it and run this: svcutil.exe api.proactiveclothing.com/wsdl/ProductDataService.wsdl /out:"C:\XXXXXXXXXXXXX\Service.cs"
replace "XXXXXXXXX" by your output path
 
cool...in progress..
 
10:14 PM
Okay, it should be close to what you had previously but I need you to confirm the interface "ProductDataService" is not empty
 
svctuil is not recognized...I think I need to put the full path for svcutil.exe?
 
If it does not find it, yes
 
I get 'svcutil.exe' is not recognized as an internal or external command
"C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\svcutil.exe" api.proactiveclothing.com/wsdl/ProductDataService.wsdl/out:"C:\myfiles\Service.c‌​s"
also tried that and it did not go
 
Okay, gimme a sec
 
ok now i get An Error Occurred in the tool
The given paths format is not supported
 
10:27 PM
Gonna try to paste the code here..
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(Namespace="http://www.promostandards.org/WSDL/ProductDataService/1.0.0/", ConfigurationName="ProductDataService")]
public interface ProductDataService
{

// CODEGEN: Generating message contract since the operation getProduct is neither RPC nor document wrapped.
[System.ServiceModel.OperationContractAttribute(Action="getProduct", ReplyAction="*")]
[System.ServiceModel.XmlSerializerFormatAttribute()]
That should be your service contract
 
cool stuff
 
and for all the data contract, you should have this:
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("svcutil", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.promostandards.org/WSDL/ProductDataService/1.0.0/")]
public partial class GetProductRequest
{

private string wsVersionField;

private string idField;

private string passwordField;
 
copying to code file now..
 
So in your service, includes these classes under the namespace that you want
 
going to try it now, will upload the code in a few minutes...just need to prepare the class files from your code...give me a short while and will report back
 
10:30 PM
This is just the contract code
there are no implementations yet
the implementation comes after
I have to go to a meeting now and will be available in 30 minutes or so
 
ok thank you so much...will post here how it goes....have a good meeting..chat later..
 
When you are ready, make sure your service does not implement the Client and instead impement the interface u gave you
 
will do
 
11:07 PM
What you mentioned above regarding the inheritance got me thinking...and so I kept the original generated contracts as I needed to implement them and changed my Product.svc class as follows..
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;

using Proactive.Product;
using System.Collections;

namespace Proactive_WebAPI.Services
{
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Product" in code, svc and config file together.
// NOTE: In order to launch WCF Test Client for testing this service, please select Product.svc or Product.svc.cs at the Solution Explorer and start debugging.
at least now I'm getting a new error...feeling optimistic :)
New error is..
Value cannot be null.
Parameter name: Internal Error: The instance of the MessageContract cannot be null in *.
I'm accessing the service like so..
ServiceReference1.ProductDataServiceClient f = new ServiceReference1.ProductDataServiceClient();

ServiceReference1.GetProductSellableRequest req = new ServiceReference1.GetProductSellableRequest();
req.password = "xxxxx";
req.productId = "148";
ServiceReference1.GetProductSellableResponse resp = f.getProductSellable(req);
 
Okay, gimme a sec to read your reply
 
sure
 
I have never faced that error, so now I am in the blind but I am sure I will be able to figure it out. I think it comes from the XmlSerialization which I am not fund of....
 
my call to the service looks good? I'm not sure if that is the issue?
 
the call is fine. The service itself is not what WCF should llok like. one more time, not your fault, SVCutil fault...
 
11:22 PM
I think my code in the service method is returning a null value when the password is incorrect, which is the problem, will confirm now..going to upload a new dll
 
Did you upload, I got a different response now
 
Now i'm getting the infamous 'Object Ref not set to an instance of a...' error :(
@StfBln i did
sorry,was trying out the chat linking there..
 
Okay, would you be opened for a change in the datacontract? if we go in waters that I know, I might be more helpful
 
I'm open to anything that would get it work really...as long as the contract template or fields remain
 
The thing would be to change the XmlSerialization to use the DataContract serialization
Gimme a sec, I'll make it work on my side first before bugging you. gimme 15 minuytes
 
11:30 PM
ok thank you kindly
 
11:42 PM
Can you just change all the attributes like: [System.ServiceModel.OperationContractAttribute(Action = "getProductDateModified", ReplyAction = "*")]
To [System.ServiceModel.OperationContractAttribute()]
in the service contract
 
will change them now..
 
You should have just 4 of them
 
cool stuff
 
And then publish again
I have tried it on my side and it appears that was the issue
 
code updated and published..going to try it on my side..
I get the following error..
The message with Action 'getProductSellable' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).
 
11:48 PM
Yep, I can see that. I don't have the same issue on my side, let me look at your config again
 
sure
 
Can you just remove externalMetadataLocation="http://api.proactiveclothing.com/wsdl/ProductDataServi‌​ce.wsdl"
from the metadata binding?
 
where is that?
 
In the service config
 
ok found it
sorry
 
11:50 PM
np
 
change updated
still same error though...should I put it back?
 
I have ref not set to an instance...
thats' better than contract mismatch for sure
 
I'm getting contract mismatch though
 
refresh the service
 
Oh yes :)
will do now
got the same error as you have
do you think maybe its because come of the fields returned is not being populated?
 
11:57 PM
Hold on, I am gonna paste your implementation in mine
Okay, I got it now
When you create your response
make sure to do it as such:
getProductSellableResponse1 rep = new getProductSellableResponse1();
rep.GetProductSellableResponse = new GetProductSellableResponse();
you are currently missing the second line
so afterwards it crashes
 

  last day (15 days later) »